mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-28 19:33:35 -05:00
Merge tag 'vfio-v4.1-rc3' of git://github.com/awilliam/linux-vfio
Pull vfio fixes from Alex Williamson: "Fix some undesirable behavior with the vfio device request interface: - increase verbosity of device request channel (Alex Williamson) - fix runaway interruptible timeout (Alex Williamson)" * tag 'vfio-v4.1-rc3' of git://github.com/awilliam/linux-vfio: vfio: Fix runaway interruptible timeout vfio-pci: Log device requests more verbosely
This commit is contained in:
@@ -907,8 +907,14 @@ static void vfio_pci_request(void *device_data, unsigned int count)
|
||||
mutex_lock(&vdev->igate);
|
||||
|
||||
if (vdev->req_trigger) {
|
||||
dev_dbg(&vdev->pdev->dev, "Requesting device from user\n");
|
||||
if (!(count % 10))
|
||||
dev_notice_ratelimited(&vdev->pdev->dev,
|
||||
"Relaying device request to user (#%u)\n",
|
||||
count);
|
||||
eventfd_signal(vdev->req_trigger, 1);
|
||||
} else if (count == 0) {
|
||||
dev_warn(&vdev->pdev->dev,
|
||||
"No device request channel registered, blocked until released by user\n");
|
||||
}
|
||||
|
||||
mutex_unlock(&vdev->igate);
|
||||
|
||||
@@ -710,6 +710,8 @@ void *vfio_del_group_dev(struct device *dev)
|
||||
void *device_data = device->device_data;
|
||||
struct vfio_unbound_dev *unbound;
|
||||
unsigned int i = 0;
|
||||
long ret;
|
||||
bool interrupted = false;
|
||||
|
||||
/*
|
||||
* The group exists so long as we have a device reference. Get
|
||||
@@ -755,9 +757,22 @@ void *vfio_del_group_dev(struct device *dev)
|
||||
|
||||
vfio_device_put(device);
|
||||
|
||||
} while (wait_event_interruptible_timeout(vfio.release_q,
|
||||
!vfio_dev_present(group, dev),
|
||||
HZ * 10) <= 0);
|
||||
if (interrupted) {
|
||||
ret = wait_event_timeout(vfio.release_q,
|
||||
!vfio_dev_present(group, dev), HZ * 10);
|
||||
} else {
|
||||
ret = wait_event_interruptible_timeout(vfio.release_q,
|
||||
!vfio_dev_present(group, dev), HZ * 10);
|
||||
if (ret == -ERESTARTSYS) {
|
||||
interrupted = true;
|
||||
dev_warn(dev,
|
||||
"Device is currently in use, task"
|
||||
" \"%s\" (%d) "
|
||||
"blocked until device is released",
|
||||
current->comm, task_pid_nr(current));
|
||||
}
|
||||
}
|
||||
} while (ret <= 0);
|
||||
|
||||
vfio_group_put(group);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user