Re: [PATCH v4 1/2] rtla: handle SIGTERM during a run
From: Tomas Glozar
Date: Fri Nov 27 2026 - 07:55:11 EST
On Sat, Nov 21, 2026 at 1:03 PM Chaosheng Qu
<chaosheng.qu.linux@xxxxxxxxx> wrote:
>
> rtla installs a handler for SIGINT, and for SIGALRM when a duration is
> given, but not for SIGTERM. A run stopped by the system - a shutdown or
> a service manager - therefore dies without going through the cleanup
> path and leaves its tracefs instance behind, so the next invocation
> finds the instance name in use.
>
In my experience, stopping via SIGTERM most commonly happens in
runtime tests when a test times out, as that is what the "timeout"
command uses.
> Install the same handler for SIGTERM, and restore the default
> disposition in unset_signals().
>
> Fixes: 2f3172f9dd58 ("tools/rtla: Consolidate code between osnoise/timerlat and hist/top")
What actually regressed is RTLA no longer resetting the thresholds
(osnoise_stop_us, osnoise_stop_total_us) before starting tracing -
which would otherwise protect RTLA from being affected from a stale
osnoise option (that can be set by someone else, not only by RTLA not
terminating cleanly on SIGTERM). That behavior was implemented by
commit 0122938a7ab49 ("rtla: Always set all tracer options"), but
commit c219d4ee1d6 ("rtla: Set stop threshold after all instances are
enabled") broke it, as it flips the threshold back too late (not
commit 2f3172f9dd58, as far as I understand).
So there are actually two bugs. Together, the fact that RTLA does not
restore settings upon SIGTERM (never implemented) or on start
(implemented but regressed) causes RTLA to misbehave with respect to
thresholds in multiple ways. I'm going to take your SIGTERM
improvement, without the Fixes tag, and send a separate fix for the
reset on start regression.
> Signed-off-by: Chaosheng Qu <chaosheng.qu.linux@xxxxxxxxx>
> ---
> tools/tracing/rtla/src/common.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> [cut]
Thanks,
Tomas