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 4C887313E1B for ; Thu, 26 Mar 2026 21:57:14 +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=1774562234; cv=none; b=oB4O32m4063ZClD5Awhcpf7KEELwaQ7bFcg4a00hNjzFPtEyaCF2Enxhk+wv8Tj4sX8qstANZ9A5Vo/IsXd8wR2QALZEaPETSl232n+KtSnoukhg2qa/9Hw/XvvVIpR4NcCpj3rdM1/i2XaX8DaNdkWx3OR2dWSDji3y11jjxQQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774562234; c=relaxed/simple; bh=kOx0OpOeaXK6tUJGp8fnTzclhP2V2QNdvkpO9TGPL7M=; h=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=KgWm9hNgvfqHyq8VvIDZZvaWmJEPjqYvzUW1PpRAcaa8nAkkCQNzJI0XRS6ZdurzLBEr3ikIfomRxbiY7DeS0Zonm+e5/lBt0VpSuqSyaQs8foU/ZJAXFamJGDFDr2EgH/l+Aa2RlVSjdlMUe9dNMbw+L0ySBHtL6I/wnwJGU4s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uceDl+LB; 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="uceDl+LB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B69DC116C6; Thu, 26 Mar 2026 21:57:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774562234; bh=kOx0OpOeaXK6tUJGp8fnTzclhP2V2QNdvkpO9TGPL7M=; h=Date:From:To:Cc:Subject:References:From; b=uceDl+LBD5N367E3bcfer8fX8fmqtlVfCZ2Vpqr8g0Wtynsc6uEgFrwrxP2+kKG82 lXcVSlqMMQh/+1eUPTF389A0rSFaXbZ9UPd0FUdVMTXQFk54s9qM4mV88tQGVeDrY9 bIbCGL3TPXJLu7/RUXx27qbDv8TBhFo6V/MtZkL2YBW5vP4pIsncQ0vEW+D7DQoBzP J7e6eGS3/I0hO/p0pje3VkYU+4IdATetXBzZwsR0DazwFefBvbL1t4gfSkc8D07k0F F8ASNDvcd6BtWh7kmxnG1DeNVbfjFX4THQMRwqJaIdqZZwrN9eBCkb2c3TtTvJd+9i Y70aHeTFvmgJw== Date: Thu, 26 Mar 2026 22:57:10 +0100 Message-ID: <20260326215036.714143491@kernel.org> User-Agent: quilt/0.68 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Michael Kelley , Jan Kiszka , Kieran Bingham , Florian Fainelli , Dmitry Ilvokhin , Radu Rendec Subject: [patch V3 07/14] scripts/gdb: Update x86 interrupts to the array based storage References: <20260326214345.019130211@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 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 Cc: Jan Kiszka Cc: Kieran Bingham Cc: Florian Fainelli --- V3: New patch - Radu --- scripts/gdb/linux/interrupts.py | 57 +++++++++------------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) --- a/scripts/gdb/linux/interrupts.py +++ b/scripts/gdb/linux/interrupts.py @@ -97,52 +97,26 @@ 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') - 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 = "" + for idx in range(int(info.type.sizeof / info_type.sizeof)): + if info[idx]['skip_vector']: + continue + pfx = info[idx]['symbol'].string() + desc = info[idx]['text'].string() + text += x86_show_irqstat(prec, pfx, idx, desc) text += show_irq_err_count(prec) @@ -151,11 +125,6 @@ irq_desc_type = utils.CachedType("struct 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') - return text def arm_common_show_interrupts(prec):