From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F314737DE83 for ; Mon, 24 Aug 2026 05:23:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787548991; cv=none; b=NGlbcunorOKwT7Y0KaVPsmTT01nWJBYIXoGqFfhX6lmFA2eDybuBBW4eahq/iE4nmqXqWtZP2tNQ153jJmwpsnVfYuTmDmpQvwgAhcLQVZ2HkQyMu9YvPZsCzAet53zzeZD4a0z2vC8jqDYbWOD5paoM5fOZJC0ZIJ37MtITwXI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787548991; c=relaxed/simple; bh=WZfp5cl5eGu5pAyF8iFOtzrCI90yizkLSd5KSkVKU08=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=umX6dWgbeLOCoO6PvZe4+53rpq3EBisvjMP5k+Dz7747MEn/qtFmzhggcx6VViegR0kgCsOSXdumY2PAaUJ1k0N9I5iyj2KE/zKeNw9itl2+U0A0IXU8+F6eLW6QPfV5GqGYhWXqfpH21E9TVgqFJUB4gcpqqUfFMr+Fl34EcjM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Oi80J19i; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Oi80J19i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A03111F00A3D; Mon, 24 Aug 2026 05:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1787548987; bh=TOa0Mc3g/51x25P6YIectpI4yhE9qqdB88ZWffINywk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Oi80J19iQ/TdSzcEwk8RX4t50h9RdHD5LxgUlnEM5ICP5XvX1hDK5LtBkZdy0Ecy6 M/DFfk+vz5gm+HU6I3oJGrkGM3n4sfYUsdsZo2VVblAbllg2bbR3l8ydoKFyBmZPDw m2VWBQX54Cbe6vzbUhzvZqANnccWSTkxXxBKkdjTcDzl8jt9sGe/ad3wHHZGRM/2cF UoxSOr/sqDO075lrOw4KFRGuHK6vrNFMnIkI/9W+NfcYTYuUFoHw3KTGej0oBeGb40 38sacomOBJL4cvYIpJWgYREKvLLSEIzjC4QF2D7O2mo2q92FQ0vzwPfisC20vEWBBw /t+SsNxYH08DQ== Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailfauth.phl.internal (Postfix) with ESMTP id AC9A1F40066; Mon, 24 Aug 2026 01:23:05 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Mon, 24 Aug 2026 01:23:05 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGkRGSzXGiSbJAd+2I9nuOL/mex4wDaruOdCq0RanoB1pDVyLBiGnZXae9xGxnrmd OcHhs7C2vgPVVB10nRIYvtVTPE2xHCj4mWHUf4+7g2a5RPKoh3jP7TEvEVGUHzC7X2cqSG zj8AVu+U7Ak6AIptRPjEENRKXX6frXDo2z1W8pLDwz7DAYaMGeIVzQg1J29CyMqEkTV31i PqunEnfkgGuZhrQrA/0CqoQWqDd009rNZePg92gnLgibysZM2nU3X4soV/dQ1XcCI8lNHG Jb2RYL9//TOV/KS2AaR4slg6makFDtSPkexpD6/VlHWxy7KJBGYi1h/JTFptMiVqn/SlLQ ZAPrWIxa1WH0WWKvx6+C/oN8cHF9CzQ1/r+xBtplGH4jKJi786cYGWd/v/o6jeCiy0c4r+ ayM4T/WSZKZ7wvPs23B+7t1CVSHTdaw11B2f0JnbDBaA47NxeVFYq0fPSyMdZcphNBEKGD XMrrsBj9IcUFi4OzjAUQEsKrdFh6QmqNlfwwC032SOhhNqGqoiTUvxb2aMFZP0cedQt87T 3kxM3WJyRLJpW+oGRmdiM6FNC7vhI+dZaKh/t3VaMkO/CmayZzbu5KHmnQxO2yz1nXRAn8 /+k6qpdqCpoRHfzP+UZfzsIz341UUoOcjN1V4ba/5QLE8sDkxleVTgtsr4nQ X-ME-Proxy: Feedback-ID: i8dbe485b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 24 Aug 2026 01:23:05 -0400 (EDT) Date: Sun, 23 Aug 2026 22:23:03 -0700 From: Boqun Feng To: Radu Rendec Cc: Kuan-Wei Chiu , tglx@kernel.org, peterz@infradead.org, lyude@redhat.com, jserv@ccns.ncku.edu.tw, marscheng@google.com, eleanor15x@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] irq: Make refcount_interrupt kunit test selectable Message-ID: References: <20260823171721.3059733-1-visitorckw@gmail.com> <014ccedef7256efc027b8759134b9d1712d3afb6.camel@rendec.net> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Sun, Aug 23, 2026 at 05:52:24PM -0400, Radu Rendec wrote: > On Sun, 2026-08-23 at 14:08 -0700, Boqun Feng wrote: > > On Sun, Aug 23, 2026 at 04:46:23PM -0400, Radu Rendec wrote: > > > On Sun, 2026-08-23 at 17:17 +0000, Kuan-Wei Chiu wrote: > > > > Currently, refcount_interrupt_test is built unconditionally when > > > > CONFIG_KUNIT is enabled, causing it to run unexpectedly during boot. > > > > > > > > Fix this by introducing CONFIG_REFCOUNT_INTERRUPT_KUNIT_TEST so the > > > > test can be configured independently, following standard kunit > > > > practices. > > > > > > > > Fixes: 07a88e2bcd5b ("irq: Add KUnit test for refcounted interrupt enable/disable") > > > > Signed-off-by: Kuan-Wei Chiu > > > > --- > > > >  kernel/irq/Kconfig  | 12 ++++++++++++ > > > >  kernel/irq/Makefile |  2 +- > > > >  2 files changed, 13 insertions(+), 1 deletion(-) > > > > > > Can someone please explain me why this needs to be a separate unit test > > > in the first place and can't be integrated into the (previously) > > > existing unit test gated by IRQ_KUNIT_TEST? > > > > > > > If you look at the irq_test.c, you will find that it primarily tests the > > {request,disable,enable}_irq() API (i.e. allocating IRQ vectors and > > enabling and disabling them), which is not the same scope as > > local_interrupt_{disable,enable}() (i.e. operating the CPU irq disabling > > status), so it makes sense to have a separate test case. > > Thanks! If we want to keep the unit tests separated/grouped by scope, > then yes, it makes sense for sure. What I don't like about this is: > * The naming of the two config options is inconsistent: IRQ_KUNIT_TEST > and REFCOUNT_INTERRUPT_KUNIT_TEST. > * The naming and description of the older test become misleading. The > way they are formulated, I would expect them to test "everything > related to IRQ" but now we have a separate option (and kunit test) > dedicated to the refcount stuff. > These are valid points. However, I think the "inconsistency" comes from refcount_interrupt_test.c being in kernel/irq/. IRQ management (code in kernel/irq/) and IRQ disabling/enabling are very different things to me (for example include/linux/irqflags.h is not listed in the "IRQ SUBSYSTEM" entry). IMO, refcount_interrupt_test.c should be moved into lib/tests/. > If they must be separated/grouped by scope, I would find it much nicer > and less confusing if they were called something like: > IRQ_MANAGEMENT_KUNIT_TEST and > IRQ_REFCOUNT_KUNIT_TEST, > and also the corresponding .c files were somewhat consistent with the > Kconfig option names. The description of the older test would have to > be updated to make it clear that it's not just "everything IRQ". > > In that scenario, new kunit test(s) related to different aspects of the > IRQ subsystem would get their own Kconfig option and file, and would > hopefully follow the same naming pattern. > > To be clear, I'm not arguing that keeping the tests separate is wrong. > I'm arguing that if we do that, we should also make some adjustments to > keep everything clean and tidy. > Understood, and thank you for bringing it up. So how about we keep Kuan-Wei's fix as it is and move the refcount_interrupt_test.c file into lib/tests/? It's more clean and tidy to me this way. Thoughts? Regards, Boqun > > But yes, I agree Kuan-Wei's fix is needed. > > Yes, I agree, those unit tests must not be gated by KUNIT alone, so > something must be done to fix it. > > > > Ironically, both the issue that this patch is trying to fix and my > > > question were raised by sashiko here: > > > https://lore.kernel.org/all/20260605055315.3E96E1F00893@smtp.kernel.org/ > > > > > > > diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig > > > > index 05cba4e16dad..6923f37eaab4 100644 > > > > --- a/kernel/irq/Kconfig > > > > +++ b/kernel/irq/Kconfig > > > > @@ -150,6 +150,18 @@ config IRQ_KUNIT_TEST > > > >   > > > >     If unsure, say N. > > > >   > > > > +config REFCOUNT_INTERRUPT_KUNIT_TEST > > > > + tristate "Test refcounted interrupt enable/disable" if !KUNIT_ALL_TESTS > > > > + depends on KUNIT > > > > + default KUNIT_ALL_TESTS > > > > + help > > > > +   This builds the kunit tests for the refcounted interrupt > > > > +   infrastructure. It verifies the correctness of single, nested, > > > > +   and multiple interrupt enable/disable state changes and ensures > > > > +   that the underlying reference counting mechanisms work as expected. > > > > + > > > > +   If unsure, say N. > > > > + > > > >  endmenu > > > >   > > > >  config GENERIC_IRQ_MULTI_HANDLER > > > > diff --git a/kernel/irq/Makefile b/kernel/irq/Makefile > > > > index 44c4d6fc502a..0e5df962a149 100644 > > > > --- a/kernel/irq/Makefile > > > > +++ b/kernel/irq/Makefile > > > > @@ -16,4 +16,4 @@ obj-$(CONFIG_SMP) += affinity.o > > > >  obj-$(CONFIG_GENERIC_IRQ_DEBUGFS) += debugfs.o > > > >  obj-$(CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR) += matrix.o > > > >  obj-$(CONFIG_IRQ_KUNIT_TEST) += irq_test.o > > > > -obj-$(CONFIG_KUNIT) += refcount_interrupt_test.o > > > > +obj-$(CONFIG_REFCOUNT_INTERRUPT_KUNIT_TEST) += refcount_interrupt_test.o > > -- > Best regards, > Radu