public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ftrace: Fix improper usage of __trace_stack() function.
@ 2022-07-23  6:49 Anand Je Saipureddy
  2022-08-03  7:50 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 3+ messages in thread
From: Anand Je Saipureddy @ 2022-07-23  6:49 UTC (permalink / raw)
  To: linux-rt-users; +Cc: linux-kernel, cminyard, psiddaiah, Anand Je Saipureddy

In kernel/trace/trace_events_trigger.c --> stacktrace_trigger() -->
__trace_stack() is not defined as per the function definition.

With commit edbaaa13a660
("tracing: Merge irqflags + preemt counter, add RT bits")
the irqflags(flags) and preemption counter(preempt_count()) are
now should be evaluated early by tracing_gen_ctx().

This patch replaces the irqflags and preemption counter
with tracing_gen_ctx().

Fixes: 5e8446e3820c ("tracing: Dump stacktrace trigger to the corresponding instance")
Signed-off-by: Anand Je Saipureddy <s.anandje1@gmail.com>
Reviewed-by: Corey Minyard <cminyard@mvista.com>
---
 kernel/trace/trace_events_trigger.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index 75fef9fcfd0f..3c6229f16e81 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -1220,12 +1220,10 @@ stacktrace_trigger(struct event_trigger_data *data, void *rec,
 		   struct ring_buffer_event *event)
 {
 	struct trace_event_file *file = data->private_data;
-	unsigned long flags;
 
-	if (file) {
-		local_save_flags(flags);
-		__trace_stack(file->tr, STACK_SKIP, preempt_count());
-	} else
+	if (file)
+		__trace_stack(file->tr, tracing_gen_ctx(), STACK_SKIP);
+	else
 		trace_dump_stack(STACK_SKIP);
 }
 
-- 
2.25.1
This patch is applicable only for linux-stable-rt kernel of branch
v5.10-rt

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ftrace: Fix improper usage of __trace_stack() function.
  2022-07-23  6:49 [PATCH] ftrace: Fix improper usage of __trace_stack() function Anand Je Saipureddy
@ 2022-08-03  7:50 ` Sebastian Andrzej Siewior
  2022-08-25 13:41   ` Luis Claudio R. Goncalves
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-08-03  7:50 UTC (permalink / raw)
  To: Anand Je Saipureddy, Luis Claudio R. Goncalves, Clark Williams
  Cc: linux-rt-users, linux-kernel, cminyard, psiddaiah

On 2022-07-23 12:19:43 [+0530], Anand Je Saipureddy wrote:
> In kernel/trace/trace_events_trigger.c --> stacktrace_trigger() -->
> __trace_stack() is not defined as per the function definition.
> 
> With commit edbaaa13a660
> ("tracing: Merge irqflags + preemt counter, add RT bits")
> the irqflags(flags) and preemption counter(preempt_count()) are
> now should be evaluated early by tracing_gen_ctx().
> 
> This patch replaces the irqflags and preemption counter
> with tracing_gen_ctx().
> 
> Fixes: 5e8446e3820c ("tracing: Dump stacktrace trigger to the corresponding instance")
> Signed-off-by: Anand Je Saipureddy <s.anandje1@gmail.com>
> Reviewed-by: Corey Minyard <cminyard@mvista.com>

Please use [PATCH RT v5.10] in the future.
Luis, could you please pick it up?

> ---
>  kernel/trace/trace_events_trigger.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
> index 75fef9fcfd0f..3c6229f16e81 100644
> --- a/kernel/trace/trace_events_trigger.c
> +++ b/kernel/trace/trace_events_trigger.c
> @@ -1220,12 +1220,10 @@ stacktrace_trigger(struct event_trigger_data *data, void *rec,
>  		   struct ring_buffer_event *event)
>  {
>  	struct trace_event_file *file = data->private_data;
> -	unsigned long flags;
>  
> -	if (file) {
> -		local_save_flags(flags);
> -		__trace_stack(file->tr, STACK_SKIP, preempt_count());
> -	} else
> +	if (file)
> +		__trace_stack(file->tr, tracing_gen_ctx(), STACK_SKIP);
> +	else
>  		trace_dump_stack(STACK_SKIP);
>  }
>  

Sebastian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ftrace: Fix improper usage of __trace_stack() function.
  2022-08-03  7:50 ` Sebastian Andrzej Siewior
@ 2022-08-25 13:41   ` Luis Claudio R. Goncalves
  0 siblings, 0 replies; 3+ messages in thread
From: Luis Claudio R. Goncalves @ 2022-08-25 13:41 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Anand Je Saipureddy, Clark Williams, linux-rt-users, linux-kernel,
	cminyard, psiddaiah

On Wed, Aug 03, 2022 at 09:50:17AM +0200, Sebastian Andrzej Siewior wrote:
> On 2022-07-23 12:19:43 [+0530], Anand Je Saipureddy wrote:
> > In kernel/trace/trace_events_trigger.c --> stacktrace_trigger() -->
> > __trace_stack() is not defined as per the function definition.
> > 
> > With commit edbaaa13a660
> > ("tracing: Merge irqflags + preemt counter, add RT bits")
> > the irqflags(flags) and preemption counter(preempt_count()) are
> > now should be evaluated early by tracing_gen_ctx().
> > 
> > This patch replaces the irqflags and preemption counter
> > with tracing_gen_ctx().
> > 
> > Fixes: 5e8446e3820c ("tracing: Dump stacktrace trigger to the corresponding instance")
> > Signed-off-by: Anand Je Saipureddy <s.anandje1@gmail.com>
> > Reviewed-by: Corey Minyard <cminyard@mvista.com>
> 
> Please use [PATCH RT v5.10] in the future.
> Luis, could you please pick it up?

Added to the list.

And thank you for spotting this change, I missed that in my earlier sweep.

Luis
 
> > ---
> >  kernel/trace/trace_events_trigger.c | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
> > index 75fef9fcfd0f..3c6229f16e81 100644
> > --- a/kernel/trace/trace_events_trigger.c
> > +++ b/kernel/trace/trace_events_trigger.c
> > @@ -1220,12 +1220,10 @@ stacktrace_trigger(struct event_trigger_data *data, void *rec,
> >  		   struct ring_buffer_event *event)
> >  {
> >  	struct trace_event_file *file = data->private_data;
> > -	unsigned long flags;
> >  
> > -	if (file) {
> > -		local_save_flags(flags);
> > -		__trace_stack(file->tr, STACK_SKIP, preempt_count());
> > -	} else
> > +	if (file)
> > +		__trace_stack(file->tr, tracing_gen_ctx(), STACK_SKIP);
> > +	else
> >  		trace_dump_stack(STACK_SKIP);
> >  }
> >  
> 
> Sebastian
> 
---end quoted text---


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-25 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-23  6:49 [PATCH] ftrace: Fix improper usage of __trace_stack() function Anand Je Saipureddy
2022-08-03  7:50 ` Sebastian Andrzej Siewior
2022-08-25 13:41   ` Luis Claudio R. Goncalves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox