All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels
@ 2022-11-15 20:48 Guilherme G. Piccoli
  2022-11-16  6:36 ` Masami Hiramatsu
  0 siblings, 1 reply; 9+ messages in thread
From: Guilherme G. Piccoli @ 2022-11-15 20:48 UTC (permalink / raw)
  To: linux-kernel, rostedt
  Cc: rcu, kernel-dev, kernel, Guilherme G. Piccoli, Paul E . McKenney,
	Masami Hiramatsu, Mark Rutland

The function match_records() may take a while due to a large
number of string comparisons, so when in PREEMPT_VOLUNTARY
kernels we could face RCU stalls due to that.

Add a cond_resched() to prevent that.

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Paul E. McKenney <paulmck@kernel.org> # from RCU CPU stall warning perspective
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
---

Hi Steve / Paul, thanks for the discussions on the first thread [0],
much appreciated! Here is the "official" version.

Steve: lemme know if it's good for you, and in case you prefer to
send it yourself (since you proposed it on IRC), fine by me!

Paul: kept your ACK (thanks for that BTW) even though I changed the
place of cond_resched() to align with Steve's preference. Lemme know
in case you want to drop this ACK.

Cheers,

Guilherme


[0] https://lore.kernel.org/lkml/1ef5fe19-a82f-835e-fda5-455e9c2b94b4@igalia.com/


 kernel/trace/ftrace.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7dc023641bf1..80639bdb85f6 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4192,6 +4192,7 @@ match_records(struct ftrace_hash *hash, char *func, int len, char *mod)
 			}
 			found = 1;
 		}
+		cond_resched();
 	} while_for_each_ftrace_rec();
  out_unlock:
 	mutex_unlock(&ftrace_lock);
-- 
2.38.0


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

* Re: [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels
  2022-11-15 20:48 [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels Guilherme G. Piccoli
@ 2022-11-16  6:36 ` Masami Hiramatsu
  2022-11-16 12:45   ` Guilherme G. Piccoli
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Masami Hiramatsu @ 2022-11-16  6:36 UTC (permalink / raw)
  To: Guilherme G. Piccoli
  Cc: linux-kernel, rostedt, rcu, kernel-dev, kernel,
	Paul E . McKenney, Masami Hiramatsu, Mark Rutland

On Tue, 15 Nov 2022 17:48:47 -0300
"Guilherme G. Piccoli" <gpiccoli@igalia.com> wrote:

> The function match_records() may take a while due to a large
> number of string comparisons, so when in PREEMPT_VOLUNTARY
> kernels we could face RCU stalls due to that.
> 
> Add a cond_resched() to prevent that.
> 
> Suggested-by: Steven Rostedt <rostedt@goodmis.org>
> Acked-by: Paul E. McKenney <paulmck@kernel.org> # from RCU CPU stall warning perspective
> Cc: Masami Hiramatsu <mhiramat@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>

This looks good to me.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thanks!

> ---
> 
> Hi Steve / Paul, thanks for the discussions on the first thread [0],
> much appreciated! Here is the "official" version.
> 
> Steve: lemme know if it's good for you, and in case you prefer to
> send it yourself (since you proposed it on IRC), fine by me!
> 
> Paul: kept your ACK (thanks for that BTW) even though I changed the
> place of cond_resched() to align with Steve's preference. Lemme know
> in case you want to drop this ACK.
> 
> Cheers,
> 
> Guilherme
> 
> 
> [0] https://lore.kernel.org/lkml/1ef5fe19-a82f-835e-fda5-455e9c2b94b4@igalia.com/
> 
> 
>  kernel/trace/ftrace.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 7dc023641bf1..80639bdb85f6 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -4192,6 +4192,7 @@ match_records(struct ftrace_hash *hash, char *func, int len, char *mod)
>  			}
>  			found = 1;
>  		}
> +		cond_resched();
>  	} while_for_each_ftrace_rec();
>   out_unlock:
>  	mutex_unlock(&ftrace_lock);
> -- 
> 2.38.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

* Re: [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels
  2022-11-16  6:36 ` Masami Hiramatsu
@ 2022-11-16 12:45   ` Guilherme G. Piccoli
  2022-11-22 13:16   ` Guilherme G. Piccoli
  2022-12-13 22:04   ` Guilherme G. Piccoli
  2 siblings, 0 replies; 9+ messages in thread
From: Guilherme G. Piccoli @ 2022-11-16 12:45 UTC (permalink / raw)
  To: Masami Hiramatsu (Google)
  Cc: linux-kernel, rostedt, rcu, kernel-dev, kernel,
	Paul E . McKenney, Mark Rutland

On 16/11/2022 03:36, Masami Hiramatsu (Google) wrote:
> [...]
> This looks good to me.
> 
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> Thanks!

Thanks for your review/Ack Masami, much appreciated.
Cheers,


Guilherme

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

* Re: [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels
  2022-11-16  6:36 ` Masami Hiramatsu
  2022-11-16 12:45   ` Guilherme G. Piccoli
@ 2022-11-22 13:16   ` Guilherme G. Piccoli
  2022-11-22 15:49     ` Steven Rostedt
  2022-12-13 22:04   ` Guilherme G. Piccoli
  2 siblings, 1 reply; 9+ messages in thread
From: Guilherme G. Piccoli @ 2022-11-22 13:16 UTC (permalink / raw)
  To: rostedt
  Cc: Masami Hiramatsu (Google),
	linux-kernel, rcu, kernel-dev, kernel, Paul E . McKenney,
	Mark Rutland

On 16/11/2022 03:36, Masami Hiramatsu (Google) wrote:
> On Tue, 15 Nov 2022 17:48:47 -0300
> "Guilherme G. Piccoli" <gpiccoli@igalia.com> wrote:
> 
>> The function match_records() may take a while due to a large
>> number of string comparisons, so when in PREEMPT_VOLUNTARY
>> kernels we could face RCU stalls due to that.
>>
>> Add a cond_resched() to prevent that.
>>
>> Suggested-by: Steven Rostedt <rostedt@goodmis.org>
>> Acked-by: Paul E. McKenney <paulmck@kernel.org> # from RCU CPU stall warning perspective
>> Cc: Masami Hiramatsu <mhiramat@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
> 
> This looks good to me.
> 
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> Thanks!
> 

Hi Steve, apologies for the ping, just want to ask you if you plan to
take this one or should I change something? Thanks in advance,


Guilherme

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

* Re: [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels
  2022-11-22 13:16   ` Guilherme G. Piccoli
@ 2022-11-22 15:49     ` Steven Rostedt
  2022-11-22 17:21       ` Guilherme G. Piccoli
  0 siblings, 1 reply; 9+ messages in thread
From: Steven Rostedt @ 2022-11-22 15:49 UTC (permalink / raw)
  To: Guilherme G. Piccoli
  Cc: Masami Hiramatsu (Google),
	linux-kernel, rcu, kernel-dev, kernel, Paul E . McKenney,
	Mark Rutland

On Tue, 22 Nov 2022 10:16:41 -0300
"Guilherme G. Piccoli" <gpiccoli@igalia.com> wrote:

> Hi Steve, apologies for the ping, just want to ask you if you plan to
> take this one or should I change something? Thanks in advance,

I was traveling for work from Oct 31-Nov 14 and when I got back, I had over
300 patches to review in my queue. I'm now down under 100, so hopefully I
can get to it soon.

Just may take a bit.

Thanks,

-- Steve

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

* Re: [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels
  2022-11-22 15:49     ` Steven Rostedt
@ 2022-11-22 17:21       ` Guilherme G. Piccoli
  0 siblings, 0 replies; 9+ messages in thread
From: Guilherme G. Piccoli @ 2022-11-22 17:21 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Masami Hiramatsu (Google),
	linux-kernel, rcu, kernel-dev, kernel, Paul E . McKenney,
	Mark Rutland

On 22/11/2022 12:49, Steven Rostedt wrote:
> [...]
> I was traveling for work from Oct 31-Nov 14 and when I got back, I had over
> 300 patches to review in my queue. I'm now down under 100, so hopefully I
> can get to it soon.
> 
> Just may take a bit.
> 
> Thanks,
> 
> -- Steve

No hurries, thanks for your heads-up!
Cheers,


Guilherme

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

* Re: [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels
  2022-11-16  6:36 ` Masami Hiramatsu
  2022-11-16 12:45   ` Guilherme G. Piccoli
  2022-11-22 13:16   ` Guilherme G. Piccoli
@ 2022-12-13 22:04   ` Guilherme G. Piccoli
  2022-12-13 22:34     ` Steven Rostedt
  2 siblings, 1 reply; 9+ messages in thread
From: Guilherme G. Piccoli @ 2022-12-13 22:04 UTC (permalink / raw)
  To: rostedt
  Cc: linux-kernel, Masami Hiramatsu (Google),
	rcu, kernel-dev, kernel, Paul E . McKenney, Mark Rutland



On 16/11/2022 03:36, Masami Hiramatsu (Google) wrote:
> On Tue, 15 Nov 2022 17:48:47 -0300
> "Guilherme G. Piccoli" <gpiccoli@igalia.com> wrote:
> 
>> The function match_records() may take a while due to a large
>> number of string comparisons, so when in PREEMPT_VOLUNTARY
>> kernels we could face RCU stalls due to that.
>>
>> Add a cond_resched() to prevent that.
>>
>> Suggested-by: Steven Rostedt <rostedt@goodmis.org>
>> Acked-by: Paul E. McKenney <paulmck@kernel.org> # from RCU CPU stall warning perspective
>> Cc: Masami Hiramatsu <mhiramat@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
> 
> This looks good to me.
> 
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> Thanks!
> 

Hi Steve, sorry to annoy, just a regular ping to see if we can get this
into 6.2 (if too late, not a huge deal).

Thanks,


Guilherme

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

* Re: [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels
  2022-12-13 22:04   ` Guilherme G. Piccoli
@ 2022-12-13 22:34     ` Steven Rostedt
  2022-12-13 23:41       ` Guilherme G. Piccoli
  0 siblings, 1 reply; 9+ messages in thread
From: Steven Rostedt @ 2022-12-13 22:34 UTC (permalink / raw)
  To: Guilherme G. Piccoli
  Cc: linux-kernel, Masami Hiramatsu (Google),
	rcu, kernel-dev, kernel, Paul E . McKenney, Mark Rutland

On Tue, 13 Dec 2022 19:04:41 -0300
"Guilherme G. Piccoli" <gpiccoli@igalia.com> wrote:

> Hi Steve, sorry to annoy, just a regular ping to see if we can get this
> into 6.2 (if too late, not a huge deal).

Thanks for the ping. For some reason this patch didn't make it into my
internal Patchwork, so I missed it (even though I did reply to you, I just
assumed it was in my patchwork).

It's not too late. I have some last minute patches I'm still testing. I'll
queue this one up.

BTW, we now have a kernel ftrace mailing list that you can Cc (but still Cc
LKML). 

  linux-trace-kernel@vger.kernel.org

-- Steve

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

* Re: [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels
  2022-12-13 22:34     ` Steven Rostedt
@ 2022-12-13 23:41       ` Guilherme G. Piccoli
  0 siblings, 0 replies; 9+ messages in thread
From: Guilherme G. Piccoli @ 2022-12-13 23:41 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, Masami Hiramatsu (Google),
	rcu, kernel-dev, kernel, Paul E . McKenney, Mark Rutland

On 13/12/2022 19:34, Steven Rostedt wrote:
> On Tue, 13 Dec 2022 19:04:41 -0300
> "Guilherme G. Piccoli" <gpiccoli@igalia.com> wrote:
> 
>> Hi Steve, sorry to annoy, just a regular ping to see if we can get this
>> into 6.2 (if too late, not a huge deal).
> 
> Thanks for the ping. For some reason this patch didn't make it into my
> internal Patchwork, so I missed it (even though I did reply to you, I just
> assumed it was in my patchwork).
> 
> It's not too late. I have some last minute patches I'm still testing. I'll
> queue this one up.
> 
> BTW, we now have a kernel ftrace mailing list that you can Cc (but still Cc
> LKML). 
> 
>   linux-trace-kernel@vger.kernel.org
> 
> -- Steve

Tnx a lot Steve! I'll start to CC this list as well.

Cheers,


Guilherme

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

end of thread, other threads:[~2022-12-13 23:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 20:48 [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels Guilherme G. Piccoli
2022-11-16  6:36 ` Masami Hiramatsu
2022-11-16 12:45   ` Guilherme G. Piccoli
2022-11-22 13:16   ` Guilherme G. Piccoli
2022-11-22 15:49     ` Steven Rostedt
2022-11-22 17:21       ` Guilherme G. Piccoli
2022-12-13 22:04   ` Guilherme G. Piccoli
2022-12-13 22:34     ` Steven Rostedt
2022-12-13 23:41       ` Guilherme G. Piccoli

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.