mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Williamson <alex@shazbot.org>
To: Jiale Yao <yaojiale02@163.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	alex@shazbot.org
Subject: Re: [PATCH] vfio/pci: Drain eventfd RCU callbacks on module exit
Date: Fri, 9 Oct 2026 15:57:15 -0600	[thread overview]
Message-ID: <20261009155715.11f6d974@shazbot.org> (raw)
In-Reply-To: <20261003093806.544631-1-yaojiale02@163.com>

On Sat,  3 Oct 2026 17:38:06 +0800
Jiale Yao <yaojiale02@163.com> wrote:

> vfio_pci_eventfd_replace_locked() defers freeing replaced eventfds to
> vfio_pci_eventfd_rcu_free(). A callback can remain queued after
> close_device() returns and the device driver module reference is dropped.
> Once the dependent driver is removed, vfio-pci-core can be unloaded while
> the callback still points into its module text.
> 
> Wait for outstanding RCU callbacks before vfio-pci-core exits.
> 
> Fixes: 98693e0897f7 ("vfio/pci: Use RCU for error/request triggers to avoid circular locking")
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> ---
>  drivers/vfio/pci/vfio_pci_core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
> index 6757054e9d87..9bce419c52c8 100644
> --- a/drivers/vfio/pci/vfio_pci_core.c
> +++ b/drivers/vfio/pci/vfio_pci_core.c
> @@ -2675,6 +2675,7 @@ static void vfio_pci_dev_set_try_reset(struct vfio_device_set *dev_set)
>  static void vfio_pci_core_cleanup(void)
>  {
>  	vfio_pci_uninit_perm_bits();
> +	rcu_barrier();
>  }
>  
>  static int __init vfio_pci_core_init(void)

Applied to vfio next branch for v7.4.  Thanks,

Alex

      reply	other threads:[~2026-10-09 21:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-03  9:38 Jiale Yao
2026-10-09 21:57 ` Alex Williamson [this message]

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=20261009155715.11f6d974@shazbot.org \
    --to=alex@shazbot.org \
    --cc=jgg@ziepe.ca \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yaojiale02@163.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

all inboxes | Powered by JetHome®