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 C60ADE56A for ; Sun, 22 Mar 2026 19:59:45 +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=1774209588; cv=none; b=Xj5bUhX3K3MQrfgJlMEWOBUFAekTYlVUgK3Nr33Lunypywfj36Q/DnMGQfD4rPJ/pPrqnyddEYjioF0zMvKhFWdMbnYxZlEI2HKFZiEet7y7KXK7FzXTKCjiJnO4GfMu9VZy/GcVYZEVxqxf+7kwLPMHwpoaLmaXn285AZrFPN0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774209588; c=relaxed/simple; bh=U/Yn/RMRRsfo9QRhs/+SfUjyzJOcbPXCQQwg36PfdT0=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=PwSr1u1hFHIn+OzKBWP8ZPrizMX+FcBBOFtPlDh0F/5n5/Oeifh13TCvA5IDLFbDXK1co+rE+ahnifuiC8IUSkfBET6xHZ8849FS+vlxnArze/GGYtqXr+oj6Z4sAlXNmZc5sebIShAJFJ4YuIrzYdJ3S09e2CLfuoayIG/1UtA= 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=FbAftNs7; 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="FbAftNs7" 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 47F5CC2487; Sun, 22 Mar 2026 21:59:37 +0200 (EET) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.mindbit.ro 47F5CC2487 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rendec.net; s=default; t=1774209578; bh=Q0TyqiWJOFSPG7xz6ZexyMjh5Xbnom7Jfv/VJz8VWlI=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=FbAftNs7b2QLUr4Qm4bFsGTXhRwSc0KvjZgKRCDZgAiCoUEJ77ceskMlnPu2s/75d 9Crx05HKdlUrWh0fxAZVDf6XR0+PZCbJBjlnv/NXy5MldW0OCG0GQD4Zg7PrRdBMos sUTpwlJNkBuIEssQ0KgD1X5dT2FpOxD8gYze7FAviqzTi6HvMGJt9uCFvPnSogOs54 HW+c2uH3tCWtuDEYUo0WbJnP3vFRdrxP4gmilSx/V4+L42YX4J+6tG4VAgGPhX+Of/ R+q+eAfI36+mz6tFkZZc1wdTkPLccnjN+I4dQvtnGr12UK7Ckb+3e6UDsFXr+Hc+GV JdA2qnHzvNOKg== Message-ID: <7a256599e052da59cdf1c84321dcb3be39e31abf.camel@rendec.net> Subject: Re: [patch v2 03/14] genirq/proc: Utilize irq_desc::tot_count to avoid evaluation From: Radu Rendec To: Thomas Gleixner , LKML Cc: x86@kernel.org, Dmitry Ilvokhin , Neil Horman Date: Sun, 22 Mar 2026 15:59:35 -0400 In-Reply-To: <20260320132102.230085840@kernel.org> References: <20260320131108.344376329@kernel.org> <20260320132102.230085840@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2026-03-20 at 14:21 +0100, Thomas Gleixner wrote: > Interrupts which are not marked per CPU increment not only the per CPU > statistics, but also the accumulation counter irq_desc::tot_count. >=20 > Change the counter to type unsigned long so it does not produce sporadic > zeros due to wrap arounds on 64-bit machines and do a quick check for non > per CPU interrupts. If the counter is zero, then simply emit a full set o= f > zero strings. That spares the evaluation of the per CPU counters complete= ly > for interrupts with zero events. >=20 > Signed-off-by: Thomas Gleixner > Reviewed-by: Dmitry Ilvokhin > --- > =C2=A0include/linux/irqdesc.h |=C2=A0=C2=A0=C2=A0 6 +++--- > =C2=A0kernel/irq/proc.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0= 11 ++++++++++- > =C2=A02 files changed, 13 insertions(+), 4 deletions(-) >=20 > --- a/include/linux/irqdesc.h > +++ b/include/linux/irqdesc.h > @@ -52,8 +52,8 @@ struct irq_redirect { > =C2=A0 * @depth: disable-depth, for nested irq_disable() calls > =C2=A0 * @wake_depth: enable depth, for multiple irq_set_irq_wake() call= ers > =C2=A0 * @tot_count: stats field for non-percpu irqs > - * @irq_count: stats field to detect stalled irqs > =C2=A0 * @last_unhandled: aging timer for unhandled count > + * @irq_count: stats field to detect stalled irqs > =C2=A0 * @irqs_unhandled: stats field for spurious unhandled interrupts > =C2=A0 * @threads_handled: stats field for deferred spurious detection of= threaded handlers > =C2=A0 * @threads_handled_last: comparator field for deferred spurious de= tection of threaded handlers > @@ -87,9 +87,9 @@ struct irq_desc { > =C2=A0 unsigned int core_internal_state__do_not_mess_with_it; > =C2=A0 unsigned int depth; /* nested irq disables */ > =C2=A0 unsigned int wake_depth; /* nested wake enables */ > - unsigned int tot_count; > - unsigned int irq_count; /* For detecting broken IRQs */ > + unsigned long tot_count; > =C2=A0 unsigned long last_unhandled; /* Aging timer for unhandled count = */ > + unsigned int irq_count; /* For detecting broken IRQs */ > =C2=A0 unsigned int irqs_unhandled; > =C2=A0 atomic_t threads_handled; > =C2=A0 int threads_handled_last; > --- a/kernel/irq/proc.c > +++ b/kernel/irq/proc.c > @@ -521,7 +521,16 @@ int show_interrupts(struct seq_file *p, > =C2=A0 return 0; > =C2=A0 > =C2=A0 seq_printf(p, "%*d:", prec, i); > - irq_proc_emit_counts(p, &desc->kstat_irqs->cnt); > + > + /* > + * Always output per CPU interrupts. Output device interrupts only when > + * desc::tot_count is not zero. > + */ > + if (irq_settings_is_per_cpu(desc) || irq_settings_is_per_cpu_devid(desc= ) || > + =C2=A0=C2=A0=C2=A0 data_race(desc->tot_count)) > + irq_proc_emit_counts(p, &desc->kstat_irqs->cnt); > + else > + irq_proc_emit_zero_counts(p, num_online_cpus()); > =C2=A0 seq_putc(p, ' '); > =C2=A0 > =C2=A0 guard(raw_spinlock_irq)(&desc->lock); Reviewed-by: Radu Rendec