public inbox for linux-hyperv@vger.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: "Carlos López" <clopez@suse.de>
Cc: linux-hyperv@vger.kernel.org,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	Long Li <longli@microsoft.com>,
	open list <linux-kernel@vger.kernel.org>,
	skinsburskii@linux.microsoft.com, mrathor@linux.microsoft.com,
	anirudh@anirudhrb.com, schakrabarti@linux.microsoft.com
Subject: Re: [PATCH] mshv: clear eventfd counter on irqfd shutdown
Date: Wed, 4 Feb 2026 06:43:57 +0000	[thread overview]
Message-ID: <20260204064357.GK79272@liuwe-devbox-debian-v2.local> (raw)
In-Reply-To: <20260122114130.92860-2-clopez@suse.de>

On Thu, Jan 22, 2026 at 12:41:31PM +0100, Carlos López wrote:
> While unhooking from the irqfd waitqueue, clear the internal eventfd
> counter by using eventfd_ctx_remove_wait_queue() instead of
> remove_wait_queue(), preventing potential spurious interrupts. This
> removes the need to store a pointer into the workqueue, as the eventfd
> already keeps track of it.
> 
> This mimicks what other similar subsystems do on their equivalent paths
> with their irqfds (KVM, Xen, ACRN support, etc).
> 
> Signed-off-by: Carlos López <clopez@suse.de>

This looks like a good change to me. I've queued it to hyperv-next.
Thanks!

Also CC our kernel folks just in case I missed something.

Wei

> ---
>  drivers/hv/mshv_eventfd.c | 5 ++---
>  drivers/hv/mshv_eventfd.h | 1 -
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hv/mshv_eventfd.c b/drivers/hv/mshv_eventfd.c
> index d93a18f09c76..4432063e963d 100644
> --- a/drivers/hv/mshv_eventfd.c
> +++ b/drivers/hv/mshv_eventfd.c
> @@ -247,12 +247,13 @@ static void mshv_irqfd_shutdown(struct work_struct *work)
>  {
>  	struct mshv_irqfd *irqfd =
>  			container_of(work, struct mshv_irqfd, irqfd_shutdown);
> +	u64 cnt;
>  
>  	/*
>  	 * Synchronize with the wait-queue and unhook ourselves to prevent
>  	 * further events.
>  	 */
> -	remove_wait_queue(irqfd->irqfd_wqh, &irqfd->irqfd_wait);
> +	eventfd_ctx_remove_wait_queue(irqfd->irqfd_eventfd_ctx, &irqfd->irqfd_wait, &cnt);
>  
>  	if (irqfd->irqfd_resampler) {
>  		mshv_irqfd_resampler_shutdown(irqfd);
> @@ -371,8 +372,6 @@ static void mshv_irqfd_queue_proc(struct file *file, wait_queue_head_t *wqh,
>  	struct mshv_irqfd *irqfd =
>  			container_of(polltbl, struct mshv_irqfd, irqfd_polltbl);
>  
> -	irqfd->irqfd_wqh = wqh;
> -
>  	/*
>  	 * TODO: Ensure there isn't already an exclusive, priority waiter, e.g.
>  	 * that the irqfd isn't already bound to another partition.  Only the
> diff --git a/drivers/hv/mshv_eventfd.h b/drivers/hv/mshv_eventfd.h
> index 332e7670a344..464c6b81ab33 100644
> --- a/drivers/hv/mshv_eventfd.h
> +++ b/drivers/hv/mshv_eventfd.h
> @@ -32,7 +32,6 @@ struct mshv_irqfd {
>  	struct mshv_lapic_irq		     irqfd_lapic_irq;
>  	struct hlist_node		     irqfd_hnode;
>  	poll_table			     irqfd_polltbl;
> -	wait_queue_head_t		    *irqfd_wqh;
>  	wait_queue_entry_t		     irqfd_wait;
>  	struct work_struct		     irqfd_shutdown;
>  	struct mshv_irqfd_resampler	    *irqfd_resampler;
> 
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> -- 
> 2.51.0
> 

      reply	other threads:[~2026-02-04  6:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 11:41 [PATCH] mshv: clear eventfd counter on irqfd shutdown Carlos López
2026-02-04  6:43 ` Wei Liu [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=20260204064357.GK79272@liuwe-devbox-debian-v2.local \
    --to=wei.liu@kernel.org \
    --cc=anirudh@anirudhrb.com \
    --cc=clopez@suse.de \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=mrathor@linux.microsoft.com \
    --cc=schakrabarti@linux.microsoft.com \
    --cc=skinsburskii@linux.microsoft.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