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 50F563CB2E0 for ; Thu, 26 Mar 2026 12:34:15 +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=1774528460; cv=none; b=s959uScbct9TyCPBphy/oE7P6Fp3idEq+0Oiz4zma63y5eFJUVM4v2v92nobGhIDazg6ySZnBJ/5vf7r+oBorjXloNuA8zC7qfEOBCkm5PhpINVLOZAAQAFZLsSteHoAPJ9M+TR5zLmVCVsHrmWexGf4DF9in7E2SkqkYz6EtFk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774528460; c=relaxed/simple; bh=OlDM2X9B9E358QR0B0R1vGax4xcssPCsez4kwl8CQJk=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=aFhzFFEDdoHLmECQ6x9HemTTVKtoPt53dHluh1OmD5gECKq5vOtqM8+Rj8wBU8BwzGQbeODW9ukkGqATHg7BW9fF/XHdtVM+l4wqBSBKCR8d5MjkcVcjK51Z9lJEZ6+CS1LrpIAHntWrw7b8WwPy1ESH0D/KkuO9wQ/OyhL9S5Y= 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=S+RbJjwn; 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="S+RbJjwn" 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 C3483C23C0; Thu, 26 Mar 2026 14:34:12 +0200 (EET) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.mindbit.ro C3483C23C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rendec.net; s=default; t=1774528453; bh=9MHKVEQXtfHcKAxUgOMMshlXTA8flMxGYbjFugFZ63Y=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=S+RbJjwn/4cLgXBhOZ99nrn553oI02rsNTFwCm/CEUIF8SJZwt9/shd7SWO2CRExJ Y6tCHHw1CHx9+t3au9ZEsOkS0VZlN3MLSWTWJhRFShUpQ0WAVgPARoQASqVetGkwdn cTNC7wgkwinBqAhayiRD9dKygmvHS2Cacteit9BM1z068Jf0FRuAh8Bz8zSvJM7Mst 6rZUno5viSrTcBK4AQboUUbFhnVKM29XJMoJidLgsCi4ODcjnMdqU8E0lYVh/QvIkV Qh878y1fZRquG7OYvP0gWga1wLzfeOK0kghKq+Zcv9YGTR+//mg8Bj2khgzujMwGG2 VpuY+eYgLpgqA== Message-ID: Subject: Re: [patch v2 04/14] x86/irq: Make irqstats array based From: Radu Rendec To: Thomas Gleixner , LKML Cc: x86@kernel.org, Dmitry Ilvokhin , Neil Horman , Florian Fainelli Date: Thu, 26 Mar 2026 08:34:10 -0400 In-Reply-To: <87bjgbed38.ffs@tglx> References: <20260320131108.344376329@kernel.org> <20260320132102.297759330@kernel.org> <874im5gfzp.ffs@tglx> <871ph9ges3.ffs@tglx> <87bjgbed38.ffs@tglx> 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 Wed, 2026-03-25 at 23:52 +0100, Thomas Gleixner wrote: > On Wed, Mar 25 2026 at 15:20, Radu Rendec wrote: > > On Tue, 2026-03-24 at 16:32 -0400, Radu Rendec wrote: > >=20 > > I tested it, and it's very close but requires a few extra changes, > > which I included as a patch at the bottom. >=20 > All of this is overly complicated. That can directly use the > irq_stat_info array and therefore stays always in sync without ever > touching that python nightmare again. Of course! That's why you created irq_stat_info in the first place, and the gdb/python approach is now similar to what you did on the kernel side. I guess the solution was too obvious for either of us to see on the first iteration :) > Replacement patch below (works only after 5/14 obviously). I tested it, and I can confirm it works. > > There's one more gotcha: in the next patch (patch 5) you rename nr_irqs > > to total_nr_irqs, and the change must be applied to interrupts.py as > > well. It's used at the beginning of the LxInterruptList.invoke() > > function. >=20 > Sigh, yes. This GDB python insanity is a pain, debugging it even more so. I agree, debugging it is not very friendly. But in case you ever have to deal with it again, you may find this helpful: * print() in python code works (you'll see the output in gdb); * there's a "set python print-stack full" command; once enabled, you'll see something like this: (gdb) lx-interruptlist=20 Traceback (most recent call last): File "/..../scripts/gdb/linux/interrupts.py", line 187, in invoke nr_irqs =3D gdb.parse_and_eval("total_nr_irqs1") gdb.error: No symbol "total_nr_irqs1" in current context. > --- > diff --git a/scripts/gdb/linux/interrupts.py b/scripts/gdb/linux/interrup= ts.py > index f4f715a8f0e3..7fde52317e84 100644 > --- a/scripts/gdb/linux/interrupts.py > +++ b/scripts/gdb/linux/interrupts.py > @@ -97,13 +97,13 @@ def show_irq_err_count(prec): > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D "%*s: %10u\n" = % (prec, "ERR", cnt['counter']) > =C2=A0=C2=A0=C2=A0=C2=A0 return text > =C2=A0 > -def x86_show_irqstat(prec, pfx, field, desc): > -=C2=A0=C2=A0=C2=A0 irq_stat =3D gdb.parse_and_eval("&irq_stat") > +def x86_show_irqstat(prec, pfx, idx, desc): > +=C2=A0=C2=A0=C2=A0 irq_stat =3D gdb.parse_and_eval("&irq_stat.counts[%d]= " %idx) > =C2=A0=C2=A0=C2=A0=C2=A0 text =3D "%*s: " % (prec, pfx) > =C2=A0=C2=A0=C2=A0=C2=A0 for cpu in cpus.each_online_cpu(): > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 stat =3D cpus.per_cpu(ir= q_stat, cpu) > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D "%10u " % (stat[fie= ld]) > -=C2=A0=C2=A0=C2=A0 text +=3D "=C2=A0 %s\n" % (desc) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D "%10u " % (stat.der= eference()) > +=C2=A0=C2=A0=C2=A0 text +=3D desc > =C2=A0=C2=A0=C2=A0=C2=A0 return text > =C2=A0 > =C2=A0def x86_show_mce(prec, var, pfx, desc): > @@ -115,34 +115,14 @@ def x86_show_mce(prec, var, pfx, desc): > =C2=A0=C2=A0=C2=A0=C2=A0 return text > =C2=A0 > =C2=A0def x86_show_interupts(prec): > -=C2=A0=C2=A0=C2=A0 text =3D x86_show_irqstat(prec, "NMI", '__nmi_count',= 'Non-maskable interrupts') > - > -=C2=A0=C2=A0=C2=A0 if constants.LX_CONFIG_X86_LOCAL_APIC: > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "LOC", 'apic_timer_irqs', "Local timer interrupts") > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "SPU", 'irq_spurious_count', "Spurious interrupts") > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "PMI", 'apic_perf_irqs', "Performance monitoring interrupts") > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "IWI", 'apic_irq_work_irqs', "IRQ work interrupts") > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "RTR", 'icr_read_retry_count', "APIC ICR read retries") > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if utils.gdb_eval_or_none("x8= 6_platform_ipi_callback") is not None: > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text = +=3D x86_show_irqstat(prec, "PLT", 'x86_platform_ipis', "Platform interrupt= s") > - > -=C2=A0=C2=A0=C2=A0 if constants.LX_CONFIG_SMP: > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "RES", 'irq_resched_count', "Rescheduling interrupts") > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "CAL", 'irq_call_count', "Function call interrupts") > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "TLB", 'irq_tlb_count', "TLB shootdowns") > - > -=C2=A0=C2=A0=C2=A0 if constants.LX_CONFIG_X86_THERMAL_VECTOR: > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "TRM", 'irq_thermal_count', "Thermal events interrupts") > +=C2=A0=C2=A0=C2=A0 info_type =3D gdb.lookup_type('struct irq_stat_info') > +=C2=A0=C2=A0=C2=A0 info =3D gdb.parse_and_eval('irq_stat_info') > =C2=A0 > -=C2=A0=C2=A0=C2=A0 if constants.LX_CONFIG_X86_MCE_THRESHOLD: > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "THR", 'irq_threshold_count', "Threshold APIC interrupts") > - > -=C2=A0=C2=A0=C2=A0 if constants.LX_CONFIG_X86_MCE_AMD: > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "DFR", 'irq_deferred_error_count', "Deferred Error APIC interrupts") > - > -=C2=A0=C2=A0=C2=A0 if constants.LX_CONFIG_X86_MCE: > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_mce(prec, = "&mce_exception_count", "MCE", "Machine check exceptions") > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_mce(prec, = "&mce_poll_count", "MCP", "Machine check polls") > +=C2=A0=C2=A0=C2=A0 text =3D "" > +=C2=A0=C2=A0=C2=A0 for idx in range(int(info.type.sizeof / info_type.siz= eof)): > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pfx =3D info[idx]['symbol'].s= tring() > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 desc =3D info[idx]['text'].st= ring() > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, pfx, idx, desc) > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0 text +=3D show_irq_err_count(prec) > =C2=A0 > @@ -151,11 +131,6 @@ def x86_show_interupts(prec): > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if cnt is not None: > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = text +=3D "%*s: %10u\n" % (prec, "MIS", cnt['counter']) > =C2=A0 > -=C2=A0=C2=A0=C2=A0 if constants.LX_CONFIG_KVM: > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "PIN", 'kvm_posted_intr_ipis', 'Posted-interrupt notification event') > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "NPI", 'kvm_posted_intr_nested_ipis', 'Nested posted-interrupt event') > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 text +=3D x86_show_irqstat(pr= ec, "PIW", 'kvm_posted_intr_wakeup_ipis', 'Posted-interrupt wakeup event') > - > =C2=A0=C2=A0=C2=A0=C2=A0 return text > =C2=A0 > =C2=A0def arm_common_show_interrupts(prec): > @@ -209,7 +184,7 @@ class LxInterruptList(gdb.Command): > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 super(LxInterruptList, s= elf).__init__("lx-interruptlist", gdb.COMMAND_DATA) > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0 def invoke(self, arg, from_tty): > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 nr_irqs =3D gdb.parse_and_eva= l("nr_irqs") > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 nr_irqs =3D gdb.parse_and_eva= l("total_nr_irqs") > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 prec =3D 3 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 j =3D 1000 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 while prec < 10 and j <= =3D nr_irqs: