Documentation/arch/s390/vfio-ap.rst | 18 ++++++------------ drivers/vfio/group.c | 3 --- drivers/vfio/vfio.h | 1 - drivers/vfio/vfio_iommu_type1.c | 1 - 4 files changed, 6 insertions(+), 17 deletions(-)
group->notifier is dead code. VFIO initializes it and checks it for emptiness on
teardown, but nobody ever registers on it or triggers it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
Documentation/arch/s390/vfio-ap.rst | 18 ++++++------------
drivers/vfio/group.c | 3 ---
drivers/vfio/vfio.h | 1 -
drivers/vfio/vfio_iommu_type1.c | 1 -
4 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/Documentation/arch/s390/vfio-ap.rst b/Documentation/arch/s390/vfio-ap.rst
index eba1991fbdba..2de0560bd70c 100644
--- a/Documentation/arch/s390/vfio-ap.rst
+++ b/Documentation/arch/s390/vfio-ap.rst
@@ -431,17 +431,14 @@ matrix device.
* callback interfaces
open_device:
- The vfio_ap driver uses this callback to register a
- VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the matrix mdev
- devices. The open_device callback is invoked by userspace to connect the
- VFIO iommu group for the matrix mdev device to the MDEV bus. Access to the
- KVM structure used to configure the KVM guest is provided via this callback.
- The KVM structure, is used to configure the guest's access to the AP matrix
- defined via the vfio_ap mediated device's sysfs attribute files.
+ the open_device callback is invoked by userspace to connect the
+ VFIO iommu group for the matrix mdev device to the MDEV bus. The
+ callback retrieves the KVM structure used to configure the KVM guest
+ and configures the guest's access to the AP matrix defined via the
+ vfio_ap mediated device's sysfs attribute files.
close_device:
- unregisters the VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the
- matrix mdev device and deconfigures the guest's AP matrix.
+ this callback deconfigures the guest's AP matrix.
ioctl:
this callback handles the VFIO_DEVICE_GET_INFO and VFIO_DEVICE_RESET ioctls
@@ -449,9 +444,8 @@ matrix device.
Configure the guest's AP resources
----------------------------------
-Configuring the AP resources for a KVM guest will be performed when the
-VFIO_GROUP_NOTIFY_SET_KVM notifier callback is invoked. The notifier
-function is called when userspace connects to KVM. The guest's AP resources are
+Configuring the AP resources for a KVM guest will be performed at the
+time of ``open_device`` and ``close_device``. The guest's AP resources are
configured via its APCB by:
* Setting the bits in the APM corresponding to the APIDs assigned to the
diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
index 4f15016d2a5f..731dd0dead0d 100644
--- a/drivers/vfio/group.c
+++ b/drivers/vfio/group.c
@@ -456,7 +456,6 @@ static int vfio_group_fops_release(struct inode *inode, struct file *filep)
* Device FDs hold a group file reference, therefore the group release
* is only called when there are no open devices.
*/
- WARN_ON(group->notifier.head);
if (group->container)
vfio_group_detach_container(group);
if (group->iommufd) {
@@ -541,7 +540,6 @@ static struct vfio_group *vfio_group_alloc(struct iommu_group *iommu_group,
/* put in vfio_group_release() */
iommu_group_ref_get(iommu_group);
group->type = type;
- BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier);
return group;
}
@@ -720,7 +718,6 @@ void vfio_device_remove_group(struct vfio_device *device)
* properly hold the group reference.
*/
WARN_ON(!list_empty(&group->device_list));
- WARN_ON(group->notifier.head);
/*
* Revoke all users of group->iommu_group. At this point we know there
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index 50128da18bca..0854f3fa1a22 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -90,7 +90,6 @@ struct vfio_group {
struct mutex group_lock;
struct kvm *kvm;
struct file *opened_file;
- struct blocking_notifier_head notifier;
struct iommufd_ctx *iommufd;
spinlock_t kvm_ref_lock;
unsigned int cdev_device_open_cnt;
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 03cefdf99a4a..c8151ba54de3 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -36,7 +36,6 @@
#include <linux/uaccess.h>
#include <linux/vfio.h>
#include <linux/workqueue.h>
-#include <linux/notifier.h>
#include <linux/mm_inline.h>
#include <linux/overflow.h>
#include "vfio.h"
--
2.53.0
On Tue, 7 Apr 2026 19:59:34 +0200 Paolo Bonzini <pbonzini@redhat.com> wrote: > group->notifier is dead code. VFIO initializes it and checks it for emptiness on > teardown, but nobody ever registers on it or triggers it. > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- > Documentation/arch/s390/vfio-ap.rst | 18 ++++++------------ > drivers/vfio/group.c | 3 --- > drivers/vfio/vfio.h | 1 - > drivers/vfio/vfio_iommu_type1.c | 1 - > 4 files changed, 6 insertions(+), 17 deletions(-) Applied to vfio next branch for v7.1. Thanks, Alex
On Tue, Apr 07, 2026 at 07:59:34PM +0200, Paolo Bonzini wrote:
> group->notifier is dead code. VFIO initializes it and checks it for emptiness on
> teardown, but nobody ever registers on it or triggers it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> Documentation/arch/s390/vfio-ap.rst | 18 ++++++------------
> drivers/vfio/group.c | 3 ---
> drivers/vfio/vfio.h | 1 -
> drivers/vfio/vfio_iommu_type1.c | 1 -
> 4 files changed, 6 insertions(+), 17 deletions(-)
Fixes: 421cfe6596f6 ("vfio: remove VFIO_GROUP_NOTIFY_SET_KVM")
?
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
On Fri, 10 Apr 2026 15:10:06 -0300
Jason Gunthorpe <jgg@ziepe.ca> wrote:
> On Tue, Apr 07, 2026 at 07:59:34PM +0200, Paolo Bonzini wrote:
> > group->notifier is dead code. VFIO initializes it and checks it for emptiness on
> > teardown, but nobody ever registers on it or triggers it.
> >
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> > Documentation/arch/s390/vfio-ap.rst | 18 ++++++------------
> > drivers/vfio/group.c | 3 ---
> > drivers/vfio/vfio.h | 1 -
> > drivers/vfio/vfio_iommu_type1.c | 1 -
> > 4 files changed, 6 insertions(+), 17 deletions(-)
>
> Fixes: 421cfe6596f6 ("vfio: remove VFIO_GROUP_NOTIFY_SET_KVM")
>
> ?
Technically yes, but is it really worth having stable pick this up?
Seems not. Thanks,
Alex
On 4/7/26 1:59 PM, Paolo Bonzini wrote:
> group->notifier is dead code. VFIO initializes it and checks it for emptiness on
> teardown, but nobody ever registers on it or triggers it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
There are two minor review comments about capitalization at the
beginning of
sentences in the vfio-ap.rst document in the Documentation/arch/s390
directory. Other than that:
Acked-by: Anthony Krowiak <akrowiak@linux.ibm.com>
> ---
> Documentation/arch/s390/vfio-ap.rst | 18 ++++++------------
> drivers/vfio/group.c | 3 ---
> drivers/vfio/vfio.h | 1 -
> drivers/vfio/vfio_iommu_type1.c | 1 -
> 4 files changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/Documentation/arch/s390/vfio-ap.rst b/Documentation/arch/s390/vfio-ap.rst
> index eba1991fbdba..2de0560bd70c 100644
> --- a/Documentation/arch/s390/vfio-ap.rst
> +++ b/Documentation/arch/s390/vfio-ap.rst
> @@ -431,17 +431,14 @@ matrix device.
> * callback interfaces
>
> open_device:
> - The vfio_ap driver uses this callback to register a
> - VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the matrix mdev
> - devices. The open_device callback is invoked by userspace to connect the
> - VFIO iommu group for the matrix mdev device to the MDEV bus. Access to the
> - KVM structure used to configure the KVM guest is provided via this callback.
> - The KVM structure, is used to configure the guest's access to the AP matrix
> - defined via the vfio_ap mediated device's sysfs attribute files.
> + the open_device callback is invoked by userspace to connect the
Capitalization:
s/the open_device callback/The open device callback/
> + VFIO iommu group for the matrix mdev device to the MDEV bus. The
> + callback retrieves the KVM structure used to configure the KVM guest
> + and configures the guest's access to the AP matrix defined via the
> + vfio_ap mediated device's sysfs attribute files.
>
> close_device:
> - unregisters the VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the
> - matrix mdev device and deconfigures the guest's AP matrix.
> + this callback deconfigures the guest's AP matrix.
Capitalization:
s/this callback/This callback/
>
> ioctl:
> this callback handles the VFIO_DEVICE_GET_INFO and VFIO_DEVICE_RESET ioctls
> @@ -449,9 +444,8 @@ matrix device.
>
> Configure the guest's AP resources
> ----------------------------------
> -Configuring the AP resources for a KVM guest will be performed when the
> -VFIO_GROUP_NOTIFY_SET_KVM notifier callback is invoked. The notifier
> -function is called when userspace connects to KVM. The guest's AP resources are
> +Configuring the AP resources for a KVM guest will be performed at the
> +time of ``open_device`` and ``close_device``. The guest's AP resources are
> configured via its APCB by:
>
> * Setting the bits in the APM corresponding to the APIDs assigned to the
> diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
> index 4f15016d2a5f..731dd0dead0d 100644
> --- a/drivers/vfio/group.c
> +++ b/drivers/vfio/group.c
> @@ -456,7 +456,6 @@ static int vfio_group_fops_release(struct inode *inode, struct file *filep)
> * Device FDs hold a group file reference, therefore the group release
> * is only called when there are no open devices.
> */
> - WARN_ON(group->notifier.head);
> if (group->container)
> vfio_group_detach_container(group);
> if (group->iommufd) {
> @@ -541,7 +540,6 @@ static struct vfio_group *vfio_group_alloc(struct iommu_group *iommu_group,
> /* put in vfio_group_release() */
> iommu_group_ref_get(iommu_group);
> group->type = type;
> - BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier);
>
> return group;
> }
> @@ -720,7 +718,6 @@ void vfio_device_remove_group(struct vfio_device *device)
> * properly hold the group reference.
> */
> WARN_ON(!list_empty(&group->device_list));
> - WARN_ON(group->notifier.head);
>
> /*
> * Revoke all users of group->iommu_group. At this point we know there
> diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
> index 50128da18bca..0854f3fa1a22 100644
> --- a/drivers/vfio/vfio.h
> +++ b/drivers/vfio/vfio.h
> @@ -90,7 +90,6 @@ struct vfio_group {
> struct mutex group_lock;
> struct kvm *kvm;
> struct file *opened_file;
> - struct blocking_notifier_head notifier;
> struct iommufd_ctx *iommufd;
> spinlock_t kvm_ref_lock;
> unsigned int cdev_device_open_cnt;
> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> index 03cefdf99a4a..c8151ba54de3 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -36,7 +36,6 @@
> #include <linux/uaccess.h>
> #include <linux/vfio.h>
> #include <linux/workqueue.h>
> -#include <linux/notifier.h>
> #include <linux/mm_inline.h>
> #include <linux/overflow.h>
> #include "vfio.h"
On Wed, Apr 8, 2026 at 4:35 PM Anthony Krowiak <akrowiak@linux.ibm.com> wrote: > > > > open_device: > > - The vfio_ap driver uses this callback to register a > > - VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the matrix mdev > > - devices. The open_device callback is invoked by userspace to connect the > > - VFIO iommu group for the matrix mdev device to the MDEV bus. Access to the > > - KVM structure used to configure the KVM guest is provided via this callback. > > - The KVM structure, is used to configure the guest's access to the AP matrix > > - defined via the vfio_ap mediated device's sysfs attribute files. > > + the open_device callback is invoked by userspace to connect the > > Capitalization: > s/the open_device callback/The open device callback/ > > > + VFIO iommu group for the matrix mdev device to the MDEV bus. The > > + callback retrieves the KVM structure used to configure the KVM guest > > + and configures the guest's access to the AP matrix defined via the > > + vfio_ap mediated device's sysfs attribute files. > > > > close_device: > > - unregisters the VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the > > - matrix mdev device and deconfigures the guest's AP matrix. > > + this callback deconfigures the guest's AP matrix. > > Capitalization: > s/this callback/This callback/ Heh, I had to pick one or the other (close_device previously used lowercase) and chose the wrong one. :) Thanks for reviewing the s390 docs, I wasn't sure about the new text was enough. Paolo
On Wed, Apr 8, 2026 at 4:36 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On Wed, Apr 8, 2026 at 4:35 PM Anthony Krowiak <akrowiak@linux.ibm.com> wrote:
> >
> >
> > > open_device:
> > > - The vfio_ap driver uses this callback to register a
> > > - VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the matrix mdev
> > > - devices. The open_device callback is invoked by userspace to connect the
> > > - VFIO iommu group for the matrix mdev device to the MDEV bus. Access to the
> > > - KVM structure used to configure the KVM guest is provided via this callback.
> > > - The KVM structure, is used to configure the guest's access to the AP matrix
> > > - defined via the vfio_ap mediated device's sysfs attribute files.
> > > + the open_device callback is invoked by userspace to connect the
> >
> > Capitalization:
> > s/the open_device callback/The open device callback/
> >
> > Capitalization:
> > s/this callback/This callback/
>
> Heh, I had to pick one or the other (close_device previously used
> lowercase) and chose the wrong one. :)
I was going to make the change, but then noticed that lowercase is
more common in the file:
create:
allocates the ap_matrix_mdev structure used by the vfio_ap driver to:
remove:
deallocates the vfio_ap mediated device's ap_matrix_mdev structure.
This will be allowed only if a running guest is not using the mdev.
ioctl:
this callback handles the VFIO_DEVICE_GET_INFO and VFIO_DEVICE_RESET
ioctls defined by the vfio framework.
What do you think?
Paolo
On 4/8/26 6:00 PM, Paolo Bonzini wrote: > On Wed, Apr 8, 2026 at 4:36 PM Paolo Bonzini <pbonzini@redhat.com> wrote: >> On Wed, Apr 8, 2026 at 4:35 PM Anthony Krowiak <akrowiak@linux.ibm.com> wrote: >>> >>>> open_device: >>>> - The vfio_ap driver uses this callback to register a >>>> - VFIO_GROUP_NOTIFY_SET_KVM notifier callback function for the matrix mdev >>>> - devices. The open_device callback is invoked by userspace to connect the >>>> - VFIO iommu group for the matrix mdev device to the MDEV bus. Access to the >>>> - KVM structure used to configure the KVM guest is provided via this callback. >>>> - The KVM structure, is used to configure the guest's access to the AP matrix >>>> - defined via the vfio_ap mediated device's sysfs attribute files. >>>> + the open_device callback is invoked by userspace to connect the >>> Capitalization: >>> s/the open_device callback/The open device callback/ >>> >>> Capitalization: >>> s/this callback/This callback/ >> Heh, I had to pick one or the other (close_device previously used >> lowercase) and chose the wrong one. :) > I was going to make the change, but then noticed that lowercase is > more common in the file: > > create: > allocates the ap_matrix_mdev structure used by the vfio_ap driver to: > > remove: > deallocates the vfio_ap mediated device's ap_matrix_mdev structure. > This will be allowed only if a running guest is not using the mdev. > > ioctl: > this callback handles the VFIO_DEVICE_GET_INFO and VFIO_DEVICE_RESET > ioctls defined by the vfio framework. > > What do you think? It's not critical. If that's the case, leave it lower case > > Paolo >
© 2016 - 2026 Red Hat, Inc.