From: Steven Rostedt <rostedt@goodmis.org>
To: Wander Lairson Costa <wander@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Boqun Feng <boqun.feng@gmail.com>,
David Woodhouse <dwmw@amazon.co.uk>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org (open list),
linux-trace-kernel@vger.kernel.org (open list:TRACING),
Arnaldo Carvalho de Melo <acme@kernel.org>,
Clark Williams <williams@redhat.com>,
Gabriele Monaco <gmonaco@redhat.com>
Subject: Re: [PATCH 1/2] trace/preemptirq: reduce overhead of irq_enable/disable tracepoints
Date: Thu, 26 Jun 2025 19:08:54 -0400 [thread overview]
Message-ID: <20250626190854.34e45844@gandalf.local.home> (raw)
In-Reply-To: <20250626142017.26372-2-wander@redhat.com>
On Thu, 26 Jun 2025 11:20:09 -0300
Wander Lairson Costa <wander@redhat.com> wrote:
> @@ -197,9 +198,13 @@ extern void warn_bogus_irq_restore(void);
> */
> #ifdef CONFIG_TRACE_IRQFLAGS
>
> +DECLARE_TRACEPOINT(irq_enable);
> +DECLARE_TRACEPOINT(irq_disable);
> +
> #define local_irq_enable() \
> do { \
> - trace_hardirqs_on(); \
> + if (tracepoint_enabled(irq_enable)) \
> + trace_hardirqs_on(); \
If you have both this and lockdep enabled, then this has to be called
regardless if tracing is enabled or not. So this should be:
if (IS_ENABLED(CONFIG_PROVE_LOCKING) || \
tracepoint_enabled(irq_enable))
> raw_local_irq_enable(); \
> } while (0)
>
> @@ -207,28 +212,32 @@ extern void warn_bogus_irq_restore(void);
> do { \
> bool was_disabled = raw_irqs_disabled();\
> raw_local_irq_disable(); \
> - if (!was_disabled) \
> + if (tracepoint_enabled(irq_disable) && \
> + !was_disabled) \
And this should be:
if (IS_ENABLED(CONFIG_PROVE_LOCKING) || \
(tracepoint_enabled(irq_disable) && \
!was_disabled))
> trace_hardirqs_off(); \
> } while (0)
>
> #define local_irq_save(flags) \
> do { \
> raw_local_irq_save(flags); \
> - if (!raw_irqs_disabled_flags(flags)) \
> + if (tracepoint_enabled(irq_disable) && \
> + !raw_irqs_disabled_flags(flags)) \
> trace_hardirqs_off(); \
> } while (0)
>
> #define local_irq_restore(flags) \
> do { \
> - if (!raw_irqs_disabled_flags(flags)) \
> + if (tracepoint_enabled(irq_enable) && \
> + !raw_irqs_disabled_flags(flags)) \
> trace_hardirqs_on(); \
Same with these.
-- Steve
> raw_local_irq_restore(flags); \
> } while (0)
>
> -#define safe_halt() \
> - do { \
> - trace_hardirqs_on(); \
> - raw_safe_halt(); \
> +#define safe_halt() \
> + do { \
> + if (tracepoint_enabled(irq_enable)) \
> + trace_hardirqs_on(); \
> + raw_safe_halt(); \
> } while (0)
>
>
> diff --git a/kernel/trace/trace_preemptirq.c b/kernel/trace/trace_preemptirq.c
> index 0c42b15c3800..90ee65db4516 100644
> --- a/kernel/trace/trace_preemptirq.c
> +++ b/kernel/trace/trace_preemptirq.c
> @@ -111,6 +111,9 @@ void trace_hardirqs_off(void)
> }
> EXPORT_SYMBOL(trace_hardirqs_off);
> NOKPROBE_SYMBOL(trace_hardirqs_off);
> +
> +EXPORT_TRACEPOINT_SYMBOL(irq_disable);
> +EXPORT_TRACEPOINT_SYMBOL(irq_enable);
> #endif /* CONFIG_TRACE_IRQFLAGS */
>
> #ifdef CONFIG_TRACE_PREEMPT_TOGGLE
next prev parent reply other threads:[~2025-06-26 23:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 14:20 [PATCH 0/2] tracing/preemptirq: Optimize disabled tracepoint overhead Wander Lairson Costa
2025-06-26 14:20 ` [PATCH 1/2] trace/preemptirq: reduce overhead of irq_enable/disable tracepoints Wander Lairson Costa
2025-06-26 23:08 ` Steven Rostedt [this message]
2025-06-27 22:10 ` kernel test robot
2025-06-26 14:20 ` [PATCH 2/2] tracing/preemptirq: Optimize preempt_disable/enable() tracepoint overhead Wander Lairson Costa
2025-06-27 21:59 ` kernel test robot
2025-06-28 14:39 ` kernel test robot
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=20250626190854.34e45844@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=acme@kernel.org \
--cc=boqun.feng@gmail.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=dwmw@amazon.co.uk \
--cc=gmonaco@redhat.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mgorman@suse.de \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=wander@redhat.com \
--cc=williams@redhat.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
all inboxes | Powered by JetHome®