* [PATCH 1/2] trace,x86: Add external_interrupts to the irq_vectors class
@ 2018-09-17 8:48 Daniel Bristot de Oliveira
2018-09-17 8:48 ` [PATCH 2/2] trace,x86: Add nmi " Daniel Bristot de Oliveira
2018-09-17 10:24 ` [PATCH 1/2] trace,x86: Add external_interrupts " kbuild test robot
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Bristot de Oliveira @ 2018-09-17 8:48 UTC (permalink / raw)
To: linux-kernel
Cc: Daniel Bristot de Oliveira, Thomas Gleixner, Ingo Molnar,
Peter Zijlstra, Steven Rostedt, Andy Lutomirski, Clark Williams,
x86
Currently, the irq_vectors is showing the entry and exit events for
the interrupts of the architecture, but not for external interrupts.
This patch adds the tracepoints for external interrupts.
Example of output:
<idle>-0 [000] d.h. 102.890935: external_interrupt_entry: vector=35
<idle>-0 [000] d.h. 102.890960: external_interrupt_exit: vector=35
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Clark Williams <williams@redhat.com>
Cc: linux-kernel@vger.kernel.org
Cc: x86@kernel.org
---
arch/x86/include/asm/trace/irq_vectors.h | 6 ++++++
arch/x86/kernel/irq.c | 2 ++
2 files changed, 8 insertions(+)
diff --git a/arch/x86/include/asm/trace/irq_vectors.h b/arch/x86/include/asm/trace/irq_vectors.h
index 0af81b590a0c..bc9669df97c9 100644
--- a/arch/x86/include/asm/trace/irq_vectors.h
+++ b/arch/x86/include/asm/trace/irq_vectors.h
@@ -138,6 +138,12 @@ DEFINE_IRQ_VECTOR_EVENT(deferred_error_apic);
DEFINE_IRQ_VECTOR_EVENT(thermal_apic);
#endif
+/*
+ * external_interrupt - called when entering/exiting from regular device
+ * interrupt vector handler.
+ */
+DEFINE_IRQ_VECTOR_EVENT(external_interrupt);
+
TRACE_EVENT(vector_config,
TP_PROTO(unsigned int irq, unsigned int vector,
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 59b5f2ea7c2f..715afe3a4f24 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -237,6 +237,7 @@ __visible unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
unsigned vector = ~regs->orig_ax;
entering_irq();
+ trace_external_interrupt_entry(vector);
/* entering_irq() tells RCU that we're not quiescent. Check it. */
RCU_LOCKDEP_WARN(!rcu_is_watching(), "IRQ failed to wake up RCU");
@@ -255,6 +256,7 @@ __visible unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
}
}
+ trace_external_interrupt_exit(vector);
exiting_irq();
set_irq_regs(old_regs);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] trace,x86: Add nmi to the irq_vectors class
2018-09-17 8:48 [PATCH 1/2] trace,x86: Add external_interrupts to the irq_vectors class Daniel Bristot de Oliveira
@ 2018-09-17 8:48 ` Daniel Bristot de Oliveira
2018-09-17 10:18 ` kbuild test robot
2018-09-17 10:24 ` [PATCH 1/2] trace,x86: Add external_interrupts " kbuild test robot
1 sibling, 1 reply; 4+ messages in thread
From: Daniel Bristot de Oliveira @ 2018-09-17 8:48 UTC (permalink / raw)
To: linux-kernel
Cc: Daniel Bristot de Oliveira, Thomas Gleixner, Ingo Molnar,
Peter Zijlstra, Steven Rostedt, Andy Lutomirski, Clark Williams,
x86
Currently, the irq_vector class of tracepoints does not include the NMI
entry. The NMI was in the first set of tracepoints for IRQs, but it was
dropped off because of the logic of switching IDT when enabling trace[1].
However, as the switching IDT logic was removed [2], it is possible to add
the NMI tracepoints back.
The tracepoints looks like:
<idle>-0 [000] d.Z. 179.594315: nmi_entry: vector=2
<idle>-0 [000] d.Z. 179.594396: nmi_exit: vector=2
[1] trace,x86: irq vector tracepoint support
https://lwn.net/Articles/555465/
[2] commit 4b9a8dca0e58 ("x86/idt: Remove the tracing IDT completely")
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Clark Williams <williams@redhat.com>
Cc: linux-kernel@vger.kernel.org
Cc: x86@kernel.org
---
arch/x86/include/asm/trace/irq_vectors.h | 5 +++++
arch/x86/kernel/nmi.c | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/arch/x86/include/asm/trace/irq_vectors.h b/arch/x86/include/asm/trace/irq_vectors.h
index bc9669df97c9..5b93e1a6b1fe 100644
--- a/arch/x86/include/asm/trace/irq_vectors.h
+++ b/arch/x86/include/asm/trace/irq_vectors.h
@@ -144,6 +144,11 @@ DEFINE_IRQ_VECTOR_EVENT(thermal_apic);
*/
DEFINE_IRQ_VECTOR_EVENT(external_interrupt);
+/*
+ * nmi - called when entering/exiting from nmi vector handler.
+ */
+DEFINE_IRQ_VECTOR_EVENT(nmi);
+
TRACE_EVENT(vector_config,
TP_PROTO(unsigned int irq, unsigned int vector,
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 18bc9b51ac9b..fa2d16b3af60 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -37,6 +37,8 @@
#define CREATE_TRACE_POINTS
#include <trace/events/nmi.h>
+#undef CREATE_TRACE_POINTS
+#include <asm/trace/irq_vectors.h>
struct nmi_desc {
raw_spinlock_t lock;
@@ -514,12 +516,14 @@ do_nmi(struct pt_regs *regs, long error_code)
#endif
nmi_enter();
+ trace_nmi_entry(2);
inc_irq_stat(__nmi_count);
if (!ignore_nmis)
default_do_nmi(regs);
+ trace_nmi_exit(2);
nmi_exit();
#ifdef CONFIG_X86_64
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] trace,x86: Add nmi to the irq_vectors class
2018-09-17 8:48 ` [PATCH 2/2] trace,x86: Add nmi " Daniel Bristot de Oliveira
@ 2018-09-17 10:18 ` kbuild test robot
0 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2018-09-17 10:18 UTC (permalink / raw)
To: Daniel Bristot de Oliveira
Cc: kbuild-all, linux-kernel, Daniel Bristot de Oliveira,
Thomas Gleixner, Ingo Molnar, Peter Zijlstra, Steven Rostedt,
Andy Lutomirski, Clark Williams, x86
[-- Attachment #1: Type: text/plain, Size: 1609 bytes --]
Hi Daniel,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/x86/core]
[also build test ERROR on v4.19-rc4 next-20180913]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Daniel-Bristot-de-Oliveira/trace-x86-Add-external_interrupts-to-the-irq_vectors-class/20180917-173538
config: i386-randconfig-x003-201837 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
arch/x86/kernel/nmi.c: In function 'do_nmi':
>> arch/x86/kernel/nmi.c:519:2: error: implicit declaration of function 'trace_nmi_entry'; did you mean 'ftrace_nmi_enter'? [-Werror=implicit-function-declaration]
trace_nmi_entry(2);
^~~~~~~~~~~~~~~
ftrace_nmi_enter
>> arch/x86/kernel/nmi.c:526:2: error: implicit declaration of function 'trace_nmi_exit'; did you mean 'ftrace_nmi_exit'? [-Werror=implicit-function-declaration]
trace_nmi_exit(2);
^~~~~~~~~~~~~~
ftrace_nmi_exit
cc1: some warnings being treated as errors
vim +519 arch/x86/kernel/nmi.c
517
518 nmi_enter();
> 519 trace_nmi_entry(2);
520
521 inc_irq_stat(__nmi_count);
522
523 if (!ignore_nmis)
524 default_do_nmi(regs);
525
> 526 trace_nmi_exit(2);
527 nmi_exit();
528
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 22639 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] trace,x86: Add external_interrupts to the irq_vectors class
2018-09-17 8:48 [PATCH 1/2] trace,x86: Add external_interrupts to the irq_vectors class Daniel Bristot de Oliveira
2018-09-17 8:48 ` [PATCH 2/2] trace,x86: Add nmi " Daniel Bristot de Oliveira
@ 2018-09-17 10:24 ` kbuild test robot
1 sibling, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2018-09-17 10:24 UTC (permalink / raw)
To: Daniel Bristot de Oliveira
Cc: kbuild-all, linux-kernel, Daniel Bristot de Oliveira,
Thomas Gleixner, Ingo Molnar, Peter Zijlstra, Steven Rostedt,
Andy Lutomirski, Clark Williams, x86
[-- Attachment #1: Type: text/plain, Size: 2744 bytes --]
Hi Daniel,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/x86/core]
[also build test ERROR on v4.19-rc4 next-20180913]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Daniel-Bristot-de-Oliveira/trace-x86-Add-external_interrupts-to-the-irq_vectors-class/20180917-173538
config: i386-randconfig-x003-201837 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
arch/x86/kernel/irq.c: In function 'do_IRQ':
>> arch/x86/kernel/irq.c:240:2: error: implicit declaration of function 'trace_external_interrupt_entry'; did you mean 'thermal_interrupt'? [-Werror=implicit-function-declaration]
trace_external_interrupt_entry(vector);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thermal_interrupt
>> arch/x86/kernel/irq.c:259:2: error: implicit declaration of function 'trace_external_interrupt_exit'; did you mean 'thermal_interrupt'? [-Werror=implicit-function-declaration]
trace_external_interrupt_exit(vector);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thermal_interrupt
cc1: some warnings being treated as errors
vim +240 arch/x86/kernel/irq.c
225
226
227 /*
228 * do_IRQ handles all normal device IRQ's (the special
229 * SMP cross-CPU interrupts have their own specific
230 * handlers).
231 */
232 __visible unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
233 {
234 struct pt_regs *old_regs = set_irq_regs(regs);
235 struct irq_desc * desc;
236 /* high bit used in ret_from_ code */
237 unsigned vector = ~regs->orig_ax;
238
239 entering_irq();
> 240 trace_external_interrupt_entry(vector);
241
242 /* entering_irq() tells RCU that we're not quiescent. Check it. */
243 RCU_LOCKDEP_WARN(!rcu_is_watching(), "IRQ failed to wake up RCU");
244
245 desc = __this_cpu_read(vector_irq[vector]);
246
247 if (!handle_irq(desc, regs)) {
248 ack_APIC_irq();
249
250 if (desc != VECTOR_RETRIGGERED) {
251 pr_emerg_ratelimited("%s: %d.%d No irq handler for vector\n",
252 __func__, smp_processor_id(),
253 vector);
254 } else {
255 __this_cpu_write(vector_irq[vector], VECTOR_UNUSED);
256 }
257 }
258
> 259 trace_external_interrupt_exit(vector);
260 exiting_irq();
261
262 set_irq_regs(old_regs);
263 return 1;
264 }
265
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 22639 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-17 10:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-17 8:48 [PATCH 1/2] trace,x86: Add external_interrupts to the irq_vectors class Daniel Bristot de Oliveira
2018-09-17 8:48 ` [PATCH 2/2] trace,x86: Add nmi " Daniel Bristot de Oliveira
2018-09-17 10:18 ` kbuild test robot
2018-09-17 10:24 ` [PATCH 1/2] trace,x86: Add external_interrupts " kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).