From: Crystal Wood <crwood@redhat.com>
To: Tomas Glozar <tglozar@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
John Kacur <jkacur@redhat.com>,
Luis Goncalves <lgoncalv@redhat.com>,
Costa Shulyupin <costa.shul@redhat.com>,
Wander Lairson Costa <wander@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-trace-kernel <linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH] rtla: Simplify osnoise tracer option setting code
Date: Tue, 18 Aug 2026 17:31:00 -0500 [thread overview]
Message-ID: <67895578a730d56a50568a7403ba4ef8f7b3e24a.camel@redhat.com> (raw)
In-Reply-To: <CAP4=nvRMAZ6AJ_WQPVM2sm9jH++4RwN8DhodU7oL6-AcXNg8OA@mail.gmail.com>
On Fri, 2026-07-03 at 14:11 +0200, Tomas Glozar wrote:
> pá 12. 6. 2026 v 19:55 Crystal Wood <crwood@redhat.com> napsala:
>
> > > OSNOISE_LL_OPTIONS takes three options: name - struct osnoise_context
> > > field name (written "<opt>" above), path - filename inside
> > > /sys/kernel/tracing/osnoise passed to libtracefs, and init_val - initial
> > > value of struct fields, corresponding to an otherwise invalid option
> > > (some options use OSNOISE_OPTION_INIT_VAL = -1, some use
> > > OSNOISE_TIME_INIT_VAL = 0).
> >
> > Can we simplify by always using -1? Especially since that's already
> > treated as the universal "invalid" by osnoise_read_ll_config().
> >
> > FWIW using "init val" to mean "invalid" rather than "default" is a bit
> > unintuitive.
> >
>
> The idea behind *_INIT_VAL is to re-use a value that is invalid on the
> osnoise tracer side to mean "not (read from tracer and) set yet (on
> the RTLA side)". OSNOISE_TIME_INIT_VAL is used for values where 0 is
> invalid (e.g. period, runtime), OSNOISE_OPTION_INIT_VAL is used for
> those where 0 is valid.
>
Right, it just hurts seeing something called "INIT_VAL" that isn't the
initial value. :-/
> > While we're at it, can we move this code to common.c, and drop
> > "osnoise" from the names, to move closer to using that only for the
> > actual osnoise mode?
> >
> > Or if we really want to namespace things that are specific to the
> > osnoise subsystem (i.e. everything implemented in trace_osnoise.c) but
> > not specific with respect to the osnoise/timerlat split, I'd suggest
> > something different like "osn_".
> >
>
> They are called "osnoise options" in the interface (although they are
> shared with the timerlat tracer), which cannot be changed. I don't
> like using an esoteric prefix like "osn".
I'm not suggesting changing the kernel interface, just having some
convention within rtla (and within trace_osnoise.c) to make it clearer
which things apply to osnoise-the-subsystem versus osnoise-the-specific-
tracer. It might be "esoteric" which one gets the abbreviation, but as
long as it's consistent I think it'd be an improvement over the current
jumble.
>
> > > + * Long long option get/set/restore/put functions, generated from OSNOISE_LL_OPTIONS.
> > > + */
> > > +#define OSNOISE_LL_OPTION(name, path, init_val) \
> > > +static long long \
> > > +osnoise_get_##name(struct osnoise_context *context) \
> > > +{ \
> > > + long long name; \
> > > + \
> > > + if (context->name != (init_val)) \
> > > + return context->name; \
> > > + \
> > > + if (context->orig_##name != (init_val)) \
> > > + return context->orig_##name; \
> > > + \
> > > + name = osnoise_read_ll_config(path); \
> > > + if (name < 0) \
> > > + return (init_val); \
> > > + \
> > > + context->orig_##name = name; \
> > > + return name; \
> > > +} \
> > > + \
> > > +int osnoise_set_##name(struct osnoise_context *context, long long name) \
> > > +{ \
> > > + long long curr = osnoise_get_##name(context); \
> > > + int retval; \
> > > + \
> > > + if (curr == (init_val)) \
> > > + return -1; \
> > > + \
> > > + retval = osnoise_write_ll_config(path, name); \
> > > + if (retval < 0) \
> > > + return -2; \
> > > + \
> > > + context->name = name; \
> > > + return 0; \
> > > +} \
> >
> > Using "name" for the value is confusing... "val" would be better.
> >
>
> But it's the *name* of the option/field/argument here, not the value.
> If you use "value" you'll get:
>
> #define OSNOISE_LL_OPTION(value, path, init_val)
>
> which is incorrect. Would making the macro options in capital letters
> (i.e. NAME) make it more clear?
That's not what I meant. I was suggesting this:
int osnoise_set_##name(struct osnoise_context *context, long long val)
-Crystal
next prev parent reply other threads:[~2026-08-18 22:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 11:51 Tomas Glozar
2026-06-12 17:54 ` Crystal Wood
2026-07-03 12:11 ` Tomas Glozar
2026-07-03 14:09 ` Tomas Glozar
2026-08-18 22:31 ` Crystal Wood [this message]
2026-09-04 9:03 ` Tomas Glozar
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=67895578a730d56a50568a7403ba4ef8f7b3e24a.camel@redhat.com \
--to=crwood@redhat.com \
--cc=costa.shul@redhat.com \
--cc=jkacur@redhat.com \
--cc=lgoncalv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglozar@redhat.com \
--cc=wander@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®