From nobody Mon Feb 9 03:10:44 2026 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 992D820DCF for ; Wed, 13 Mar 2024 07:14:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710314062; cv=none; b=D9vSb2PQesXG8F/1/H8JUxacwGeU/p5bzYETHxHN3inLl/OefCWb1FLOu343LB+NkGvu8KWkXRqFjUhXa4zrSeSCfAwUd8baDBNIRD5sCMsCGIKRrVBNR68ExhWn4BZ/vlGBkyjKIu/0OAFu11tTYmiDqB7iQ+tR/i9S4/qghU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710314062; c=relaxed/simple; bh=hQfkQWSJQKLLPZaMZxXINBFpWyakUN7e9BWkcVz6YIA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=j2wBzO+h0A04JdjmDwMtysv6wcyNWHHppoWUqzjBAtg2Q9iLP3EY2Is/1Dw08guuwceJKklmBZa2AeIiVsz2v1RXpRKs94UXd1PnM8ZxXHw20LePD0gYYG46xSlW0U5KncB4M6mpJKNxln8024P/ifVTuglyMXgfjIjCIXqSzzQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=rdFQ6nU0; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=rdFQ6nU0; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="rdFQ6nU0"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="rdFQ6nU0" 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-out2.suse.de (Postfix) with ESMTPS id A14D61F7A4; Wed, 13 Mar 2024 07:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1710314058; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pOrIQxEHvyyL2+vnTct/YehpC03sIRKTsXlKpP1po1Y=; b=rdFQ6nU0hMG5OoHLPrOIQAHfUkxhtZt0ph2a1H8aFLDj9OPEQzCRc3LkMIMw//1AcSV+IP iyD+rfzi1cV43KLqpVhnklc7ySFYXh9bH5bKokJR0jo9CoVEuuyFy4iT0PN3I+pJZADBK/ SkPc6iMRPcobbOQ7U6Ginn1pqF9Es34= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1710314058; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pOrIQxEHvyyL2+vnTct/YehpC03sIRKTsXlKpP1po1Y=; b=rdFQ6nU0hMG5OoHLPrOIQAHfUkxhtZt0ph2a1H8aFLDj9OPEQzCRc3LkMIMw//1AcSV+IP iyD+rfzi1cV43KLqpVhnklc7ySFYXh9bH5bKokJR0jo9CoVEuuyFy4iT0PN3I+pJZADBK/ SkPc6iMRPcobbOQ7U6Ginn1pqF9Es34= 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 6A3CF13977; Wed, 13 Mar 2024 07:14:18 +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 i4BMGEpS8WWtSAAAD6G6ig (envelope-from ); Wed, 13 Mar 2024 07:14:18 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org Cc: Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , xen-devel@lists.xenproject.org, Demi Marie Obenour Subject: [PATCH 1/2] xen/evtchn: avoid WARN() when unbinding an event channel Date: Wed, 13 Mar 2024 08:14:08 +0100 Message-Id: <20240313071409.25913-2-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240313071409.25913-1-jgross@suse.com> References: <20240313071409.25913-1-jgross@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ++++ Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=rdFQ6nU0 X-Spamd-Result: default: False [4.69 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.com:+]; MX_GOOD(-0.01)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[27.98%]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,suse.com:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from] X-Spam-Score: 4.69 X-Spam-Level: **** X-Rspamd-Queue-Id: A14D61F7A4 X-Spam-Flag: NO X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Content-Type: text/plain; charset="utf-8" When unbinding a user event channel, the related handler might be called a last time in case the kernel was built with CONFIG_DEBUG_SHIRQ. This might cause a WARN() in the handler. Avoid that by adding an "unbinding" flag to struct user_event which will short circuit the handler. Fixes: 9e90e58c11b7 ("xen: evtchn: Allow shared registration of IRQ handers= ") Reported-by: Demi Marie Obenour Tested-by: Demi Marie Obenour Signed-off-by: Juergen Gross Reviewed-by: Oleksandr Tyshchenko --- drivers/xen/evtchn.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index 59717628ca42..f6a2216c2c87 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c @@ -85,6 +85,7 @@ struct user_evtchn { struct per_user_data *user; evtchn_port_t port; bool enabled; + bool unbinding; }; =20 static void evtchn_free_ring(evtchn_port_t *ring) @@ -164,6 +165,10 @@ static irqreturn_t evtchn_interrupt(int irq, void *dat= a) struct per_user_data *u =3D evtchn->user; unsigned int prod, cons; =20 + /* Handler might be called when tearing down the IRQ. */ + if (evtchn->unbinding) + return IRQ_HANDLED; + WARN(!evtchn->enabled, "Interrupt for port %u, but apparently not enabled; per-user %p\n", evtchn->port, u); @@ -421,6 +426,7 @@ static void evtchn_unbind_from_user(struct per_user_dat= a *u, =20 BUG_ON(irq < 0); =20 + evtchn->unbinding =3D true; unbind_from_irqhandler(irq, evtchn); =20 del_evtchn(u, evtchn); --=20 2.35.3