linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: 王贇 <yun.wang@linux.alibaba.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	open list <linux-kernel@vger.kernel.org>,
	Jiri Olsa <jolsa@redhat.com>
Subject: Re: [RESEND PATCH v2] trace: prevent preemption in perf_ftrace_function_call()
Date: Mon, 11 Oct 2021 10:48:27 +0200	[thread overview]
Message-ID: <YWP6W7Be0Yp6egsn@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YWP2rtX9Ol9dZc/l@hirez.programming.kicks-ass.net>

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.

  reply	other threads:[~2021-10-11  8:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28  3:12 [RESEND PATCH v2] trace: prevent preemption in perf_ftrace_function_call() 王贇
2021-10-09  0:03 ` Steven Rostedt
2021-10-11  2:38   ` 王贇
2021-10-11  8:32     ` Peter Zijlstra
2021-10-11  8:48       ` Peter Zijlstra [this message]
2021-10-11  9:39         ` 王贇
2021-10-11 14:45           ` Peter Zijlstra
2021-10-12  5:51             ` 王贇

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YWP6W7Be0Yp6egsn@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=yun.wang@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).