Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -907,8 +907,14 @@ static void vfio_pci_request(void *device_data, unsigned int count)
	mutex_lock(&vdev->igate);
	mutex_lock(&vdev->igate);


	if (vdev->req_trigger) {
	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);
		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);
	mutex_unlock(&vdev->igate);
+18 −3
Original line number Original line Diff line number Diff line
@@ -710,6 +710,8 @@ void *vfio_del_group_dev(struct device *dev)
	void *device_data = device->device_data;
	void *device_data = device->device_data;
	struct vfio_unbound_dev *unbound;
	struct vfio_unbound_dev *unbound;
	unsigned int i = 0;
	unsigned int i = 0;
	long ret;
	bool interrupted = false;


	/*
	/*
	 * The group exists so long as we have a device reference.  Get
	 * 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);
		vfio_device_put(device);


	} while (wait_event_interruptible_timeout(vfio.release_q,
		if (interrupted) {
						  !vfio_dev_present(group, dev),
			ret = wait_event_timeout(vfio.release_q,
						  HZ * 10) <= 0);
					!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);
	vfio_group_put(group);