From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.mindbit.ro (xs1.mindbit.ro [80.86.107.70]) (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 E67162D3A75 for ; Sun, 23 Aug 2026 21:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.86.107.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787521952; cv=none; b=F7cWFx5xS8s8vkV+dUBgs/JBFYx9kcL/kGMsj0BrveolLaWa7HXEKHwiAijKttpPuJGCAP1PolCtHNxY72Cn8TMtyMyjescomNekHCK5wi+M9GTuO4cN1BlwOZKDsAoq2S+MiLbikX9+i/uigg3mZmHNxd8K/hhVD9cwPx3sNaw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787521952; c=relaxed/simple; bh=MS3xJcV3RIC1Lcp0L1602qUTFVDjOJfAx0P4wKmG9Qk=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=axWM7vojmuQC7wzhYsPgBpBMkIDz+HXORgWxrXeVmcgcJ05zH+5ybvUYLsW0/QMTIYlKAQCwmjggqt4E+MHmiGoyXR0DmgdEa3oJsSOYrRHqJ/Aj9G/P2MUt3f5zGK5t3QNo8UA/XnXHW+pAdpaKuIFMw7KjgiNXe3JyI5xN2CM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rendec.net; spf=pass smtp.mailfrom=rendec.net; dkim=pass (2048-bit key) header.d=rendec.net header.i=@rendec.net header.b=N+kLMcCP; arc=none smtp.client-ip=80.86.107.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rendec.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rendec.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rendec.net header.i=@rendec.net header.b="N+kLMcCP" Received: from dog.kanata.rendec.net (pool-174-112-193-187.cpe.net.cable.rogers.com [174.112.193.187]) by mail.mindbit.ro (Postfix) with ESMTPSA id A79F5CC396; Mon, 24 Aug 2026 00:52:26 +0300 (EEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.mindbit.ro A79F5CC396 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rendec.net; s=default; t=1787521948; bh=QcZqqnZmTtZ1KosjxoVsbgCYus3UpBMq54hDU8Cct+w=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=N+kLMcCPhTydsYy02KmTkuE7n6qNdlgLPg32T/HyYyY8cJlWjKjf6BbzKm01zMuP8 Kxj4lGU6EVHqefVKAhFghbDI8nz/vCD5ZPiQKsvxTqOXcnmCilsS9EsoOUkRD1m3X1 vlYikkhRyBVNYpo0+Z/E/jefywkadYGAOf5fUHPb9e+1Ku7wEM3c7UE+Vh6AeBHoO6 5M+A0BHFiNuSQVpKGeOrrmBWlZVut3/sGYLJKbeCZjv39hG8lSmdBJBhVk/vPC0zzL D55uyIetufZ+lsA69NzkeoDiUI1aahechLSwA6gUU+w3M0dvYA1cdX3zbCQetYg/Di PGAEHUSIZVl4Q== Message-ID: Subject: Re: [PATCH] irq: Make refcount_interrupt kunit test selectable From: Radu Rendec To: Boqun Feng 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 Date: Sun, 23 Aug 2026 17:52:24 -0400 In-Reply-To: References: <20260823171721.3059733-1-visitorckw@gmail.com> <014ccedef7256efc027b8759134b9d1712d3afb6.camel@rendec.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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. > > >=20 > > > Fix this by introducing CONFIG_REFCOUNT_INTERRUPT_KUNIT_TEST so the > > > test can be configured independently, following standard kunit > > > practices. > > >=20 > > > Fixes: 07a88e2bcd5b ("irq: Add KUnit test for refcounted interrupt en= able/disable") > > > Signed-off-by: Kuan-Wei Chiu > > > --- > > > =C2=A0kernel/irq/Kconfig=C2=A0 | 12 ++++++++++++ > > > =C2=A0kernel/irq/Makefile |=C2=A0 2 +- > > > =C2=A02 files changed, 13 insertions(+), 1 deletion(-) > >=20 > > 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? > >=20 >=20 > 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. 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. > 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= / > >=20 > > > 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 > > > =C2=A0 > > > =C2=A0 =C2=A0 If unsure, say N. > > > =C2=A0 > > > +config REFCOUNT_INTERRUPT_KUNIT_TEST > > > + tristate "Test refcounted interrupt enable/disable" if !KUNIT_ALL_T= ESTS > > > + depends on KUNIT > > > + default KUNIT_ALL_TESTS > > > + help > > > + =C2=A0 This builds the kunit tests for the refcounted interrupt > > > + =C2=A0 infrastructure. It verifies the correctness of single, neste= d, > > > + =C2=A0 and multiple interrupt enable/disable state changes and ensu= res > > > + =C2=A0 that the underlying reference counting mechanisms work as ex= pected. > > > + > > > + =C2=A0 If unsure, say N. > > > + > > > =C2=A0endmenu > > > =C2=A0 > > > =C2=A0config 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) +=3D affinity.o > > > =C2=A0obj-$(CONFIG_GENERIC_IRQ_DEBUGFS) +=3D debugfs.o > > > =C2=A0obj-$(CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR) +=3D matrix.o > > > =C2=A0obj-$(CONFIG_IRQ_KUNIT_TEST) +=3D irq_test.o > > > -obj-$(CONFIG_KUNIT) +=3D refcount_interrupt_test.o > > > +obj-$(CONFIG_REFCOUNT_INTERRUPT_KUNIT_TEST) +=3D refcount_interrupt_= test.o --=20 Best regards, Radu