public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: 王贇 <yun.wang@linux.alibaba.com>
Cc: Ingo Molnar <mingo@redhat.com>, open list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] trace: prevent preemption in perf_ftrace_function_call()
Date: Thu, 23 Sep 2021 23:26:19 -0400	[thread overview]
Message-ID: <20210923232619.50103473@oasis.local.home> (raw)
In-Reply-To: <7f4dfb4a-d271-b3c5-f603-06cc789ba9e9@linux.alibaba.com>

On Fri, 24 Sep 2021 10:08:10 +0800
王贇 <yun.wang@linux.alibaba.com> wrote:

> I found the rcu tree implementation of rcu_is_watching() will check
> this_cpu_ptr(&rcu_data.dynticks), and after that enable the preemption.
> 
> If preemption happened after that and before we disable here, there are
> still possibility that the CPU changed and make the dynticks checking
> invalid, isn't it?

If it can be scheduled, then RCU is definitely watching ;-)

The rcu_is_watching() is a safe guard for places that are in between
context switches. Not task context switches, but transitioning between
kernel and user space, or going into or out of idle, or transitioning
in and out of an interrupt.  There are small critical sections that RCU
is not watching, and we are actually working on making those locations
disable instrumentation (like tracing), where rcu_is_watching() will no
longer be needed.

-- Steve

  reply	other threads:[~2021-09-24  3:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23  3:42 [RFC PATCH] trace: prevent preemption in perf_ftrace_function_call() 王贇
2021-09-23  8:57 ` 王贇
2021-09-23 13:33 ` Steven Rostedt
2021-09-24  2:08   ` 王贇
2021-09-24  3:26     ` Steven Rostedt [this message]
2021-09-24  3:27       ` Steven Rostedt
2021-09-24  3:36       ` 王贇
2021-09-24  4:38 ` [PATCH v2] " 王贇

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=20210923232619.50103473@oasis.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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