All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: Quiet smp_processor_id() use in preemptable warning in hwlat
@ 2021-08-04 18:18 Steven Rostedt
  2021-08-05  6:24 ` Daniel Bristot de Oliveira
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2021-08-04 18:18 UTC (permalink / raw)
  To: LKML; +Cc: Ingo Molnar, Andrew Morton, Daniel Bristot de Oliveira

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The hardware latency detector (hwlat) has a mode that it runs one thread
across CPUs. The logic to move from the currently running CPU to the next
one in the list does a smp_processor_id() to find where it currently is.
Unfortunately, it's done with preemption enabled, and this triggers a
warning for using smp_processor_id() in a preempt enabled section.

As it is only using smp_processor_id() to get information on where it
currently is in order to simply move it to the next CPU, it doesn't really
care if it got moved in the mean time. It will simply balance out later if
such a case arises.

Switch smp_processor_id() to raw_smp_processor_id() to quiet that warning.

Fixes: 8fa826b7344d ("trace/hwlat: Implement the mode config option")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_hwlat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c
index a6c0cdaf4b87..14f46aae1981 100644
--- a/kernel/trace/trace_hwlat.c
+++ b/kernel/trace/trace_hwlat.c
@@ -327,7 +327,7 @@ static void move_to_next_cpu(void)
 
 	get_online_cpus();
 	cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask);
-	next_cpu = cpumask_next(smp_processor_id(), current_mask);
+	next_cpu = cpumask_next(raw_smp_processor_id(), current_mask);
 	put_online_cpus();
 
 	if (next_cpu >= nr_cpu_ids)
-- 
2.31.1


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

* Re: [PATCH] tracing: Quiet smp_processor_id() use in preemptable warning in hwlat
  2021-08-04 18:18 [PATCH] tracing: Quiet smp_processor_id() use in preemptable warning in hwlat Steven Rostedt
@ 2021-08-05  6:24 ` Daniel Bristot de Oliveira
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Bristot de Oliveira @ 2021-08-05  6:24 UTC (permalink / raw)
  To: Steven Rostedt, LKML; +Cc: Ingo Molnar, Andrew Morton

On 8/4/21 8:18 PM, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> The hardware latency detector (hwlat) has a mode that it runs one thread
> across CPUs. The logic to move from the currently running CPU to the next
> one in the list does a smp_processor_id() to find where it currently is.
> Unfortunately, it's done with preemption enabled, and this triggers a
> warning for using smp_processor_id() in a preempt enabled section.
> 
> As it is only using smp_processor_id() to get information on where it
> currently is in order to simply move it to the next CPU, it doesn't really
> care if it got moved in the mean time. It will simply balance out later if
> such a case arises.
> 
> Switch smp_processor_id() to raw_smp_processor_id() to quiet that warning.
> 
> Fixes: 8fa826b7344d ("trace/hwlat: Implement the mode config option")
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Acked-by: Daniel Bristot de Oliveira <bristot@redhat.com>

Thanks!
-- Daniel

> ---
>  kernel/trace/trace_hwlat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c
> index a6c0cdaf4b87..14f46aae1981 100644
> --- a/kernel/trace/trace_hwlat.c
> +++ b/kernel/trace/trace_hwlat.c
> @@ -327,7 +327,7 @@ static void move_to_next_cpu(void)
>  
>  	get_online_cpus();
>  	cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask);
> -	next_cpu = cpumask_next(smp_processor_id(), current_mask);
> +	next_cpu = cpumask_next(raw_smp_processor_id(), current_mask);
>  	put_online_cpus();
>  
>  	if (next_cpu >= nr_cpu_ids)
> 


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

end of thread, other threads:[~2021-08-05  6:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 18:18 [PATCH] tracing: Quiet smp_processor_id() use in preemptable warning in hwlat Steven Rostedt
2021-08-05  6:24 ` Daniel Bristot de Oliveira

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.