From: Peter Zijlstra <pet...@infradead.org> commit d6097c9e4454adf1f8f2c9547c2fa6060d55d952 upstream.
Unless the very next line is schedule(), or implies it, 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. Link: http://lkml.kernel.org/r/20190423200318.gy14...@hirez.programming.kicks-ass.net Cc: Waiman Long <long...@redhat.com> Cc: Linus Torvalds <torva...@linux-foundation.org> Cc: Ingo Molnar <mi...@redhat.com> Cc: Will Deacon <will.dea...@arm.com> Cc: Thomas Gleixner <t...@linutronix.de> Cc: the arch/x86 maintainers <x...@kernel.org> Cc: Davidlohr Bueso <d...@stgolabs.net> Cc: Tim Chen <tim.c.c...@linux.intel.com> Cc: huang ying <huang.ying.cari...@gmail.com> Cc: Roman Gushchin <g...@fb.com> Cc: Alexei Starovoitov <a...@kernel.org> Cc: Daniel Borkmann <dan...@iogearbox.net> Cc: sta...@vger.kernel.org Fixes: 2c2d7329d8af ("tracing/ftrace: use preempt_enable_no_resched_notrace in ring_buffer_time_stamp()") Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Steven Rostedt (VMware) <rost...@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> --- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -701,7 +701,7 @@ u64 ring_buffer_time_stamp(struct ring_b preempt_disable_notrace(); time = rb_time_stamp(buffer); - preempt_enable_no_resched_notrace(); + preempt_enable_notrace(); return time; }