so 21. 3. 2026 v 17:08 odesÃlatel Costa Shulyupin
<[email protected]> napsal:
>
> On Fri, 20 Mar 2026 at 17:07, Tomas Glozar <[email protected]> wrote:
> >> +#define TIMERLAT_OPT_NANO OPT_CALLBACK('n', "nano", params, NULL, \
> > + "display data in nanoseconds", \
> > + opt_nano_cb)
>
> -n/--nano requires value incorrectly
>
Yes, this is a mistake.
> File: src/cli.c:463
> Cause: TIMERLAT_OPT_NANO used OPT_CALLBACK which expects an argument,
> but -n is a flag.
> Fix: Changed to OPT_CALLBACK_NOOPT:
>
> > + HIST_OPT_NO_IRQ,
> --no-irq clashes with auto-negation of --irq
>
> File: src/cli.c:1042
> Cause: libsubcmd auto-generates --no-X negations for every option.
> --no-irq (histogram boolean) collides with the auto-negation of --irq
> (stop threshold). The first match wins, so --irq was matched first and
> its negation intercepted the call.
> Fix: Moved HIST_OPT_NO_IRQ before RTLA_OPT_STOP('i', "irq", ...) in
> the options array so the explicit --no-irq boolean is found first.
>
Thank you for reporting that, I had no idea libsubcmd does this, I
haven't seen it documented anywhere, and I never used it in either
perf or bpftool.
It is a very strange thing to do for non-boolean options in my
opinion. If I understand the intention correctly, the option is
intended to unset another option specified before it, i.e. this:
$ ./rtla timerlat hist --event=timer --no-event
is supposed to behave the same as:
$ ./rtla timerlat hist
But it doesn't work:
$ ./rtla timerlat hist --event=timer --no-event
Usage: rtla timerlat hist [<options>]
perf fails even harder on this:
$ ./perf version
perf version 7.0.rc2.g61637af4f771
$ ./perf record --event=cycles --no-event
Segmentation fault (core dumped)
I'm thinking about modifying libsubcmd so this can be at least
disabled (not sure if the behavior is even intended in the non-boolean
case). Reshuffling the RTLA option array could work, too, but is
unintuitive from the developer's point of view, and will also force
histogram options to be before threshold options in the help message,
which is not what I wanted.
Tomas