From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A23BF30BF6B for ; Sun, 17 May 2026 20:02:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779048127; cv=none; b=qT8SWuN0kj57RUh724uGsKwE52bF1ioDFmiyOaYYs8zcj7PJWXn5b1fHIAD0Bj1kQmltl/NzOEoJDYfoamavYGLgK1ce+/NqdIyO1fOXVZxOuZN+Q2TRfXGhXV4pAYUNIGFANXvbqC3/fOenT0tt8P0LqHxuIei526FoyIUCIqk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779048127; c=relaxed/simple; bh=5ucjiAcrSG9HAkIrY76sQi/TPigQKVYO2BjafEP+YxE=; h=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=GT824JfTYwMLpmzlBXF4NfCS4Vz3L54dLXv4M+9q9A3nkCiULyWxnihWHX9zm+9skhX/Auf6r+NYroK8nADEWM2qrfXzkxvrXmGIzXaXmB2TR6OtZQAIVD0tpKiGm/nQGK2F5rvaIaIXbKkh/2u6LpFpU1y63z/mnEiTesyhj98= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YpGre5xb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YpGre5xb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1C86C2BCB0; Sun, 17 May 2026 20:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779048127; bh=5ucjiAcrSG9HAkIrY76sQi/TPigQKVYO2BjafEP+YxE=; h=Date:From:To:Cc:Subject:References:From; b=YpGre5xbJjt8+NgLY0JfwlzOwB6CA5ACEE+fYm2c7NJuMh0k4ZX50Z5DxRxsGfwCd TVncODfUBcODak6qhH80QFPcPxCmL7phBiC8KGjS4/EyhOLxX6m9m5cscJnaOyxNwp Pebu8KtCL3Od2oUTlcM8h8IAU1U3DNu1KTgYKniDi4TdLswh7ITL62nzQzSOV9AF5r c1XFG3eafZ5VOTmxz7MGKxKGrKfRghlXKXLSTF9li01t/CGA8UeCB24YrZQ49LHUNN rhSHWWj4dxIKT0MLQR81pEa6uXiRjKCnMAz+tgXajCyLXlgQXiLBX8U1W3o5ckCi+9 kbQJfdYsAuj9A== Date: Sun, 17 May 2026 22:02:04 +0200 Message-ID: <20260517194931.442613033@kernel.org> User-Agent: quilt/0.68 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Michael Kelley , Dmitry Ilvokhin , Radu Rendec , Jan Kiszka , Kieran Bingham , Florian Fainelli , Marc Zyngier Subject: [patch V6 07/16] scripts/gdb: Update x86 interrupts to the array based storage References: <20260517194421.705253664@kernel.org> 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=UTF-8 From: Thomas Gleixner x86 changed the interrupt statistics from a struct with individual members to an counter array. It also provides a corresponding info array with the strings for prefix and description and an indicator to skip the entry. Update the already out of sync GDB script to use the counter and the info array, which keeps the GDB script in sync automatically. Signed-off-by: Thomas Gleixner Tested-by: Florian Fainelli Reviewed-by: Florian Fainelli --- V6: Fixup alignment for interrupts - Radu V5: Bring the show_err_irq() back as it is used on mips Fix the index calculation for the show bitmap so it works with more than one unsigned long. V4: Adopted to irq_stat_count_show bitmap and removed the duplicate ERR/MIS output V3: New patch - Radu --- scripts/gdb/linux/interrupts.py | 71 ++++++++++------------------------------ 1 file changed, 18 insertions(+), 53 deletions(-) --- a/scripts/gdb/linux/interrupts.py +++ b/scripts/gdb/linux/interrupts.py @@ -48,7 +48,7 @@ irq_desc_type = utils.CachedType("struct count = cpus.per_cpu(desc['kstat_irqs'], cpu)['cnt'] else: count = 0 - text += "%10u" % (count) + text += "%10u " % (count) name = "None" if desc['irq_data']['chip']: @@ -58,7 +58,7 @@ irq_desc_type = utils.CachedType("struct else: name = "-" - text += " %8s" % (name) + text += " %-8s" % (name) if desc['irq_data']['domain']: text += " %*lu" % (prec, desc['irq_data']['hwirq']) @@ -97,64 +97,29 @@ irq_desc_type = utils.CachedType("struct text += "%*s: %10u\n" % (prec, "ERR", cnt['counter']) return text -def x86_show_irqstat(prec, pfx, field, desc): - irq_stat = gdb.parse_and_eval("&irq_stat") +def x86_show_irqstat(prec, pfx, idx, desc): + irq_stat = gdb.parse_and_eval("&irq_stat.counts[%d]" %idx) text = "%*s: " % (prec, pfx) for cpu in cpus.each_online_cpu(): stat = cpus.per_cpu(irq_stat, cpu) - text += "%10u " % (stat[field]) - text += " %s\n" % (desc) - return text - -def x86_show_mce(prec, var, pfx, desc): - pvar = gdb.parse_and_eval(var) - text = "%*s: " % (prec, pfx) - for cpu in cpus.each_online_cpu(): - text += "%10u " % (cpus.per_cpu(pvar, cpu).dereference()) - text += " %s\n" % (desc) + text += "%10u " % (stat.dereference()) + text += desc return text def x86_show_interupts(prec): - text = x86_show_irqstat(prec, "NMI", '__nmi_count', 'Non-maskable interrupts') + info_type = gdb.lookup_type('struct irq_stat_info') + info = gdb.parse_and_eval('irq_stat_info') + bitmap = gdb.parse_and_eval('irq_stat_count_show') + bitsperlong = 8 * int(bitmap.type.target().sizeof) - if constants.LX_CONFIG_X86_LOCAL_APIC: - text += x86_show_irqstat(prec, "LOC", 'apic_timer_irqs', "Local timer interrupts") - text += x86_show_irqstat(prec, "SPU", 'irq_spurious_count', "Spurious interrupts") - text += x86_show_irqstat(prec, "PMI", 'apic_perf_irqs', "Performance monitoring interrupts") - text += x86_show_irqstat(prec, "IWI", 'apic_irq_work_irqs', "IRQ work interrupts") - text += x86_show_irqstat(prec, "RTR", 'icr_read_retry_count', "APIC ICR read retries") - if utils.gdb_eval_or_none("x86_platform_ipi_callback") is not None: - text += x86_show_irqstat(prec, "PLT", 'x86_platform_ipis', "Platform interrupts") - - if constants.LX_CONFIG_SMP: - text += x86_show_irqstat(prec, "RES", 'irq_resched_count', "Rescheduling interrupts") - text += x86_show_irqstat(prec, "CAL", 'irq_call_count', "Function call interrupts") - text += x86_show_irqstat(prec, "TLB", 'irq_tlb_count', "TLB shootdowns") - - if constants.LX_CONFIG_X86_THERMAL_VECTOR: - text += x86_show_irqstat(prec, "TRM", 'irq_thermal_count', "Thermal events interrupts") - - if constants.LX_CONFIG_X86_MCE_THRESHOLD: - text += x86_show_irqstat(prec, "THR", 'irq_threshold_count', "Threshold APIC interrupts") - - if constants.LX_CONFIG_X86_MCE_AMD: - text += x86_show_irqstat(prec, "DFR", 'irq_deferred_error_count', "Deferred Error APIC interrupts") - - if constants.LX_CONFIG_X86_MCE: - text += x86_show_mce(prec, "&mce_exception_count", "MCE", "Machine check exceptions") - text += x86_show_mce(prec, "&mce_poll_count", "MCP", "Machine check polls") - - text += show_irq_err_count(prec) - - if constants.LX_CONFIG_X86_IO_APIC: - cnt = utils.gdb_eval_or_none("irq_mis_count") - if cnt is not None: - text += "%*s: %10u\n" % (prec, "MIS", cnt['counter']) - - if constants.LX_CONFIG_KVM: - text += x86_show_irqstat(prec, "PIN", 'kvm_posted_intr_ipis', 'Posted-interrupt notification event') - text += x86_show_irqstat(prec, "NPI", 'kvm_posted_intr_nested_ipis', 'Nested posted-interrupt event') - text += x86_show_irqstat(prec, "PIW", 'kvm_posted_intr_wakeup_ipis', 'Posted-interrupt wakeup event') + text = "" + for idx in range(int(info.type.sizeof / info_type.sizeof)): + show = bitmap[int(idx / bitsperlong)] + if not show & 1 << int(idx % bitsperlong): + continue + pfx = info[idx]['symbol'].string() + desc = info[idx]['text'].string() + text += x86_show_irqstat(prec, pfx, idx, desc) return text