[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150414181445.6081.32372.stgit@gimli.home>
Date: Tue, 14 Apr 2015 12:14:45 -0600
From: Alex Williamson <alex.williamson@...hat.com>
To: alex.williamson@...hat.com
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: [PATCH 1/2] vfio: Flush signals on device request interruption
Signals don't just interrupt our wait, they remain pending such that
subsequent wait_events timeout immediately. This can cause a CPU to
spin with a single signal. Flush signals if we receive an
interruption and also log information about the reason the task is
blocked.
Signed-off-by: Alex Williamson <alex.williamson@...hat.com>
Cc: stable@...r.kernel.org # v4.0
---
drivers/vfio/vfio.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 0d33662..4c786d4 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -710,6 +710,7 @@ 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;
/*
* The group exists so long as we have a device reference. Get
@@ -755,9 +756,15 @@ 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);
+ ret = wait_event_interruptible_timeout(vfio.release_q,
+ !vfio_dev_present(group, dev), HZ * 10);
+ if (ret == -ERESTARTSYS) {
+ flush_signals(current);
+ dev_warn_ratelimited(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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists