lkml.org 
[lkml]   [2021]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RESEND PATCH v2] trace: prevent preemption in perf_ftrace_function_call()
On Mon, Oct 11, 2021 at 10:32:46AM +0200, Peter Zijlstra wrote:
> diff --git a/include/linux/trace_recursion.h b/include/linux/trace_recursion.h
> index a9f9c5714e65..ca12e2d8e060 100644
> --- a/include/linux/trace_recursion.h
> +++ b/include/linux/trace_recursion.h
> @@ -214,7 +214,14 @@ static __always_inline void trace_clear_recursion(int bit)
> static __always_inline int ftrace_test_recursion_trylock(unsigned long ip,
> unsigned long parent_ip)
> {
> - return trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_START, TRACE_FTRACE_MAX);
> + bool ret;
> +
> + preempt_disable_notrace();
> + ret = trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_START, TRACE_FTRACE_MAX);
> + if (!ret)
> + preempt_enable_notrace();
> +
> + return ret;
> }
>
> /**

Oh, I might've gotten that wrong, I assumed regular trylock semantics,
but it doesn't look like that's right.

\
 
 \ /
  Last update: 2021-10-11 10:53    [W:0.252 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site