On Sun, 28 Apr 2019 23:39:03 -0700
tip-bot for Peter Zijlstra <[email protected]> wrote:

> Commit-ID:  e8bd5814989b994cf1b0cb179e1c777e40c0f02c
> Gitweb:     
> https://git.kernel.org/tip/e8bd5814989b994cf1b0cb179e1c777e40c0f02c
> Author:     Peter Zijlstra <[email protected]>
> AuthorDate: Tue, 23 Apr 2019 22:03:18 +0200
> Committer:  Ingo Molnar <[email protected]>
> CommitDate: Mon, 29 Apr 2019 08:27:09 +0200
> 
> trace: Fix preempt_enable_no_resched() abuse

Hi Ingo,

I already sent this fix to Linus, and it's been pulled in to his tree.

Commit: d6097c9e4454adf1f8f2c9547c2fa6060d55d952

-- Steve

> 
> Unless there is a call into schedule() in the immediate
> (deterministic) future, one must not use preempt_enable_no_resched().
> It can cause a preemption to go missing and thereby cause arbitrary
> delays, breaking the PREEMPT=y invariant.
> 
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> Cc: Alexei Starovoitov <[email protected]>
> Cc: Daniel Borkmann <[email protected]>
> Cc: Davidlohr Bueso <[email protected]>
> Cc: Linus Torvalds <[email protected]>
> Cc: Roman Gushchin <[email protected]>
> Cc: Steven Rostedt <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Tim Chen <[email protected]>
> Cc: Waiman Long <[email protected]>
> Cc: Will Deacon <[email protected]>
> Cc: huang ying <[email protected]>
> Fixes: 2c2d7329d8af ("tracing/ftrace: use preempt_enable_no_resched_notrace 
> in ring_buffer_time_stamp()")
> Link: 
> https://lkml.kernel.org/r/[email protected]
> Signed-off-by: Ingo Molnar <[email protected]>
> ---
>  kernel/trace/ring_buffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 41b6f96e5366..4ee8d8aa3d0f 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -762,7 +762,7 @@ u64 ring_buffer_time_stamp(struct ring_buffer *buffer, 
> int cpu)
>  
>       preempt_disable_notrace();
>       time = rb_time_stamp(buffer);
> -     preempt_enable_no_resched_notrace();
> +     preempt_enable_notrace();
>  
>       return time;
>  }

Reply via email to