All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] tracing: Allow tracer to add more than 32 options
Date: Sat, 18 Oct 2025 00:01:30 +0900	[thread overview]
Message-ID: <20251018000130.aa69bd5b6670715b1c52d387@kernel.org> (raw)
In-Reply-To: <20251015172020.5966beaf@gandalf.local.home>

On Wed, 15 Oct 2025 17:20:20 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Tue, 30 Sep 2025 07:34:53 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> 
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -86,6 +86,11 @@ void __init disable_tracing_selftest(const char *reason)
> >  #define tracing_selftest_disabled	0
> >  #endif
> >  
> > +/* Define TRACE_ITER_* flags. */
> > +#undef C
> > +#define C(a, b) const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
> > +TRACE_FLAGS
> > +
> 
> 
> 
> >  #undef C
> > -#define C(a, b) TRACE_ITER_##a = (1 << TRACE_ITER_##a##_BIT)
> > +#define C(a, b) extern const u64 TRACE_ITER_##a;
> >  
> > -enum trace_iterator_flags { TRACE_FLAGS };
> > +TRACE_FLAGS
> > +#undef C
> 
> Why all this work when this could have been simply fixed with a:
> 
> -enum trace_iterator_flags { TRACE_FLAGS };
> +enum64 trace_iterator_flags { TRACE_FLAGS };
> 
>   ?

I could not find any other enum64 usage, so I doubt it is
available. (Does it depend on compiler?)
It seems C23 standard support it...

> 
> Not to mention, using const u64 requires saving these numbers in an address
> and referencing them, instead of doing it inlined in text. That is, using
> u64 instead of enum64 is both slower and wastes more memory.

Yeah, I expected that the compiler could easily optimize correctly, but
maybe not?

Thank you,

> 
> -- Steve
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2025-10-17 15:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29 22:34 [PATCH v3 0/2] tracing: Add an option to show symbols in _text+offset for function profiler Masami Hiramatsu (Google)
2025-09-29 22:34 ` [PATCH v3 1/2] tracing: Allow tracer to add more than 32 options Masami Hiramatsu (Google)
2025-10-15 21:20   ` Steven Rostedt
2025-10-17 15:01     ` Masami Hiramatsu [this message]
2025-10-19 17:46       ` Steven Rostedt
2025-10-17 15:50     ` Masami Hiramatsu
2025-09-29 22:35 ` [PATCH v3 2/2] tracing: Add an option to show symbols in _text+offset for function profiler Masami Hiramatsu (Google)

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=20251018000130.aa69bd5b6670715b1c52d387@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.