Re: [PATCH] tracing: use ring_buffer_record_is_set_on() in tracer_tracing_is_on()

From: Sven Schnelle
Date: Tue Feb 06 2024 - 03:48:38 EST


Sven Schnelle <svens@xxxxxxxxxxxxx> writes:

> Looking at trace_save_cmdline():
>
> tpid = tsk->pid & (PID_MAX_DEFAULT - 1); where PID_MAX_DEFAULT = 0x8000
>
> so this is basically
>
> tpid = tsk->pid & 0x7fff;
>
> further on:
>
> // might clash with other pid if (otherpid & 0x7fff) == (tsk->pid & 0x7fff)
> idx = savedcmd->map_pid_to_cmdline[tpid];
> if (idx == NO_CMDLINE_MAP) {
> // This will pick an existing entry if there are
> // more than cmdline_num entries present
> idx = (savedcmd->cmdline_idx + 1) % savedcmd->cmdline_num;
> savedcmd->map_pid_to_cmdline[tpid] = idx;
> savedcmd->cmdline_idx = idx;
> }
>
> So i think the problem that sometimes '<...>' instead of the correct
> comm is logged is just expected behaviour given the code above.

I added some logging, and the test is not triggering this issue. So i
assume the default of 128 cmdline entries is just to small. Sorry for
the noise. Lets see whether we're still triggering some failures with
the other fix applied in CI. If we do, maybe we want to increase the
saved_cmdline_size for the ftrace test suite.