From: Steven Rostedt <rostedt@goodmis.org>
To: Valentin Schneider <valentin.schneider@arm.com>
Cc: linux-kernel@vger.kernel.org,
"Abhijeet Dharmapurikar" <adharmap@quicinc.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@kernel.org>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Juri Lelli" <juri.lelli@redhat.com>,
"Daniel Bristot de Oliveira" <bristot@redhat.com>,
"Kees Cook" <keescook@chromium.org>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [RFC PATCH 1/2] sched/tracing: Don't re-read p->state when emitting sched_switch event
Date: Wed, 8 Dec 2021 15:12:03 -0500 [thread overview]
Message-ID: <20211208151203.2196088c@gandalf.local.home> (raw)
In-Reply-To: <20211129123601.2101873-2-valentin.schneider@arm.com>
On Mon, 29 Nov 2021 12:36:00 +0000
Valentin Schneider <valentin.schneider@arm.com> wrote:
> As of commit
>
> c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu")
>
> the following sequence becomes possible:
>
> p->__state = TASK_INTERRUPTIBLE;
> __schedule()
> deactivate_task(p);
> ttwu()
> READ !p->on_rq
> p->__state=TASK_WAKING
> trace_sched_switch()
> __trace_sched_switch_state()
> task_state_index()
> return 0;
>
> TASK_WAKING isn't in TASK_REPORT, so the task appears as TASK_RUNNING in
> the trace event.
>
> Prevent this by pushing the value read from __schedule() down the trace
> event.
>
> Reported-by: Abhijeet Dharmapurikar <adharmap@quicinc.com>
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> ---
> include/linux/sched.h | 11 ++++++++---
> include/trace/events/sched.h | 11 +++++++----
> kernel/sched/core.c | 4 ++--
> kernel/trace/fgraph.c | 4 +++-
> kernel/trace/ftrace.c | 4 +++-
> kernel/trace/trace_events.c | 8 ++++++--
> kernel/trace/trace_sched_switch.c | 1 +
I believe you may have missed some functions that register the sched_switch
event. Do a git grep on register_trace_sched_switch.
-- Steve
> 7 files changed, 30 insertions(+), 13 deletions(-)
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index d2e261adb8ea..d00837d12b9d 100644
next prev parent reply other threads:[~2021-12-08 20:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 12:35 [RFC PATCH 0/2] sched/tracing: sched_switch prev_state reported as TASK_RUNNING when it's not Valentin Schneider
2021-11-29 12:36 ` [RFC PATCH 1/2] sched/tracing: Don't re-read p->state when emitting sched_switch event Valentin Schneider
2021-12-08 20:12 ` Steven Rostedt [this message]
2021-12-09 13:02 ` Valentin Schneider
2021-11-29 12:36 ` [RFC PATCH 2/2] sched/tracing: Add TASK_RTLOCK_WAIT to TASK_REPORT Valentin Schneider
2021-12-08 20:34 ` Steven Rostedt
2022-01-14 10:11 ` Sebastian Andrzej Siewior
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=20211208151203.2196088c@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=adharmap@quicinc.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=bristot@redhat.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=u.kleine-koenig@pengutronix.de \
--cc=valentin.schneider@arm.com \
--cc=vincent.guittot@linaro.org \
/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).