From nobody Sun Feb 8 02:21:57 2026 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37F0B421A0A for ; Thu, 22 Jan 2026 11:42:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769082150; cv=none; b=ZD983KiD90Mb55OquAEPSK1j1i7KKk8q7vUUC7Aqpcs5YHmFz7hfOt99bH8vXWuRK+sL9GbHjOmzX9iMZTQam0v+t45pDdHBw43ocYYbw01c+OtfU3DS9dlWI7qG3qFDTl24ql2eIuuejFLD+DQnrbxovWh6p0d4451O/AvFYDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769082150; c=relaxed/simple; bh=aXPlBfwgf3FSR/JYvZXNBUIGXw7rI/R3QSupQMV0UZE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=MH+nsNyKnGU1GXWW9HAaKC+zNFwUVx3PK0smVoa8MSWZghV/7AgzWd4TUhMnkshyYc6xEFF4d6Gbza6XtpT6X9693vPeUWOViZB5JoLGXR2Ny14EtTMSkLsXs5p39M4Ntm16f6QcMjzygWN5qk654LSAKB6XzY9oELzAi00qWmk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=K7CnPuvm; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=2LqcnjTA; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=K7CnPuvm; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=2LqcnjTA; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="K7CnPuvm"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="2LqcnjTA"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="K7CnPuvm"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="2LqcnjTA" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6FCF8336F8; Thu, 22 Jan 2026 11:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769082146; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J7HS/7fVODCxb+s+SaY/Cet3k6woYVVydqkfaMO/wwU=; b=K7CnPuvmXDpL/SziLBqMVs2/OcOD7stIQ2+obEZKCM1oHmKYIvuUlyD3J3Du596y0IQB31 /selTGRa6AVjLgmG/xwb5jVdRqAkbixsRvBo2FMNOT0HHOaggUY83BYmhVGIglN8aYv8Sn 8dxY8aEg8Q2vBl+psUBFIGOFPmf4bHg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769082146; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J7HS/7fVODCxb+s+SaY/Cet3k6woYVVydqkfaMO/wwU=; b=2LqcnjTAlFT7UPbiCtOa7tDSWSWodf4r+WVopcKMM1QUcIW6035UuOHLyXecJsHpxvuGrq v5tq816ifkAZj0DA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=K7CnPuvm; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=2LqcnjTA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769082146; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J7HS/7fVODCxb+s+SaY/Cet3k6woYVVydqkfaMO/wwU=; b=K7CnPuvmXDpL/SziLBqMVs2/OcOD7stIQ2+obEZKCM1oHmKYIvuUlyD3J3Du596y0IQB31 /selTGRa6AVjLgmG/xwb5jVdRqAkbixsRvBo2FMNOT0HHOaggUY83BYmhVGIglN8aYv8Sn 8dxY8aEg8Q2vBl+psUBFIGOFPmf4bHg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769082146; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J7HS/7fVODCxb+s+SaY/Cet3k6woYVVydqkfaMO/wwU=; b=2LqcnjTAlFT7UPbiCtOa7tDSWSWodf4r+WVopcKMM1QUcIW6035UuOHLyXecJsHpxvuGrq v5tq816ifkAZj0DA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D0AD013533; Thu, 22 Jan 2026 11:42:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id MoDKLyENcmmlWQAAD6G6ig (envelope-from ); Thu, 22 Jan 2026 11:42:25 +0000 From: =?UTF-8?q?Carlos=20L=C3=B3pez?= To: linux-hyperv@vger.kernel.org Cc: =?UTF-8?q?Carlos=20L=C3=B3pez?= , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , linux-kernel@vger.kernel.org (open list) Subject: [PATCH] mshv: clear eventfd counter on irqfd shutdown Date: Thu, 22 Jan 2026 12:41:31 +0100 Message-ID: <20260122114130.92860-2-clopez@suse.de> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Flag: NO X-Spam-Score: -3.51 X-Rspamd-Queue-Id: 6FCF8336F8 X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spam-Level: 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=C3=B3pez --- 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 *w= ork) { struct mshv_irqfd *irqfd =3D container_of(work, struct mshv_irqfd, irqfd_shutdown); + u64 cnt; =20 /* * 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_wai= t, &cnt); =20 if (irqfd->irqfd_resampler) { mshv_irqfd_resampler_shutdown(irqfd); @@ -371,8 +372,6 @@ static void mshv_irqfd_queue_proc(struct file *file, wa= it_queue_head_t *wqh, struct mshv_irqfd *irqfd =3D container_of(polltbl, struct mshv_irqfd, irqfd_polltbl); =20 - irqfd->irqfd_wqh =3D 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 --=20 2.51.0