Commit 7bbcd1b8 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 8cb7c15b db7d4d7f
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment