Re: [PATCH] rcu,ftrace: Fix ftrace recursion

From: Paul E. McKenney
Date: Tue Sep 29 2020 - 10:31:49 EST


On Tue, Sep 29, 2020 at 01:33:40PM +0200, Peter Zijlstra wrote:
>
> Kim reported that perf-ftrace made his box unhappy. It turns out that
> commit:
>
> ff5c4f5cad33 ("rcu/tree: Mark the idle relevant functions noinstr")
>
> removed one too many notrace. Probably due to there not being a helpful
> comment.
>
> Reinstate the notrace and add a comment to avoid loosing it again.

s/loosing/losing/, but otherwise:

Reviewed-by: Paul E. McKenney <paulmck@xxxxxxxxxx>

But please let me know if you would prefer that I take it via -rcu.

Thanx, Paul

> Fixes: ff5c4f5cad33 ("rcu/tree: Mark the idle relevant functions noinstr")
> Reported-by: Kim Phillips <kim.phillips@xxxxxxx>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> kernel/rcu/tree.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index ee5e595501e8..33020d84ec6b 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -1098,8 +1098,11 @@ noinstr bool __rcu_is_watching(void)
> * CPU can safely enter RCU read-side critical sections. In other words,
> * if the current CPU is not in its idle loop or is in an interrupt or
> * NMI handler, return true.
> + *
> + * Must be notrace because __ftrace_ops_list_func() / ftrace_ops_assist_func()
> + * will call this (for every function) outside of recursion protection.
> */
> -bool rcu_is_watching(void)
> +notrace bool rcu_is_watching(void)
> {
> bool ret;
>