Skip to contentSkip to conversation

riscv: tracing: Improve hardirq tracing message

PATCH In review Yipeng Zou 2 participants 3 messages Sep 15, 2022 – Sep 16, 2022 RISC-V

lore
Share & tools
lore

Yipeng Zou

author
#0 lore raw

PATCH v2 1/1 riscv: tracing: Improve hardirq tracing message

Use trace_hardirqs_on_caller to improve irq_tracing message.

lockdep log in riscv showing the last {enabled,disabled} at __trace_hardirqs_{on,off} all the time(if called by). But that's not what we want to see, the caller is what we want.

Before this commit:

[   57.853175] hardirqs last  enabled at (2519): __trace_hardirqs_on+0xc/0x14
[   57.853848] hardirqs last disabled at (2520): __trace_hardirqs_off+0xc/0x14

After this commit

[   53.781428] hardirqs last  enabled at (2595): restore_all+0xe/0x66
[   53.782185] hardirqs last disabled at (2596): ret_from_exception+0xa/0x10
Fixes 22e2100b1b07 ("riscv: fix oops caused by irqsoff latency tracer")

---
v2: add tags

 arch/riscv/kernel/trace_irq.c | 4 ++--
 include/linux/irqflags.h      | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/riscv/kernel/trace_irq.c +2 -2
index 095ac976d7da..7ca24b26e19f 100644
@@ -16,12 +16,12 @@
 
 void __trace_hardirqs_on(void)
 {
-	trace_hardirqs_on();
+	trace_hardirqs_on_caller(CALLER_ADDR0);
 }
 NOKPROBE_SYMBOL(__trace_hardirqs_on);
 
 void __trace_hardirqs_off(void)
 {
-	trace_hardirqs_off();
+	trace_hardirqs_off_caller(CALLER_ADDR0);
 }
 NOKPROBE_SYMBOL(__trace_hardirqs_off);
include/linux/irqflags.h +2 -0
index 5ec0fa71399e..46774fa85cde 100644
@@ -53,6 +53,8 @@ extern void trace_hardirqs_on_prepare(void);
 extern void trace_hardirqs_off_finish(void);
 extern void trace_hardirqs_on(void);
 extern void trace_hardirqs_off(void);
+extern void trace_hardirqs_on_caller(unsigned long caller_addr);
+extern void trace_hardirqs_off_caller(unsigned long caller_addr);
 
 # define lockdep_hardirq_context()	(raw_cpu_read(hardirq_context))
 # define lockdep_softirq_context(p)	((p)->softirq_context)
Signature · 7 lines
2.17.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw
Quoted 31 lines · Yipeng Zou

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Use trace_hardirqs_on_caller to improve irq_tracing message.

lockdep log in riscv showing the last {enabled,disabled} at __trace_hardirqs_{on,off} all the time(if called by). But that's not what we want to see, the caller is what we want.

Before this commit:

[   57.853175] hardirqs last  enabled at (2519): __trace_hardirqs_on+0xc/0x14
[   57.853848] hardirqs last disabled at (2520): __trace_hardirqs_off+0xc/0x14

After this commit

[   53.781428] hardirqs last  enabled at (2595): restore_all+0xe/0x66
[   53.782185] hardirqs last disabled at (2596): ret_from_exception+0xa/0x10
Fixes 22e2100b1b07 ("riscv: fix oops caused by irqsoff latency tracer")

---
v2: add tags

  arch/riscv/kernel/trace_irq.c | 4 ++--
  include/linux/irqflags.h      | 2 ++
  2 files changed, 4 insertions(+), 2 deletions(-)
arch/riscv/kernel/trace_irq.c +0 -0
index 095ac976d7da..7ca24b26e19f 100644

arch/riscv/kernel/trace_irq.c line 19

Quoted 5 lines
arch/riscv/kernel/trace_irq.c +1 -1
@@ -16,12 +16,12 @@
 
  void __trace_hardirqs_on(void)
  {
-       trace_hardirqs_on();
+       trace_hardirqs_on_caller(CALLER_ADDR0);

Out of curiosity, why does riscv need to use this when other archs don;t?

Quoted 26 lines
arch/riscv/kernel/trace_irq.c +1 -1
  }
  NOKPROBE_SYMBOL(__trace_hardirqs_on);
 
  void __trace_hardirqs_off(void)
  {
-       trace_hardirqs_off();
+       trace_hardirqs_off_caller(CALLER_ADDR0);
  }
  NOKPROBE_SYMBOL(__trace_hardirqs_off);
include/linux/irqflags.h +2 -1
index 5ec0fa71399e..46774fa85cde 100644
@@ -53,6 +53,8 @@ extern void trace_hardirqs_on_prepare(void);
  extern void trace_hardirqs_off_finish(void);
  extern void trace_hardirqs_on(void);
  extern void trace_hardirqs_off(void);
+extern void trace_hardirqs_on_caller(unsigned long caller_addr);
+extern void trace_hardirqs_off_caller(unsigned long caller_addr);
 
  # define lockdep_hardirq_context()     (raw_cpu_read(hardirq_context))
  # define lockdep_softirq_context(p)    ((p)->softirq_context)
--

2.17.1

Quoted 4 lines

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

author
#2 lore raw
Quoted 33 lines · 在 2022/9/15 22:04, [email protected] 写道:
Quoted 32 lines · Yipeng Zou

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Use trace_hardirqs_on_caller to improve irq_tracing message.

lockdep log in riscv showing the last {enabled,disabled} at __trace_hardirqs_{on,off} all the time(if called by). But that's not what we want to see, the caller is what we want.

Before this commit:

[   57.853175] hardirqs last  enabled at (2519): __trace_hardirqs_on+0xc/0x14
[   57.853848] hardirqs last disabled at (2520): __trace_hardirqs_off+0xc/0x14

After this commit

[   53.781428] hardirqs last  enabled at (2595): restore_all+0xe/0x66
[   53.782185] hardirqs last disabled at (2596): ret_from_exception+0xa/0x10
Fixes 22e2100b1b07 ("riscv: fix oops caused by irqsoff latency tracer")

---
v2: add tags

   arch/riscv/kernel/trace_irq.c | 4 ++--
   include/linux/irqflags.h      | 2 ++
   2 files changed, 4 insertions(+), 2 deletions(-)
arch/riscv/kernel/trace_irq.c +0 -0
index 095ac976d7da..7ca24b26e19f 100644
@@ -16,12 +16,12 @@
 
Quoted 6 lines

arch/riscv/kernel/trace_irq.c line 19

Quoted 4 lines
arch/riscv/kernel/trace_irq.c +1 -1
   void __trace_hardirqs_on(void)
   {
-       trace_hardirqs_on();
+       trace_hardirqs_on_caller(CALLER_ADDR0);

Out of curiosity, why does riscv need to use this when other archs don;t?

At the start we use trace_hardirqs_{on,off} directly in entry.S, but it casue an oops here.

Because of "The trace_hardirqs_{on,off}() require the caller to setup frame pointer properly.",

and then we add these function.

But I notice that [email protected] is working on convert riscv to use the generic entry infrastructure,

at that time i think we can remove__trace_hardirqs_{on,off}.

Quoted 30 lines
Quoted 30 lines
arch/riscv/kernel/trace_irq.c +1 -1
   }
   NOKPROBE_SYMBOL(__trace_hardirqs_on);
 
   void __trace_hardirqs_off(void)
   {
-       trace_hardirqs_off();
+       trace_hardirqs_off_caller(CALLER_ADDR0);
   }
   NOKPROBE_SYMBOL(__trace_hardirqs_off);
include/linux/irqflags.h +2 -1
index 5ec0fa71399e..46774fa85cde 100644
@@ -53,6 +53,8 @@ extern void trace_hardirqs_on_prepare(void);
   extern void trace_hardirqs_off_finish(void);
   extern void trace_hardirqs_on(void);
   extern void trace_hardirqs_off(void);
+extern void trace_hardirqs_on_caller(unsigned long caller_addr);
+extern void trace_hardirqs_off_caller(unsigned long caller_addr);
 
   # define lockdep_hardirq_context()     (raw_cpu_read(hardirq_context))
   # define lockdep_softirq_context(p)    ((p)->softirq_context)
--

2.17.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

Signature · 8 lines
Regards,
Yipeng Zou


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv