public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] s390/vfio-ap: fix hang when mdev attached to guest is removed
@ 2023-05-30 22:35 Tony Krowiak
  2023-05-30 22:35 ` [PATCH 1/3] vfio: ap: realize the VFIO_DEVICE_GET_IRQ_INFO ioctl Tony Krowiak
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Tony Krowiak @ 2023-05-30 22:35 UTC (permalink / raw)
  To: linux-s390, linux-kernel, kvm
  Cc: jjherne, pasic, farman, mjrosato, alex.williamson, borntraeger

When a user attempts to remove a vfio-ap mediated device attached to a
guest, the operation hangs until the mdev's fd is closed by the guest
(i.e., the hostdev is detached or the guest is shut down). This patch 
series provides kernel-side code that allows userspace to set up a 
communication channel that will allow the vfio_ap device driver to notify 
userspace when a request to release the mdev is received, so that userspace
can close the mdev fd and avoid the hang. The patch series provides the 
following:  

1. Introduces code to handle the VFIO_DEVICE_GET_IRQ_INFO and 
   VFIO_DEVICE_SET_IRQS ioctl calls to set the eventfd_ctx for signaling a
   device request to userspace. 

2. Wires up the VFIO bus driver callback to request a release of the mdev.
   When invoked, the vfio_ap device driver will use the eventfd_ctx set up
   in #1 to signal a request to userspace to release the mdev.


Note:
----
If a user subsequently attempts to restart the guest or re-attach the mdev,
the operation will fail with a message indicating the domain is already
active. This is a libvirt problem resolved with the following commit:

commit ebd004a03dbd ("security: do not remember/recall labels for VFIO 
MDEVs") 

Tony Krowiak (3):
  vfio: ap: realize the VFIO_DEVICE_GET_IRQ_INFO ioctl
  vfio: ap: realize the VFIO_DEVICE_SET_IRQS ioctl
  s390/vfio-ap: Wire in the vfio_device_ops request callback

 drivers/s390/crypto/vfio_ap_ops.c     | 134 +++++++++++++++++++++++++-
 drivers/s390/crypto/vfio_ap_private.h |   3 +
 include/uapi/linux/vfio.h             |   9 ++
 3 files changed, 145 insertions(+), 1 deletion(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-06-02 12:47 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-30 22:35 [PATCH 0/3] s390/vfio-ap: fix hang when mdev attached to guest is removed Tony Krowiak
2023-05-30 22:35 ` [PATCH 1/3] vfio: ap: realize the VFIO_DEVICE_GET_IRQ_INFO ioctl Tony Krowiak
2023-05-31 12:54   ` Cédric Le Goater
2023-05-31 13:05     ` Anthony Krowiak
2023-05-31 13:20       ` Cédric Le Goater
2023-06-01 20:46   ` Alex Williamson
2023-05-30 22:35 ` [PATCH 2/3] vfio: ap: realize the VFIO_DEVICE_SET_IRQS ioctl Tony Krowiak
2023-05-31 13:00   ` Cédric Le Goater
2023-05-30 22:35 ` [PATCH 3/3] s390/vfio-ap: Wire in the vfio_device_ops request callback Tony Krowiak
2023-05-31 13:01   ` Cédric Le Goater
2023-05-31 14:48 ` [PATCH 0/3] s390/vfio-ap: fix hang when mdev attached to guest is removed Matthew Rosato
2023-06-01 12:15   ` Anthony Krowiak
2023-06-01 12:57     ` Matthew Rosato
2023-05-31 14:51 ` Matthew Rosato
2023-06-01 20:47   ` Alex Williamson
2023-06-02 12:46     ` Alexander Gordeev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox