diff mbox series

[2/2] riscv: tracing: Improve hardirq tracing message

Message ID 20220901104515.135162-3-zouyipeng@huawei.com (mailing list archive)
State Superseded
Headers show
Series riscv: tracing: Improve hardirq tracing message | expand

Commit Message

Yipeng Zou Sept. 1, 2022, 10:45 a.m. UTC
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

Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
---
 arch/riscv/kernel/trace_irq.c | 4 ++--
 include/linux/irqflags.h      | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Yipeng Zou Sept. 9, 2022, 9:40 a.m. UTC | #1
Ping.

在 2022/9/1 18:45, Yipeng Zou 写道:
> 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
>
> Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
> ---
>   arch/riscv/kernel/trace_irq.c | 4 ++--
>   include/linux/irqflags.h      | 2 ++
>   2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kernel/trace_irq.c b/arch/riscv/kernel/trace_irq.c
> index 095ac976d7da..7ca24b26e19f 100644
> --- a/arch/riscv/kernel/trace_irq.c
> +++ b/arch/riscv/kernel/trace_irq.c
> @@ -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);
> diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
> index 5ec0fa71399e..46774fa85cde 100644
> --- a/include/linux/irqflags.h
> +++ b/include/linux/irqflags.h
> @@ -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)
Yipeng Zou Sept. 14, 2022, 7:29 a.m. UTC | #2
Loop in guoren@kernel.org,

Please help review on this patch, thanks very much.

在 2022/9/9 17:40, Yipeng Zou 写道:
> Ping.
>
> 在 2022/9/1 18:45, Yipeng Zou 写道:
>> 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
>>
>> Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
>> ---
>>   arch/riscv/kernel/trace_irq.c | 4 ++--
>>   include/linux/irqflags.h      | 2 ++
>>   2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/riscv/kernel/trace_irq.c 
>> b/arch/riscv/kernel/trace_irq.c
>> index 095ac976d7da..7ca24b26e19f 100644
>> --- a/arch/riscv/kernel/trace_irq.c
>> +++ b/arch/riscv/kernel/trace_irq.c
>> @@ -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);
>> diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
>> index 5ec0fa71399e..46774fa85cde 100644
>> --- a/include/linux/irqflags.h
>> +++ b/include/linux/irqflags.h
>> @@ -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)
>
Guo Ren Sept. 15, 2022, 1:34 a.m. UTC | #3
Add Fixes tag, and the upstream should go to generic entry.

Just for stable branches fixup:
Acked-by: Guo Ren <guoren@kernel.org>

On Wed, Sep 14, 2022 at 3:29 PM Yipeng Zou <zouyipeng@huawei.com> wrote:
>
> Loop in guoren@kernel.org,
>
> Please help review on this patch, thanks very much.
>
> 在 2022/9/9 17:40, Yipeng Zou 写道:
> > Ping.
> >
> > 在 2022/9/1 18:45, Yipeng Zou 写道:
> >> 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
> >>
> >> Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
> >> ---
> >>   arch/riscv/kernel/trace_irq.c | 4 ++--
> >>   include/linux/irqflags.h      | 2 ++
> >>   2 files changed, 4 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/arch/riscv/kernel/trace_irq.c
> >> b/arch/riscv/kernel/trace_irq.c
> >> index 095ac976d7da..7ca24b26e19f 100644
> >> --- a/arch/riscv/kernel/trace_irq.c
> >> +++ b/arch/riscv/kernel/trace_irq.c
> >> @@ -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);
> >> diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
> >> index 5ec0fa71399e..46774fa85cde 100644
> >> --- a/include/linux/irqflags.h
> >> +++ b/include/linux/irqflags.h
> >> @@ -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)
> >
> --
> Regards,
> Yipeng Zou
>
Yipeng Zou Sept. 15, 2022, 2:42 a.m. UTC | #4
在 2022/9/15 9:34, Guo Ren 写道:
> Add Fixes tag, and the upstream should go to generic entry.
>
> Just for stable branches fixup:
> Acked-by: Guo Ren <guoren@kernel.org>
ok,thanks for review.
> On Wed, Sep 14, 2022 at 3:29 PM Yipeng Zou <zouyipeng@huawei.com> wrote:
>> Loop in guoren@kernel.org,
>>
>> Please help review on this patch, thanks very much.
>>
>> 在 2022/9/9 17:40, Yipeng Zou 写道:
>>> Ping.
>>>
>>> 在 2022/9/1 18:45, Yipeng Zou 写道:
>>>> 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
>>>>
>>>> Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
>>>> ---
>>>>    arch/riscv/kernel/trace_irq.c | 4 ++--
>>>>    include/linux/irqflags.h      | 2 ++
>>>>    2 files changed, 4 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/arch/riscv/kernel/trace_irq.c
>>>> b/arch/riscv/kernel/trace_irq.c
>>>> index 095ac976d7da..7ca24b26e19f 100644
>>>> --- a/arch/riscv/kernel/trace_irq.c
>>>> +++ b/arch/riscv/kernel/trace_irq.c
>>>> @@ -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);
>>>> diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
>>>> index 5ec0fa71399e..46774fa85cde 100644
>>>> --- a/include/linux/irqflags.h
>>>> +++ b/include/linux/irqflags.h
>>>> @@ -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)
>> --
>> Regards,
>> Yipeng Zou
>>
>
diff mbox series

Patch

diff --git a/arch/riscv/kernel/trace_irq.c b/arch/riscv/kernel/trace_irq.c
index 095ac976d7da..7ca24b26e19f 100644
--- a/arch/riscv/kernel/trace_irq.c
+++ b/arch/riscv/kernel/trace_irq.c
@@ -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);
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index 5ec0fa71399e..46774fa85cde 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -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)