From: Steven Rostedt <rostedt@goodmis.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] tracing: Account bottom half disabled sections.
Date: Fri, 10 Dec 2021 20:32:40 -0500 [thread overview]
Message-ID: <20211210203240.43a8e7eb@gandalf.local.home> (raw)
In-Reply-To: <YbO5H+H3dwLoIVka@linutronix.de>
On Fri, 10 Dec 2021 21:31:27 +0100
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> Disabling only bottom halves via local_bh_disable() disables also
> preemption but this remains invisible to tracing. On a CONFIG_PREEMPT
> kernel one might wonder why there is no scheduling happening despite the
> N flag in the trace. The reason might be the a rcu_read_lock_bh()
> section.
>
> Add a 'b' to the tracing output if in task context with disabled bottom
> halves.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> include/linux/trace_events.h | 1 +
> kernel/trace/trace.c | 6 ++++--
> kernel/trace/trace_output.c | 3 +++
> 3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
> index 2d167ac3452c5..a2af7e1156eac 100644
> --- a/include/linux/trace_events.h
> +++ b/include/linux/trace_events.h
> @@ -172,6 +172,7 @@ enum trace_flag_type {
> TRACE_FLAG_SOFTIRQ = 0x10,
> TRACE_FLAG_PREEMPT_RESCHED = 0x20,
> TRACE_FLAG_NMI = 0x40,
> + TRACE_FLAG_BH_OFF = 0x80,
> };
>
> #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 88de94da596b1..dca48d556ee5a 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -2601,6 +2601,8 @@ unsigned int tracing_gen_ctx_irq_test(unsigned int irqs_status)
> trace_flags |= TRACE_FLAG_HARDIRQ;
> if (in_serving_softirq())
> trace_flags |= TRACE_FLAG_SOFTIRQ;
> + if (softirq_count() >> (SOFTIRQ_SHIFT + 1))
> + trace_flags |= TRACE_FLAG_BH_OFF;
>
> if (tif_need_resched())
> trace_flags |= TRACE_FLAG_NEED_RESCHED;
> @@ -4185,7 +4187,7 @@ static void print_lat_help_header(struct seq_file *m)
> seq_puts(m, "# _------=> CPU# \n"
> "# / _-----=> irqs-off \n"
> "# | / _----=> need-resched \n"
> - "# || / _---=> hardirq/softirq \n"
> + "# || / _---=> hardirq/softirq/BH-disables\n"
> "# ||| / _--=> preempt-depth \n"
> "# |||| / _-=> migrate-disable \n"
> "# ||||| / delay \n"
> @@ -4226,7 +4228,7 @@ static void print_func_help_header_irq(struct array_buffer *buf, struct seq_file
>
> seq_printf(m, "# %.*s _-----=> irqs-off\n", prec, space);
> seq_printf(m, "# %.*s / _----=> need-resched\n", prec, space);
> - seq_printf(m, "# %.*s| / _---=> hardirq/softirq\n", prec, space);
> + seq_printf(m, "# %.*s| / _---=> hardirq/softirq/BH-disabled\n", prec, space);
So I went to update the documentation on this, and realized that this is
wrong. Really, we want this in the irqs-off section probably.
Note, the above is to show we are running in a hardirq or softirq context.
But BH-disabled does not match that. Should this be with irqs-off being:
d - irqs are disabled
b - BH is disabled?
D - irqs and BH is disabled?
-- Steve
> seq_printf(m, "# %.*s|| / _--=> preempt-depth\n", prec, space);
> seq_printf(m, "# %.*s||| / _-=> migrate-disable\n", prec, space);
> seq_printf(m, "# %.*s|||| / delay\n", prec, space);
> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> index 3547e7176ff79..6be644d35ec30 100644
next prev parent reply other threads:[~2021-12-11 1:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 20:31 [PATCH] tracing: Account bottom half disabled sections Sebastian Andrzej Siewior
2021-12-11 1:32 ` Steven Rostedt [this message]
2021-12-13 9:28 ` Sebastian Andrzej Siewior
2021-12-13 10:08 ` [PATCH v2] " 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=20211210203240.43a8e7eb@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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).