Re: [PATCH tip/core/rcu 06/10] trace: Eliminate cond_resched_rcu_qs() in favor of cond_resched()

From: Steven Rostedt
Date: Sat Feb 24 2018 - 15:12:50 EST


On Fri, 1 Dec 2017 11:21:40 -0800
"Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx> wrote:

> Now that cond_resched() also provides RCU quiescent states when
> needed, it can be used in place of cond_resched_rcu_qs(). This
> commit therefore makes this change.

Are you sure this is true?

I just bisected a lock up on my machine down to this commit.

With CONFIG_TRACEPOINT_BENCHMARK=y

# cd linux.git/tools/testing/selftests/ftrace/
# ./ftracetest test.d/ftrace/func_traceonoff_triggers.tc

Locks up with a backtrace of:

[ 614.186509] INFO: rcu_tasks detected stalls on tasks:
[ 614.192253] 000000005834f2a5: .. nvcsw: 2/2 holdout: 1 idle_cpu: -1/1
[ 614.199385] event_benchmark R running task 15264 1507 2 0x90000000
[ 614.207159] Call Trace:
[ 614.210335] ? trace_hardirqs_on_thunk+0x1a/0x1c
[ 614.215653] ? retint_kernel+0x2d/0x2d
[ 614.220101] ? ring_buffer_set_clock+0x10/0x10
[ 614.225232] ? benchmark_event_kthread+0x35/0x2d0
[ 614.230624] ? kthread+0x129/0x140
[ 614.234708] ? trace_benchmark_reg+0x80/0x80
[ 614.239646] ? kthread_create_worker_on_cpu+0x50/0x50
[ 614.245361] ? ret_from_fork+0x3a/0x50

The comment in the benchmark code that this commit affects is:

*
* Note the _rcu_qs() version of cond_resched() will
* notify synchronize_rcu_tasks() that this thread has
* passed a quiescent state for rcu_tasks. Otherwise
* this thread will never voluntarily schedule which would
* block synchronize_rcu_tasks() indefinitely.
*/
cond_resched();

Seems to me that cond_resched() isn't the same as cond_resched_rcu_qs().

-- Steve


>
> Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> ---
> kernel/trace/trace_benchmark.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_benchmark.c b/kernel/trace/trace_benchmark.c
> index 79f838a75077..22fee766081b 100644
> --- a/kernel/trace/trace_benchmark.c
> +++ b/kernel/trace/trace_benchmark.c
> @@ -165,7 +165,7 @@ static int benchmark_event_kthread(void *arg)
> * this thread will never voluntarily schedule which would
> * block synchronize_rcu_tasks() indefinitely.
> */
> - cond_resched_rcu_qs();
> + cond_resched();
> }
>
> return 0;
> -