diff options
| -rw-r--r-- | drivers/vfio/pci/vfio_pci.c | 8 | ||||
| -rw-r--r-- | drivers/vfio/vfio.c | 21 |
2 files changed, 25 insertions, 4 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 69fab0fd15ae..e9851add6f4e 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
| @@ -907,8 +907,14 @@ static void vfio_pci_request(void *device_data, unsigned int count) | |||
| 907 | mutex_lock(&vdev->igate); | 907 | mutex_lock(&vdev->igate); |
| 908 | 908 | ||
| 909 | if (vdev->req_trigger) { | 909 | if (vdev->req_trigger) { |
| 910 | dev_dbg(&vdev->pdev->dev, "Requesting device from user\n"); | 910 | if (!(count % 10)) |
| 911 | dev_notice_ratelimited(&vdev->pdev->dev, | ||
| 912 | "Relaying device request to user (#%u)\n", | ||
| 913 | count); | ||
| 911 | eventfd_signal(vdev->req_trigger, 1); | 914 | eventfd_signal(vdev->req_trigger, 1); |
| 915 | } else if (count == 0) { | ||
| 916 | dev_warn(&vdev->pdev->dev, | ||
| 917 | "No device request channel registered, blocked until released by user\n"); | ||
| 912 | } | 918 | } |
| 913 | 919 | ||
| 914 | mutex_unlock(&vdev->igate); | 920 | mutex_unlock(&vdev->igate); |
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 0d336625ac71..e1278fe04b1e 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c | |||
| @@ -710,6 +710,8 @@ void *vfio_del_group_dev(struct device *dev) | |||
| 710 | void *device_data = device->device_data; | 710 | void *device_data = device->device_data; |
| 711 | struct vfio_unbound_dev *unbound; | 711 | struct vfio_unbound_dev *unbound; |
| 712 | unsigned int i = 0; | 712 | unsigned int i = 0; |
| 713 | long ret; | ||
| 714 | bool interrupted = false; | ||
| 713 | 715 | ||
| 714 | /* | 716 | /* |
| 715 | * The group exists so long as we have a device reference. Get | 717 | * The group exists so long as we have a device reference. Get |
| @@ -755,9 +757,22 @@ void *vfio_del_group_dev(struct device *dev) | |||
| 755 | 757 | ||
| 756 | vfio_device_put(device); | 758 | vfio_device_put(device); |
| 757 | 759 | ||
| 758 | } while (wait_event_interruptible_timeout(vfio.release_q, | 760 | if (interrupted) { |
| 759 | !vfio_dev_present(group, dev), | 761 | ret = wait_event_timeout(vfio.release_q, |
| 760 | HZ * 10) <= 0); | 762 | !vfio_dev_present(group, dev), HZ * 10); |
| 763 | } else { | ||
| 764 | ret = wait_event_interruptible_timeout(vfio.release_q, | ||
| 765 | !vfio_dev_present(group, dev), HZ * 10); | ||
| 766 | if (ret == -ERESTARTSYS) { | ||
| 767 | interrupted = true; | ||
| 768 | dev_warn(dev, | ||
| 769 | "Device is currently in use, task" | ||
| 770 | " \"%s\" (%d) " | ||
| 771 | "blocked until device is released", | ||
| 772 | current->comm, task_pid_nr(current)); | ||
| 773 | } | ||
| 774 | } | ||
| 775 | } while (ret <= 0); | ||
| 761 | 776 | ||
| 762 | vfio_group_put(group); | 777 | vfio_group_put(group); |
| 763 | 778 | ||
