public inbox for linux-kernel@vger.kernel.org
 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 16:45:10 +0200	[thread overview]
Message-ID: <20211011144510.GE174703@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <87aeef5b-c457-d4df-8abf-f9f035d73dbc@linux.alibaba.com>

On Mon, Oct 11, 2021 at 05:39:32PM +0800, 王贇 wrote:
> 
> 
> On 2021/10/11 下午4:48, Peter Zijlstra wrote:
> > 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.
> 
> I will use bit instead ret and give some testing :-)
> 
> BTW, would you prefer to merge these changes into this patch or maybe send
> another patch with your suggested-by?

Yeah, please send another patch; once you've confirmed it actually works
etc.. I did this before waking (as evidence per the above), who knows
what else I did wrong :-)

  reply	other threads:[~2021-10-11 14:47 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
2021-10-11  9:39         ` 王贇
2021-10-11 14:45           ` Peter Zijlstra [this message]
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=20211011144510.GE174703@worktop.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