From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: <kvm@vger.kernel.org>,
linux-kernel@vger.kernel.org,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Sebastian Ott <sebott@linux.vnet.ibm.com>,
Gerald Schaefer <gerald.schaefer@de.ibm.com>
Subject: [RFC PATCH 1/1] vfio-pci/iommu: Detach iommu group on remove path
Date: Tue, 21 Jul 2015 19:44:06 +0200 [thread overview]
Message-ID: <1437500646-18031-2-git-send-email-gerald.schaefer@de.ibm.com> (raw)
In-Reply-To: <1437500646-18031-1-git-send-email-gerald.schaefer@de.ibm.com>
When a user completes the VFIO_SET_IOMMU ioctl and the vfio-pci device is
removed thereafter (before any other ioctl like VFIO_GROUP_GET_DEVICE_FD),
then the detach_dev callback of the underlying IOMMU API is never called.
This patch adds a call to vfio_group_try_dissolve_container() to the remove
path, which will trigger the missing detach_dev callback in this scenario.
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
---
drivers/vfio/vfio.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 2fb29df..9c5c784 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -711,6 +711,8 @@ static bool vfio_dev_present(struct vfio_group *group, struct device *dev)
return true;
}
+static void vfio_group_try_dissolve_container(struct vfio_group *group);
+
/*
* Decrement the device reference count and wait for the device to be
* removed. Open file descriptors for the device... */
@@ -785,6 +787,7 @@ void *vfio_del_group_dev(struct device *dev)
}
} while (ret <= 0);
+ vfio_group_try_dissolve_container(group);
vfio_group_put(group);
return device_data;
--
2.3.8
next prev parent reply other threads:[~2015-07-21 17:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-21 17:44 [RFC PATCH 0/1] vfio-pci/iommu: Detach iommu group on remove path Gerald Schaefer
2015-07-21 17:44 ` Gerald Schaefer [this message]
2015-07-22 16:54 ` [RFC PATCH 1/1] " Alex Williamson
2015-07-22 17:10 ` Alex Williamson
2015-07-23 13:27 ` Gerald Schaefer
2015-07-23 13:03 ` Gerald Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437500646-18031-2-git-send-email-gerald.schaefer@de.ibm.com \
--to=gerald.schaefer@de.ibm.com \
--cc=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
--cc=sebott@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox