From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3A3F1E2614 for ; Thu, 20 Nov 2025 23:26:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681194; cv=none; b=jBcX61UA3Syxy8krwEzhXkb+x+hWxVRGFJGCajrg0Co+qZJXhahwYn4q4eM04wGf5zud5NphTxEfAJH048Zaq1hGCKQd+U9cdAibgaozPsX/c6NRsvYNAjm+dFDLJ+Z/PB9fcCTyvVa/6RKRyNxpPVXHneU1CKMFRXwkujViGyE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681194; c=relaxed/simple; bh=pulV9Ic/vDOAOBhu9dt7BiWM/6WwB651W9QEZP1S9Lc=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=X9/Cg0HTIIRQjoejw/73T4fO1E3RRZNQn4HwCrxminXp47FN7Hy3+n0jDwuAex+S3QQzaVUJKZPiDalC1IOgwDlYCis4DZsv0d03P1+4gyGbW0iDb+MrQ7RMls9sHhkN8MbbGY3g3umlcMyE1v4tTIZLtGs/Pe2aSQlYKOAcMNc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LUuqy4f6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LUuqy4f6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86EF5C4CEF1; Thu, 20 Nov 2025 23:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681194; bh=pulV9Ic/vDOAOBhu9dt7BiWM/6WwB651W9QEZP1S9Lc=; h=Date:From:To:Cc:Subject:References:From; b=LUuqy4f6yzkN865gwLOivE9oSNHCg0ELk2L3sgT0DuKq9OFneDr+oiMR65IB3S5Jl MRW6WMSeQqPhCgTzMCFOAJo/4KGlsLJEOBmAcH24TxRJJ9mo6ElYkkPhVVdAoiZkm7 +pW7KYiItPWpz3ssJwb9Eb5DmrwernfkvJoWaTc9I4Ku3gPX/ipv1NC7cDbgijc9y6 8YLLQtvpWqv3A8ljwKD7SkAWUssg/s4iruDCsCeyTyLNM7p0UL+dF87qtqkzH1Fzto JyZTrolJagnVyEU2eaAkTuT0eYedjDh9JE33FU4CbfDAqGJhq3+Z95wq+4rcMFHiIi LjQpNe5kQCfKg== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3P-000000041qj-2TOQ; Thu, 20 Nov 2025 18:27:07 -0500 Message-ID: <20251120232707.442753984@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:24 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Costa Shulyupin Subject: [for-next][PATCH 01/16] tools/rtla: Add for_each_monitored_cpu() helper References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Costa Shulyupin The rtla tools have many instances of iterating over CPUs while checking if they are monitored. Add a for_each_monitored_cpu() helper macro to make the code more readable and reduce code duplication. Signed-off-by: Costa Shulyupin Reviewed-by: Tomas Glozar Link: https://lore.kernel.org/r/20251002123553.389467-1-costa.shul@redhat.c= om Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/common.h | 4 ++++ tools/tracing/rtla/src/osnoise_hist.c | 28 ++++++---------------- tools/tracing/rtla/src/osnoise_top.c | 4 +--- tools/tracing/rtla/src/timerlat.c | 9 ++------ tools/tracing/rtla/src/timerlat_hist.c | 32 +++++++------------------- tools/tracing/rtla/src/timerlat_top.c | 4 +--- 6 files changed, 23 insertions(+), 58 deletions(-) diff --git a/tools/tracing/rtla/src/common.h b/tools/tracing/rtla/src/commo= n.h index 355f113a14a3..9ec2b7632c37 100644 --- a/tools/tracing/rtla/src/common.h +++ b/tools/tracing/rtla/src/common.h @@ -107,6 +107,10 @@ struct common_params { struct timerlat_u_params user; }; =20 +#define for_each_monitored_cpu(cpu, nr_cpus, common) \ + for (cpu =3D 0; cpu < nr_cpus; cpu++) \ + if (!(common)->cpus || CPU_ISSET(cpu, &(common)->monitored_cpus)) + struct tool_ops; =20 /* diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index dffb6d0a98d7..844f0468953c 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -247,9 +247,7 @@ static void osnoise_hist_header(struct osnoise_tool *to= ol) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -278,9 +276,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "count:"); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -292,9 +288,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "min: "); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -307,9 +301,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "avg: "); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -325,9 +317,7 @@ osnoise_print_summary(struct osnoise_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "max: "); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -362,9 +352,7 @@ osnoise_print_stats(struct osnoise_tool *tool) trace_seq_printf(trace->seq, "%-6d", bucket * data->bucket_size); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cp= us)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; @@ -400,9 +388,7 @@ osnoise_print_stats(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "over: "); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].count) continue; diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 95418f7ecc96..defa1eb63bee 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -243,9 +243,7 @@ osnoise_print_stats(struct osnoise_tool *top) =20 osnoise_top_header(top); =20 - for (i =3D 0; i < nr_cpus; i++) { - if (params->common.cpus && !CPU_ISSET(i, ¶ms->common.monitored_cpus)) - continue; + for_each_monitored_cpu(i, nr_cpus, ¶ms->common) { osnoise_top_print(top, i); } =20 diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/tim= erlat.c index b69212874127..28ea4f6710c1 100644 --- a/tools/tracing/rtla/src/timerlat.c +++ b/tools/tracing/rtla/src/timerlat.c @@ -126,9 +126,7 @@ int timerlat_enable(struct osnoise_tool *tool) =20 nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 - for (i =3D 0; i < nr_cpus; i++) { - if (params->common.cpus && !CPU_ISSET(i, ¶ms->common.monitored_cpus= )) - continue; + for_each_monitored_cpu(i, nr_cpus, ¶ms->common) { if (save_cpu_idle_disable_state(i) < 0) { err_msg("Could not save cpu idle state.\n"); return -1; @@ -221,10 +219,7 @@ void timerlat_free(struct osnoise_tool *tool) if (dma_latency_fd >=3D 0) close(dma_latency_fd); if (params->deepest_idle_state >=3D -1) { - for (i =3D 0; i < nr_cpus; i++) { - if (params->common.cpus && - !CPU_ISSET(i, ¶ms->common.monitored_cpus)) - continue; + for_each_monitored_cpu(i, nr_cpus, ¶ms->common) { restore_cpu_idle_disable_state(i); } } diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 606c1688057b..02d3ffd2cf4b 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -305,9 +305,7 @@ static void timerlat_hist_header(struct osnoise_tool *t= ool) if (!params->common.hist.no_index) trace_seq_printf(s, "Index"); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -359,9 +357,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "count:"); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -383,9 +379,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "min: "); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -413,9 +407,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "avg: "); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -443,9 +435,7 @@ timerlat_print_summary(struct timerlat_params *params, if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "max: "); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -490,9 +480,7 @@ timerlat_print_stats_all(struct timerlat_params *params, sum.min_thread =3D ~0; sum.min_user =3D ~0; =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -639,9 +627,7 @@ timerlat_print_stats(struct osnoise_tool *tool) trace_seq_printf(trace->seq, "%-6d", bucket * data->bucket_size); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cp= us)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; @@ -679,9 +665,7 @@ timerlat_print_stats(struct osnoise_tool *tool) if (!params->common.hist.no_index) trace_seq_printf(trace->seq, "over: "); =20 - for (cpu =3D 0; cpu < data->nr_cpus; cpu++) { - if (params->common.cpus && !CPU_ISSET(cpu, ¶ms->common.monitored_cpu= s)) - continue; + for_each_monitored_cpu(cpu, data->nr_cpus, ¶ms->common) { =20 if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count) continue; diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index fc479a0dcb59..607b57f2f231 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -459,9 +459,7 @@ timerlat_print_stats(struct osnoise_tool *top) =20 timerlat_top_header(params, top); =20 - for (i =3D 0; i < nr_cpus; i++) { - if (params->common.cpus && !CPU_ISSET(i, ¶ms->common.monitored_cpus)) - continue; + for_each_monitored_cpu(i, nr_cpus, ¶ms->common) { timerlat_top_print(top, i); timerlat_top_update_sum(top, i, &summary); } --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DA202FDC41 for ; Thu, 20 Nov 2025 23:26:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; cv=none; b=Jj5s1dLGUR+Q3MRfpYoQg871ATdG8SPjTMq19AShtl8FsxWn+RAIPYd7FRUqAv3V8iVl9/03rXxAB5Uu6U1YHqFCNEVcZQEH21c8xBGWWvlTCSbvLwp2pYtwQzVGfUFkTiMQixDxiVYSXjIrSfNB2/c7UxNguA87gJjmRJudEec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; c=relaxed/simple; bh=ZPmZU2v8Q39n0rqxWl1dh3Kdo500pQiMxI6cmDSvFQc=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=RaIptRF9oWXE9XTmL40SeC1d0IYdhBtA82bMWm93wbUDcKs1p1SzeBDjuAHswk7l16EMNHzMo3YlCRaGkAUYdWfEPy9Uq+UF66mD6p09UbtoXxfHkKS4mes8RTbgeZwdPhmu4+os4qAfmtbmIloZda0L46r4v+A9qtFnpgJorcA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jylGa+qY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jylGa+qY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACA66C116B1; Thu, 20 Nov 2025 23:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681194; bh=ZPmZU2v8Q39n0rqxWl1dh3Kdo500pQiMxI6cmDSvFQc=; h=Date:From:To:Cc:Subject:References:From; b=jylGa+qYBMse1pA4wjh7EiMpi2qrVEjz/uXuoK3fIti5He+COUvkQPzHEuj24zEGY CSLmQaK5NKsTfSJbxMy5UGm1l1beFS8/2pj/se55zlsOXnH/U3iXhqlpLjdOwhIOYC zbTEzfMu4qA48ybcf/QkYpzU+CYa+P8R3v64A0QM3QleYBFkFxfnHfeB190ns4uWYG LGcpIMqG6Qi8BMcKACj7Enwh/FAjwcoDr1REUOp71HBRgwJHkJ1kK80/Jjb7ipssZ3 l4IYMmYvJ7CUcRZFvgUmC6f1QB2j3mcRRfMt6aDclkYpXLkMY0zD/oX/GUWGHsZ1Bb nr+a5CZW999HQ== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3P-000000041rE-3DAV; Thu, 20 Nov 2025 18:27:07 -0500 Message-ID: <20251120232707.612143662@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:25 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Costa Shulyupin Subject: [for-next][PATCH 02/16] tools/rtla: Remove unused optional option_index References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Costa Shulyupin The longindex argument of getopt_long() is optional and tied to the unused local variable option_index. Remove it to shorten the four longest functions and make the code neater. Signed-off-by: Costa Shulyupin Reviewed-by: Tomas Glozar Link: https://lore.kernel.org/r/20251002123553.389467-2-costa.shul@redhat.c= om Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/osnoise_hist.c | 5 +---- tools/tracing/rtla/src/osnoise_top.c | 5 +---- tools/tracing/rtla/src/timerlat_hist.c | 5 +---- tools/tracing/rtla/src/timerlat_top.c | 5 +---- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index 844f0468953c..df0657b78980 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -524,11 +524,8 @@ static struct common_params {0, 0, 0, 0} }; =20 - /* getopt_long stores the option index here. */ - int option_index =3D 0; - c =3D getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5= :6:7:", - long_options, &option_index); + long_options, NULL); =20 /* detect the end of the options. */ if (c =3D=3D -1) diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index defa1eb63bee..1b5181e66b17 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -376,11 +376,8 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) {0, 0, 0, 0} }; =20 - /* getopt_long stores the option index here. */ - int option_index =3D 0; - c =3D getopt_long(argc, argv, "a:c:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:", - long_options, &option_index); + long_options, NULL); =20 /* Detect the end of the options. */ if (c =3D=3D -1) diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 02d3ffd2cf4b..c432ef5f59e7 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -840,11 +840,8 @@ static struct common_params {0, 0, 0, 0} }; =20 - /* getopt_long stores the option index here. */ - int option_index =3D 0; - c =3D getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU01234= 56:7:8:9\1\2:\3:", - long_options, &option_index); + long_options, NULL); =20 /* detect the end of the options. */ if (c =3D=3D -1) diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 607b57f2f231..82e227d27af7 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -604,11 +604,8 @@ static struct common_params {0, 0, 0, 0} }; =20 - /* getopt_long stores the option index here. */ - int option_index =3D 0; - c =3D getopt_long(argc, argv, "a:c:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:34= 5:6:7:", - long_options, &option_index); + long_options, NULL); =20 /* detect the end of the options. */ if (c =3D=3D -1) --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46DF2302160 for ; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; cv=none; b=hmxrQyArHidDLnaRqXKIZtvARCap8taghkc8cpo42A8QeQU6qdJr+XSLkfs3UWKlOYphEsa6iXrZRZDvnXiBsudUIlDEF/xxyWbTr6deDFT01clacefg5FNCz1bSyaVw6ti8hvfkwyHvHnHN6R89OVlgLWGe1Cb9GC1lYh0P7jM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; c=relaxed/simple; bh=pR/gGxXkX1Y2Do+LfR8TC6bX7B5ryL/CeDuNbLKj0tI=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=ADEJcWYEITk/i9PQJ1kbPNg9gJtHvagDckjN/enhjd9MxeVWU0ypBUgwOR+DoRix9b0lmAjNqU3T+lkT5kCYv5KFWR0Km2O+qd6M0oXl/CjkqV52OpNTHgSfLWVXzQ8R+jxUah9JlM1HuFtFiRGCvdgRLSrEtD1NNZ1dzT6dW7w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dY4kGmDN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dY4kGmDN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBD1CC4CEF1; Thu, 20 Nov 2025 23:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681195; bh=pR/gGxXkX1Y2Do+LfR8TC6bX7B5ryL/CeDuNbLKj0tI=; h=Date:From:To:Cc:Subject:References:From; b=dY4kGmDNsAxGaoNsEQWY7Zn6yKTFN6Le5ylesj/uM2ZWNRonY4qXUL6IL7tuhDQtE spmW1tsAKup7sWb9T6D7LYy+Xj9+7S8+oKsE0w74eF4/nWmOKx1i1cp1Aj9GBwvi52 VybG8S2MYQGSJb1hhJjn67LsnM1VziSZuvYxITIN3cwtatw7RySMRTYIYT7zjse9Bb vIqWHTKar2P5CR1xZT2Cr7pr5O7clhZt8XoFy7B7jcKR3pNFoxeltV83mNHUMkTTbt EdRAvlQhCDS/6sO0wl5ToMq+E9fkWOmc7DO2Cp7ZfkEp2z+x/vhnP+Z0LDTh85xk/z BQxJXnK7VG4og== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3P-000000041ri-3t26; Thu, 20 Nov 2025 18:27:07 -0500 Message-ID: <20251120232707.785326891@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:26 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Costa Shulyupin Subject: [for-next][PATCH 03/16] tools/rtla: Fix unassigned nr_cpus References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Costa Shulyupin In recently introduced timerlat_free(), the variable 'nr_cpus' is not assigned. Assign it with sysconf(_SC_NPROCESSORS_CONF) as done elsewhere. Remove the culprit: -Wno-maybe-uninitialized. The rest of the code is clean. Signed-off-by: Costa Shulyupin Reviewed-by: Tomas Glozar Fixes: 2f3172f9dd58 ("tools/rtla: Consolidate code between osnoise/timerlat= and hist/top") Link: https://lore.kernel.org/r/20251002170846.437888-1-costa.shul@redhat.c= om Signed-off-by: Tomas Glozar --- tools/tracing/rtla/Makefile.rtla | 2 +- tools/tracing/rtla/src/timerlat.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/tracing/rtla/Makefile.rtla b/tools/tracing/rtla/Makefile= .rtla index 08c1b40883d3..1743d91829d4 100644 --- a/tools/tracing/rtla/Makefile.rtla +++ b/tools/tracing/rtla/Makefile.rtla @@ -18,7 +18,7 @@ export CC AR STRIP PKG_CONFIG LD_SO_CONF_PATH LDCONFIG FOPTS :=3D -flto=3Dauto -ffat-lto-objects -fexceptions -fstack-protector-= strong \ -fasynchronous-unwind-tables -fstack-clash-protection WOPTS :=3D -O -Wall -Werror=3Dformat-security -Wp,-D_FORTIFY_SOURCE=3D2 \ - -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized + -Wp,-D_GLIBCXX_ASSERTIONS =20 ifeq ($(CC),clang) FOPTS :=3D $(filter-out -flto=3Dauto -ffat-lto-objects, $(FOPTS)) diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/tim= erlat.c index 28ea4f6710c1..df4f9bfe3433 100644 --- a/tools/tracing/rtla/src/timerlat.c +++ b/tools/tracing/rtla/src/timerlat.c @@ -213,7 +213,8 @@ void timerlat_analyze(struct osnoise_tool *tool, bool s= topped) void timerlat_free(struct osnoise_tool *tool) { struct timerlat_params *params =3D to_timerlat_params(tool->params); - int nr_cpus, i; + int nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); + int i; =20 timerlat_aa_destroy(); if (dma_latency_fd >=3D 0) --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46D7A30146D; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; cv=none; b=EvEoXcXd1/0Bp7mlX/JWWaPrOJF+RjYOv35GwAJXCEaTwswA/kOau8Iid8Twi+XtcTcYZEcbscWbgVqKwFmJh9ebiP/VBvRRTBbVSxbuHHKkfNmNyAcxl5NiYDEDTIonxc9iWWLHkkij60faFZsqOcydoo7lug1JF2IdYy7Vhh0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; c=relaxed/simple; bh=IzzXrKpnxD77S92ynC5y2Koa1yDERlcqMfRIHt5aWrc=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=hHuC+x5fNUD4ujWpoovLVICiHieL55Z8y0MLLsUgWpDK5kipP2IkmZ3aEppHDzzX8dINzaAZu8gBHtuKyNwpi/0iTzS5Dn33U5oEVO1iv3WGOtLL31E48xkjH2Fmzsl/SJ+dyNuDkau5bFrUO8NCW0562RApAg6NTVgP0JslzqM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JOz75Qbf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JOz75Qbf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05D30C19421; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681195; bh=IzzXrKpnxD77S92ynC5y2Koa1yDERlcqMfRIHt5aWrc=; h=Date:From:To:Cc:Subject:References:From; b=JOz75QbfYPf1lLjECkzgIr3HvHniReLyUTIUP5He64TV2YGPX9xIRFTHZBzxGLY0p CcIdrx2aYZXNwyH/qYTBBSkIUYrG1yEa47m4nP7Hohgz5jWIrQi1glDbicRL6bFaYo 3Nr2fpyc54YfZcECsJwBteFbbupy5Lhg2MqGSd+4nBL+Qm3F0eJkAebG1XB482dVNu uUl3Kj6lUw0DyeRpkqJYs1yjXO2CiDmBf90bPhivcEClB4yIU6mIABXBq88DJZuM2E LUO8zc8QC63730pkf30oSUE78gJe7NhYCPgHRvQKExXvav7ysn+zDqpWqIqJmQIuVt bQEgQsCnwFOqA== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3Q-000000041sC-0NxX; Thu, 20 Nov 2025 18:27:08 -0500 Message-ID: <20251120232707.946976394@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:27 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , stable@vger.kernel.org, Wander Lairson Costa Subject: [for-next][PATCH 04/16] rtla/timerlat_bpf: Stop tracing on user latency References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Tomas Glozar rtla-timerlat allows a *thread* latency threshold to be set via the -T/--thread option. However, the timerlat tracer calls this *total* latency (stop_tracing_total_us), and stops tracing also when the return-to-user latency is over the threshold. Change the behavior of the timerlat BPF program to reflect what the timerlat tracer is doing, to avoid discrepancy between stopping collecting data in the BPF program and stopping tracing in the timerlat tracer. Cc: stable@vger.kernel.org Fixes: e34293ddcebd ("rtla/timerlat: Add BPF skeleton to collect samples") Reviewed-by: Wander Lairson Costa Link: https://lore.kernel.org/r/20251006143100.137255-1-tglozar@redhat.com Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/timerlat.bpf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/tracing/rtla/src/timerlat.bpf.c b/tools/tracing/rtla/src= /timerlat.bpf.c index 084cd10c21fc..e2265b5d6491 100644 --- a/tools/tracing/rtla/src/timerlat.bpf.c +++ b/tools/tracing/rtla/src/timerlat.bpf.c @@ -148,6 +148,9 @@ int handle_timerlat_sample(struct trace_event_raw_timer= lat_sample *tp_args) } else { update_main_hist(&hist_user, bucket); update_summary(&summary_user, latency, bucket); + + if (thread_threshold !=3D 0 && latency_us >=3D thread_threshold) + set_stop_tracing(); } =20 return 0; --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AAA53081B9 for ; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; cv=none; b=sXYpXNy3qYX9ZfrGgl7f+Dkpr7uE2nvzPCi36CxKYWjD1ASOpu3xGRIjKpqbeMadTP6M6aofiLMfwbJMn++vLxExGeYzgrqu0wz1r0e+g5xSKNnkjUdSjNhW9Mwh75jqCHymVmO18HYvKMBRQApSdYEIZargzAcO7/NNFZNJV8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; c=relaxed/simple; bh=fdsgBvIVEL0aTh0qyOpz2FRua0VBeQKvgbztc9aawg0=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=YUCRYouh7uQUN4x6elO2yL9GwFW356wFsIErJahtVP7LmN2Hwfi9JHYzJN4w0ZT0zYu+qTKFdvC/HQxB5rRcGo5hRUTdS92ZOt55c+J2xSlMB9NfKUgsd6UfAwOufaGNty8g/90NArlcJlw2XSlWf75AfHfM94whgR630mzKbBU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jxbSS+1Y; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jxbSS+1Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41593C113D0; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681195; bh=fdsgBvIVEL0aTh0qyOpz2FRua0VBeQKvgbztc9aawg0=; h=Date:From:To:Cc:Subject:References:From; b=jxbSS+1Y/690y+7OfWRCDIni5tSehcsNFGJuZtdM6TCX29WskGSOrExTEGyTfNBns 8wbsPmAu8rN3KM2d6WUCa8YKXwZHoca+vgshl+R8XLisa6qbVSabCA+UjOHQDobvpF Hwr6wVo8scgVRP0DAnmTRzWUIQpGQCQk+P/TGr5LLuLX7MapL84byLApjVtWIgn66E x8pYLjJ87j5jfJJtU9LOekiSxxhjjIbI07L4x4nlO0r0DMaNeP9SbPRj9aRsJGUAxw RBCkRMaP74t1Ez4t28qTbeLNeIBNSjAYucXNiviz1/rXGhmqS1K1IG7wiYUvWcZQyB +m1bo0CGxUMEg== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3Q-000000041sg-14Pe; Thu, 20 Nov 2025 18:27:08 -0500 Message-ID: <20251120232708.109924545@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:28 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Crystal Wood , Wander Lairson Costa Subject: [for-next][PATCH 05/16] tools/rtla: Fix --on-threshold always triggering References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Tomas Glozar Commit 8d933d5c89e8 ("rtla/timerlat: Add continue action") moved the code performing on-threshold actions (enabled through --on-threshold option) to inside the RTLA main loop. The condition in the loop does not check whether the threshold was actually exceeded or if stop tracing was requested by the user through SIGINT or duration. This leads to a bug where on-threshold actions are always performed, even when the threshold was not hit. (BPF mode is not affected, since it uses a different condition in the while loop.) Add a condition that checks for !stop_tracing before executing the actions. Also, fix incorrect brackets in hist_main_loop to match the semantics of top_main_loop. Fixes: 8d933d5c89e8 ("rtla/timerlat: Add continue action") Fixes: 2f3172f9dd58 ("tools/rtla: Consolidate code between osnoise/timerlat= and hist/top") Reviewed-by: Crystal Wood Reviewed-by: Wander Lairson Costa Link: https://lore.kernel.org/r/20251007095341.186923-1-tglozar@redhat.com Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/common.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/commo= n.c index 2e6e3dac1897..b197037fc58b 100644 --- a/tools/tracing/rtla/src/common.c +++ b/tools/tracing/rtla/src/common.c @@ -268,6 +268,10 @@ int top_main_loop(struct osnoise_tool *tool) tool->ops->print_stats(tool); =20 if (osnoise_trace_is_off(tool, record)) { + if (stop_tracing) + /* stop tracing requested, do not perform actions */ + return 0; + actions_perform(¶ms->threshold_actions); =20 if (!params->threshold_actions.continue_flag) @@ -315,20 +319,22 @@ int hist_main_loop(struct osnoise_tool *tool) } =20 if (osnoise_trace_is_off(tool, tool->record)) { + if (stop_tracing) + /* stop tracing requested, do not perform actions */ + break; + actions_perform(¶ms->threshold_actions); =20 - if (!params->threshold_actions.continue_flag) { + if (!params->threshold_actions.continue_flag) /* continue flag not set, break */ break; =20 - /* continue action reached, re-enable tracing */ - if (tool->record) - trace_instance_start(&tool->record->trace); - if (tool->aa) - trace_instance_start(&tool->aa->trace); - trace_instance_start(&tool->trace); - } - break; + /* continue action reached, re-enable tracing */ + if (tool->record) + trace_instance_start(&tool->record->trace); + if (tool->aa) + trace_instance_start(&tool->aa->trace); + trace_instance_start(&tool->trace); } =20 /* is there still any user-threads ? */ --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AA293081A1 for ; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; cv=none; b=YlAJnsUWE4rnfVX3K5gPoeHzv9AlehnWmXrFHc9m3EcT/Cx2FBzsLvlJznD4SLc4vxsqm/lBzc4tEfedSGDUeZIG9BApyJ5sUzaYpW1zszTp3f0hr86IapZIjId2RjnP2AjxwHJ3o0gfQ2hstmrU28VdRgVGQBVTlU2zcqUOUts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; c=relaxed/simple; bh=s7XD0yiEzgz9Cw3XnWy2aO8u7Vltpi7RlbW/tIXPRZE=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Yz2aT+5sdlmVV8ffKK4W6B2ITTrodyzzyV4prcK/v0dzLAnAv8ArxN7DCy2dbv070W+gD3zZPbTRfdUV9EJz46dFKmLt2p4MmK1Hp4sXQlhCZmQHOBi5o5tjjDwhrv6IdHcQgbHtID79Urh6gZPoYFIkjHfmvdMLwKYTyxOlR4o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HWD13E1J; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HWD13E1J" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42BE8C4AF09; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681195; bh=s7XD0yiEzgz9Cw3XnWy2aO8u7Vltpi7RlbW/tIXPRZE=; h=Date:From:To:Cc:Subject:References:From; b=HWD13E1JRsPLpQcaDGu/j+kZSs8H7MDImxa6rRztthDXNfldOL6ry7hXFyI9/pVVK HuCWcPNAuyd1lS7pWNzFl16VXrWXA0+fmn9bJp7XHrAnKvCNb1ByALeFqVJ93g5fOi KVfrxqjXplHlbBd8s3y1MGqxyiG7FUvn2R2uQFkaRh8LRZychu55pHk3bM+9ppL0EU 8zWMgj4fDadrUPfSLR0P7PN9HaUh8wy2+wc6PtwSy7HWZzKvjGPyPnlSKAWUmF6Yec 1D15LDEB7ZvXCumLgk3LKfJaX7egKIThkCgLfO+Yy7FGM0Fpp2TMz8jVr6mjnoh1Wq MM8lpbgDxmM0w== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3Q-000000041tA-1mFG; Thu, 20 Nov 2025 18:27:08 -0500 Message-ID: <20251120232708.273880490@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:29 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Wander Lairson Costa Subject: [for-next][PATCH 06/16] rtla/tests: Extend action tests to 5s References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Tomas Glozar In non-BPF mode, it takes up to 1 second for RTLA to notice that tracing has been stopped. That means that action tests cannot have a 1 second duration, as the SIGALRM will be racing with the threshold overflow. Previously, non-BPF mode actions were buggy and always executed the action, even when stopping on duration or SIGINT, preventing this issue from manifesting. Now that this has been fixed, the tests have become flaky, and this has to be adjusted. Fixes: 4e26f84abfb ("rtla/tests: Add tests for actions") Fixes: 05b7e10687c ("tools/rtla: Add remaining support for osnoise actions") Reviewed-by: Wander Lairson Costa Link: https://lore.kernel.org/r/20251007095341.186923-2-tglozar@redhat.com Signed-off-by: Tomas Glozar --- tools/tracing/rtla/tests/osnoise.t | 4 ++-- tools/tracing/rtla/tests/timerlat.t | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/tracing/rtla/tests/osnoise.t b/tools/tracing/rtla/tests/= osnoise.t index e3c89d45a6bb..08196443fef1 100644 --- a/tools/tracing/rtla/tests/osnoise.t +++ b/tools/tracing/rtla/tests/osnoise.t @@ -39,9 +39,9 @@ check "hist stop at failed action" \ check "top stop at failed action" \ "timerlat top -T 2 --on-threshold shell,command=3D'echo -n abc; false' --= on-threshold shell,command=3D'echo -n defgh'" 2 "^abc" "defgh" check "hist with continue" \ - "osnoise hist -S 2 -d 1s --on-threshold shell,command=3D'echo TestOutput'= --on-threshold continue" 0 "^TestOutput$" + "osnoise hist -S 2 -d 5s --on-threshold shell,command=3D'echo TestOutput'= --on-threshold continue" 0 "^TestOutput$" check "top with continue" \ - "osnoise top -q -S 2 -d 1s --on-threshold shell,command=3D'echo TestOutpu= t' --on-threshold continue" 0 "^TestOutput$" + "osnoise top -q -S 2 -d 5s --on-threshold shell,command=3D'echo TestOutpu= t' --on-threshold continue" 0 "^TestOutput$" check "hist with trace output at end" \ "osnoise hist -d 1s --on-end trace" 0 "^ Saving trace to osnoise_trace.t= xt$" check "top with trace output at end" \ diff --git a/tools/tracing/rtla/tests/timerlat.t b/tools/tracing/rtla/tests= /timerlat.t index b5d1e7260a9b..b550a6ae2445 100644 --- a/tools/tracing/rtla/tests/timerlat.t +++ b/tools/tracing/rtla/tests/timerlat.t @@ -60,9 +60,9 @@ check "hist stop at failed action" \ check "top stop at failed action" \ "timerlat top -T 2 --on-threshold shell,command=3D'echo -n 1; false' --on= -threshold shell,command=3D'echo -n 2'" 2 "^1ALL" check "hist with continue" \ - "timerlat hist -T 2 -d 1s --on-threshold shell,command=3D'echo TestOutput= ' --on-threshold continue" 0 "^TestOutput$" + "timerlat hist -T 2 -d 5s --on-threshold shell,command=3D'echo TestOutput= ' --on-threshold continue" 0 "^TestOutput$" check "top with continue" \ - "timerlat top -q -T 2 -d 1s --on-threshold shell,command=3D'echo TestOutp= ut' --on-threshold continue" 0 "^TestOutput$" + "timerlat top -q -T 2 -d 5s --on-threshold shell,command=3D'echo TestOutp= ut' --on-threshold continue" 0 "^TestOutput$" check "hist with trace output at end" \ "timerlat hist -d 1s --on-end trace" 0 "^ Saving trace to timerlat_trace= .txt$" check "top with trace output at end" \ --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C104309DAB for ; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; cv=none; b=L5ohsy1jQFDvwdGFVNYcXLP/vG4//50TOkGIGQK6frb0V9zChvlU2LO7BUW1yjj+QEDXCvZrCWDyF0ifeXINLm/Kuc+L8p9Qimc7hYXvOe8rGigr7oDBJBLOL7PoecoGt4DRQFTO66ziZZZY5hZzB2dInCJxI4ewjhJldDGTxxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681195; c=relaxed/simple; bh=8eGhIKXNRUoV8uBdDIeypQ5Pd3mRS8xyiFSFP4Qae60=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=AtFmEjXvtEvrBvc2b01ygpqGc0JSXTjpkp2yLdcdRRdaBBafXMy8qUF84VL65OQsOdb7G7MHmrdnaqq1oDyEjFmtkydektJT8nutT+y8oI2eYwqmDcOfmvSU0qNGydKL++WzA8OkzZTRz7ECWu3uHIfe4h+sUX+IOW2jpfOFVeg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Bh288IyR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Bh288IyR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F24EC116B1; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681195; bh=8eGhIKXNRUoV8uBdDIeypQ5Pd3mRS8xyiFSFP4Qae60=; h=Date:From:To:Cc:Subject:References:From; b=Bh288IyRQsM4BRMbO74nVpvmVJ0eGUrOJYfccrr0mZl/AfskiKy+jeMytXsTxZ8YZ xQSAu52GG32LswqCE+WnKgbuXw8ECLYOrIygA6RhiOQOwyoOSBFiaB+nYU172Jk/cb 0u/GsLEl/+xku8Zlns68hAIQWdLuf8J4t5Lbph2hpzDnlCL2aqrYHpOFFAqSUiBju8 0cT8iAZmZow2K2jTJl95CTH6HVs5f8IDxvs3jFEjw3x8lLTJFBpcG6SZa9dD0RzYsF IIKA4E2qcs6WqBpXnhy3qz1pJA5IY3hyTyrz4SquL+gUxP9mEUZ0yLQ+7g4iz+Xs03 wDKXduVzzLQxA== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3Q-000000041te-2URx; Thu, 20 Nov 2025 18:27:08 -0500 Message-ID: <20251120232708.443295251@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:30 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Wander Lairson Costa Subject: [for-next][PATCH 07/16] rtla/tests: Fix osnoise test calling timerlat References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Tomas Glozar osnoise test "top stop at failed action" is calling timerlat instead of osnoise by mistake. Fix it so that it calls the correct RTLA subcommand. Fixes: 05b7e10687c ("tools/rtla: Add remaining support for osnoise actions") Reviewed-by: Wander Lairson Costa Link: https://lore.kernel.org/r/20251007095341.186923-3-tglozar@redhat.com Signed-off-by: Tomas Glozar --- tools/tracing/rtla/tests/osnoise.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tracing/rtla/tests/osnoise.t b/tools/tracing/rtla/tests/= osnoise.t index 08196443fef1..396334608920 100644 --- a/tools/tracing/rtla/tests/osnoise.t +++ b/tools/tracing/rtla/tests/osnoise.t @@ -37,7 +37,7 @@ check "multiple actions" \ check "hist stop at failed action" \ "osnoise hist -S 2 --on-threshold shell,command=3D'echo -n 1; false' --on= -threshold shell,command=3D'echo -n 2'" 2 "^1# RTLA osnoise histogram$" check "top stop at failed action" \ - "timerlat top -T 2 --on-threshold shell,command=3D'echo -n abc; false' --= on-threshold shell,command=3D'echo -n defgh'" 2 "^abc" "defgh" + "osnoise top -S 2 --on-threshold shell,command=3D'echo -n abc; false' --o= n-threshold shell,command=3D'echo -n defgh'" 2 "^abc" "defgh" check "hist with continue" \ "osnoise hist -S 2 -d 5s --on-threshold shell,command=3D'echo TestOutput'= --on-threshold continue" 0 "^TestOutput$" check "top with continue" \ --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41EE930DEDA for ; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; cv=none; b=kR2g3wGQIF3WZtrgwrDOCmPv1dYxW1hQ9lxk0Teztx1GKe1YTUTKaR6lkzZCySJLfjLJ3EnQj5mkH8DnmpTXa5bPcYTx/SdOLoxqGDGbPqeGs9ggSUHOFQwyPZ4KB2Yh5WvVbSlX5acBJBclfiIcVlD7VV3uVHGCjeW5dBpaD9U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; c=relaxed/simple; bh=l8YdlGSfYeDzi08psyKsFgI5OUrS901LyOtTIHZxdlw=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Ax7avqtbWtuva7bGMZajzcgWioL0DPmQfvuo0DOt3AMZ8VlQ/b5yyLFge0xRVKLRkhZ8MAcZUXu4x+C+T4/n9j8WCETDM5dHrKiFCO+6ynVJECsDYGjqPDY/mtn2BlBnCSf963uzSOzolGKKma1HMk0xgMqJlVv2MQQPvgX6d6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WmQ1nD7k; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WmQ1nD7k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A751BC113D0; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681195; bh=l8YdlGSfYeDzi08psyKsFgI5OUrS901LyOtTIHZxdlw=; h=Date:From:To:Cc:Subject:References:From; b=WmQ1nD7kJ/HaFnLaxmKEVByf9SwotfzEgzejI2zUqJPF7aS4Vgt8zqIA7q1Ldr1fA 3TGjLP2ZfT+JFb0ccq2fm0f/cdFWlTDHR8RKDoDAs9xKnNcjBJyUYlInK7T/amoowR 4we2zaA/ctZ8HrBDKUwo7j7dHY7wU8rw5O8Hcs2hUlpdCGIJDfeD+QLhAc6Bv1MZpT lmHh3/pZHmwfMSLJ5GYb2X0mJyC75PkUyX8hwkSSJ7OrPkC8MDQTZfAG97tTqTmXrI dyj+RHa9IpZzZ4X2xTgYyYQVN3NNhswCPQuEeQKnPK4+hBwxL+d2IHXykQmWEo8urU B5qbn2tW03tNQ== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3Q-000000041uA-3CVN; Thu, 20 Nov 2025 18:27:08 -0500 Message-ID: <20251120232708.614239181@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:31 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Costa Shulyupin Subject: [for-next][PATCH 08/16] tools/rtla: Add fatal() and replace error handling pattern References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Costa Shulyupin The code contains some technical debt in error handling, which complicates the consolidation of duplicated code. Introduce an fatal() function to replace the common pattern of err_msg() followed by exit(EXIT_FAILURE), reducing the length of an already long function. Further patches using fatal() follow. Signed-off-by: Costa Shulyupin Reviewed-by: Tomas Glozar Link: https://lore.kernel.org/r/20251011082738.173670-2-costa.shul@redhat.c= om Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/osnoise_hist.c | 42 ++++++++-------------- tools/tracing/rtla/src/osnoise_top.c | 42 ++++++++-------------- tools/tracing/rtla/src/timerlat_hist.c | 50 +++++++++----------------- tools/tracing/rtla/src/timerlat_top.c | 48 +++++++++---------------- tools/tracing/rtla/src/timerlat_u.c | 12 +++---- tools/tracing/rtla/src/utils.c | 15 ++++++++ tools/tracing/rtla/src/utils.h | 1 + 7 files changed, 81 insertions(+), 129 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index df0657b78980..d30a9a03b764 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -575,10 +575,8 @@ static struct common_params break; case 'e': tevent =3D trace_event_alloc(optarg); - if (!tevent) { - err_msg("Error alloc trace event"); - exit(EXIT_FAILURE); - } + if (!tevent) + fatal("Error alloc trace event"); =20 if (params->common.events) tevent->next =3D params->common.events; @@ -598,10 +596,8 @@ static struct common_params case 'H': params->common.hk_cpus =3D 1; retval =3D parse_cpu_set(optarg, ¶ms->common.hk_cpu_set); - if (retval) { - err_msg("Error parsing house keeping CPUs\n"); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error parsing house keeping CPUs"); break; case 'p': params->period =3D get_llong_from_str(optarg); @@ -654,10 +650,8 @@ static struct common_params case '4': /* trigger */ if (params->common.events) { retval =3D trace_event_add_trigger(params->common.events, optarg); - if (retval) { - err_msg("Error adding trigger %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error adding trigger %s", optarg); } else { osnoise_hist_usage("--trigger requires a previous -e\n"); } @@ -665,10 +659,8 @@ static struct common_params case '5': /* filter */ if (params->common.events) { retval =3D trace_event_add_filter(params->common.events, optarg); - if (retval) { - err_msg("Error adding filter %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error adding filter %s", optarg); } else { osnoise_hist_usage("--filter requires a previous -e\n"); } @@ -682,18 +674,14 @@ static struct common_params case '8': retval =3D actions_parse(¶ms->common.threshold_actions, optarg, "osnoise_trace.txt"); - if (retval) { - err_msg("Invalid action %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Invalid action %s", optarg); break; case '9': retval =3D actions_parse(¶ms->common.end_actions, optarg, "osnoise_trace.txt"); - if (retval) { - err_msg("Invalid action %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Invalid action %s", optarg); break; default: osnoise_hist_usage("Invalid option"); @@ -703,10 +691,8 @@ static struct common_params if (trace_output) actions_add_trace_output(¶ms->common.threshold_actions, trace_output= ); =20 - if (geteuid()) { - err_msg("rtla needs root permission\n"); - exit(EXIT_FAILURE); - } + if (geteuid()) + fatal("rtla needs root permission"); =20 if (params->common.hist.no_index && !params->common.hist.with_zeros) osnoise_hist_usage("no-index set and with-zeros not set - it does not ma= ke sense"); diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 1b5181e66b17..487daac8908c 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -421,10 +421,8 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) break; case 'e': tevent =3D trace_event_alloc(optarg); - if (!tevent) { - err_msg("Error alloc trace event"); - exit(EXIT_FAILURE); - } + if (!tevent) + fatal("Error alloc trace event"); =20 if (params->common.events) tevent->next =3D params->common.events; @@ -438,10 +436,8 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) case 'H': params->common.hk_cpus =3D 1; retval =3D parse_cpu_set(optarg, ¶ms->common.hk_cpu_set); - if (retval) { - err_msg("Error parsing house keeping CPUs\n"); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error parsing house keeping CPUs"); break; case 'p': params->period =3D get_llong_from_str(optarg); @@ -485,10 +481,8 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) case '0': /* trigger */ if (params->common.events) { retval =3D trace_event_add_trigger(params->common.events, optarg); - if (retval) { - err_msg("Error adding trigger %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error adding trigger %s", optarg); } else { osnoise_top_usage(params, "--trigger requires a previous -e\n"); } @@ -496,10 +490,8 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) case '1': /* filter */ if (params->common.events) { retval =3D trace_event_add_filter(params->common.events, optarg); - if (retval) { - err_msg("Error adding filter %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error adding filter %s", optarg); } else { osnoise_top_usage(params, "--filter requires a previous -e\n"); } @@ -513,18 +505,14 @@ struct common_params *osnoise_top_parse_args(int argc= , char **argv) case '4': retval =3D actions_parse(¶ms->common.threshold_actions, optarg, "osnoise_trace.txt"); - if (retval) { - err_msg("Invalid action %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Invalid action %s", optarg); break; case '5': retval =3D actions_parse(¶ms->common.end_actions, optarg, "osnoise_trace.txt"); - if (retval) { - err_msg("Invalid action %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Invalid action %s", optarg); break; default: osnoise_top_usage(params, "Invalid option"); @@ -534,10 +522,8 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) if (trace_output) actions_add_trace_output(¶ms->common.threshold_actions, trace_output= ); =20 - if (geteuid()) { - err_msg("osnoise needs root permission\n"); - exit(EXIT_FAILURE); - } + if (geteuid()) + fatal("osnoise needs root permission"); =20 return ¶ms->common; } diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index c432ef5f59e7..f98deb16b452 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -894,10 +894,8 @@ static struct common_params break; case 'e': tevent =3D trace_event_alloc(optarg); - if (!tevent) { - err_msg("Error alloc trace event"); - exit(EXIT_FAILURE); - } + if (!tevent) + fatal("Error alloc trace event"); =20 if (params->common.events) tevent->next =3D params->common.events; @@ -917,10 +915,8 @@ static struct common_params case 'H': params->common.hk_cpus =3D 1; retval =3D parse_cpu_set(optarg, ¶ms->common.hk_cpu_set); - if (retval) { - err_msg("Error parsing house keeping CPUs\n"); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error parsing house keeping CPUs"); break; case 'i': params->common.stop_us =3D get_llong_from_str(optarg); @@ -986,10 +982,8 @@ static struct common_params case '6': /* trigger */ if (params->common.events) { retval =3D trace_event_add_trigger(params->common.events, optarg); - if (retval) { - err_msg("Error adding trigger %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error adding trigger %s", optarg); } else { timerlat_hist_usage("--trigger requires a previous -e\n"); } @@ -997,20 +991,16 @@ static struct common_params case '7': /* filter */ if (params->common.events) { retval =3D trace_event_add_filter(params->common.events, optarg); - if (retval) { - err_msg("Error adding filter %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error adding filter %s", optarg); } else { timerlat_hist_usage("--filter requires a previous -e\n"); } break; case '8': params->dma_latency =3D get_llong_from_str(optarg); - if (params->dma_latency < 0 || params->dma_latency > 10000) { - err_msg("--dma-latency needs to be >=3D 0 and < 10000"); - exit(EXIT_FAILURE); - } + if (params->dma_latency < 0 || params->dma_latency > 10000) + fatal("--dma-latency needs to be >=3D 0 and < 10000"); break; case '9': params->no_aa =3D 1; @@ -1030,31 +1020,25 @@ static struct common_params case '\5': retval =3D actions_parse(¶ms->common.threshold_actions, optarg, "timerlat_trace.txt"); - if (retval) { - err_msg("Invalid action %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Invalid action %s", optarg); break; case '\6': retval =3D actions_parse(¶ms->common.end_actions, optarg, "timerlat_trace.txt"); - if (retval) { - err_msg("Invalid action %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Invalid action %s", optarg); break; default: - timerlat_hist_usage("Invalid option"); + fatal("Invalid option"); } } =20 if (trace_output) actions_add_trace_output(¶ms->common.threshold_actions, trace_output= ); =20 - if (geteuid()) { - err_msg("rtla needs root permission\n"); - exit(EXIT_FAILURE); - } + if (geteuid()) + fatal("rtla needs root permission"); =20 if (params->common.hist.no_irq && params->common.hist.no_thread) timerlat_hist_usage("no-irq and no-thread set, there is nothing to do he= re"); diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 82e227d27af7..9664b8af727e 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -666,10 +666,8 @@ static struct common_params break; case 'e': tevent =3D trace_event_alloc(optarg); - if (!tevent) { - err_msg("Error alloc trace event"); - exit(EXIT_FAILURE); - } + if (!tevent) + fatal("Error alloc trace event"); =20 if (params->common.events) tevent->next =3D params->common.events; @@ -682,10 +680,8 @@ static struct common_params case 'H': params->common.hk_cpus =3D 1; retval =3D parse_cpu_set(optarg, ¶ms->common.hk_cpu_set); - if (retval) { - err_msg("Error parsing house keeping CPUs\n"); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error parsing house keeping CPUs"); break; case 'i': params->common.stop_us =3D get_llong_from_str(optarg); @@ -736,10 +732,8 @@ static struct common_params case '0': /* trigger */ if (params->common.events) { retval =3D trace_event_add_trigger(params->common.events, optarg); - if (retval) { - err_msg("Error adding trigger %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error adding trigger %s", optarg); } else { timerlat_top_usage("--trigger requires a previous -e\n"); } @@ -747,20 +741,16 @@ static struct common_params case '1': /* filter */ if (params->common.events) { retval =3D trace_event_add_filter(params->common.events, optarg); - if (retval) { - err_msg("Error adding filter %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Error adding filter %s", optarg); } else { timerlat_top_usage("--filter requires a previous -e\n"); } break; case '2': /* dma-latency */ params->dma_latency =3D get_llong_from_str(optarg); - if (params->dma_latency < 0 || params->dma_latency > 10000) { - err_msg("--dma-latency needs to be >=3D 0 and < 10000"); - exit(EXIT_FAILURE); - } + if (params->dma_latency < 0 || params->dma_latency > 10000) + fatal("--dma-latency needs to be >=3D 0 and < 10000"); break; case '3': /* no-aa */ params->no_aa =3D 1; @@ -780,18 +770,14 @@ static struct common_params case '9': retval =3D actions_parse(¶ms->common.threshold_actions, optarg, "timerlat_trace.txt"); - if (retval) { - err_msg("Invalid action %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Invalid action %s", optarg); break; case '\1': retval =3D actions_parse(¶ms->common.end_actions, optarg, "timerlat_trace.txt"); - if (retval) { - err_msg("Invalid action %s\n", optarg); - exit(EXIT_FAILURE); - } + if (retval) + fatal("Invalid action %s", optarg); break; default: timerlat_top_usage("Invalid option"); @@ -801,10 +787,8 @@ static struct common_params if (trace_output) actions_add_trace_output(¶ms->common.threshold_actions, trace_output= ); =20 - if (geteuid()) { - err_msg("rtla needs root permission\n"); - exit(EXIT_FAILURE); - } + if (geteuid()) + fatal("rtla needs root permission"); =20 /* * Auto analysis only happens if stop tracing, thus: diff --git a/tools/tracing/rtla/src/timerlat_u.c b/tools/tracing/rtla/src/t= imerlat_u.c index 01dbf9a6b5a5..ce68e39d25fd 100644 --- a/tools/tracing/rtla/src/timerlat_u.c +++ b/tools/tracing/rtla/src/timerlat_u.c @@ -51,10 +51,8 @@ static int timerlat_u_main(int cpu, struct timerlat_u_pa= rams *params) =20 if (!params->sched_param) { retval =3D sched_setscheduler(0, SCHED_FIFO, &sp); - if (retval < 0) { - err_msg("Error setting timerlat u default priority: %s\n", strerror(err= no)); - exit(1); - } + if (retval < 0) + fatal("Error setting timerlat u default priority: %s", strerror(errno)); } else { retval =3D __set_sched_attr(getpid(), params->sched_param); if (retval) { @@ -78,10 +76,8 @@ static int timerlat_u_main(int cpu, struct timerlat_u_pa= rams *params) snprintf(buffer, sizeof(buffer), "osnoise/per_cpu/cpu%d/timerlat_fd", cpu= ); =20 timerlat_fd =3D tracefs_instance_file_open(NULL, buffer, O_RDONLY); - if (timerlat_fd < 0) { - err_msg("Error opening %s:%s\n", buffer, strerror(errno)); - exit(1); - } + if (timerlat_fd < 0) + fatal("Error opening %s:%s", buffer, strerror(errno)); =20 debug_msg("User-space timerlat pid %d on cpu %d\n", gettid(), cpu); =20 diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index d6ab15dcb490..54334c676a22 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -56,6 +56,21 @@ void debug_msg(const char *fmt, ...) fprintf(stderr, "%s", message); } =20 +/* + * fatal - print an error message and EOL to stderr and exit with ERROR + */ +void fatal(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + + exit(ERROR); +} + /* * get_llong_from_str - get a long long int from a string */ diff --git a/tools/tracing/rtla/src/utils.h b/tools/tracing/rtla/src/utils.h index a2a6f89f342d..1be095f9a7e6 100644 --- a/tools/tracing/rtla/src/utils.h +++ b/tools/tracing/rtla/src/utils.h @@ -19,6 +19,7 @@ extern int config_debug; void debug_msg(const char *fmt, ...); void err_msg(const char *fmt, ...); +void fatal(const char *fmt, ...); =20 long parse_seconds_duration(char *val); void get_duration(time_t start_time, char *output, int output_size); --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41E5D30DECB for ; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; cv=none; b=UscOCpUwlUfYVfyMAAMqd9ahAbMzVtajQHarSaqym9A3SEHI4zP/eNUZXyAmYFwERkbCIj5gbkmJed2HsBN12aNOsFKkOWoRuE9lWzl3EEj+CgOZCfMv5Mz5lczdmnZhilXVParoB8pmTPb2Z/hjeWWJAxBHQv3gRqjpRCr3MOw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; c=relaxed/simple; bh=thFEurTXI3V1gaKSo3B2txiSZow/SCmi7/SuHebeojo=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=BGTwjaQcyleEFhk5aJwgJ0leXe3Cj8seWQPJoGHgZM8Wc86kxuQ+1DphaxXV0Gat94QqGjZVGjdW4xyZ60rTCAxWNiPRbY2cNy68Sej6iNREQvYTs1to9t7K8Gst3tME9pglI/kzAQIT75RenmiZSnwL1ElrBsajbjYQhnpv48M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CRLac8F6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CRLac8F6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCF32C4CEF1; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681195; bh=thFEurTXI3V1gaKSo3B2txiSZow/SCmi7/SuHebeojo=; h=Date:From:To:Cc:Subject:References:From; b=CRLac8F6YnqvGb8PKR0rx0VksYQGobItEf/yHiygQsjvt9bgxIOSYa8YIunwaumGV kONKCTvJX0UkW37X/D3UzesJk7sfxQRj8/dE9nQkxZ+6RHkGKa61KG7mylbD9/jInV SxSTtBEsg0RvljtbBgV2VpZSKiWp3liQ4Qa0VArzVGGMiIVkeOJB+1P/5gepU6tpnH g0xkRZclYMoTTts/HMnqWkeO/8qFqOY4nyoZIFmrIdJoXCkYx6r4yTu+wGUIFlaPeg 3vnZFsFE8+m0csBPLkE98wTKyAFXI5lIpzw3abcgy6BDE19ZIQ3tyCR493HPmTatlU YvT6awqi+YyBw== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3Q-000000041uf-3u1e; Thu, 20 Nov 2025 18:27:08 -0500 Message-ID: <20251120232708.782719439@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:32 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Costa Shulyupin Subject: [for-next][PATCH 09/16] tools/rtla: Replace timerlat_top_usage("...") with fatal("...") References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Costa Shulyupin A long time ago, when the usage help was short, it was a favor to the user to show it on error. Now that the usage help has become very long, it is too noisy to dump the complete help text for each typo after the error message itself. Replace timerlat_top_usage("...\n") with fatal("...") on errors. Remove the already unused 'usage' argument from timerlat_top_usage(). Signed-off-by: Costa Shulyupin Reviewed-by: Tomas Glozar Link: https://lore.kernel.org/r/20251011082738.173670-3-costa.shul@redhat.c= om Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/timerlat_top.c | 28 +++++++++++---------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 9664b8af727e..67a5b6ab78a6 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -474,7 +474,7 @@ timerlat_print_stats(struct osnoise_tool *top) /* * timerlat_top_usage - prints timerlat top usage message */ -static void timerlat_top_usage(char *usage) +static void timerlat_top_usage(void) { int i; =20 @@ -522,18 +522,12 @@ static void timerlat_top_usage(char *usage) NULL, }; =20 - if (usage) - fprintf(stderr, "%s\n", usage); - fprintf(stderr, "rtla timerlat top: a per-cpu summary of the timer latenc= y (version %s)\n", VERSION); =20 for (i =3D 0; msg[i]; i++) fprintf(stderr, "%s\n", msg[i]); =20 - if (usage) - exit(EXIT_FAILURE); - exit(EXIT_SUCCESS); } =20 @@ -643,7 +637,7 @@ static struct common_params case 'c': retval =3D parse_cpu_set(optarg, ¶ms->common.monitored_cpus); if (retval) - timerlat_top_usage("\nInvalid -c cpu list\n"); + fatal("Invalid -c cpu list"); params->common.cpus =3D optarg; break; case 'C': @@ -662,7 +656,7 @@ static struct common_params case 'd': params->common.duration =3D parse_seconds_duration(optarg); if (!params->common.duration) - timerlat_top_usage("Invalid -d duration\n"); + fatal("Invalid -d duration"); break; case 'e': tevent =3D trace_event_alloc(optarg); @@ -675,7 +669,7 @@ static struct common_params break; case 'h': case '?': - timerlat_top_usage(NULL); + timerlat_top_usage(); break; case 'H': params->common.hk_cpus =3D 1; @@ -695,12 +689,12 @@ static struct common_params case 'p': params->timerlat_period_us =3D get_llong_from_str(optarg); if (params->timerlat_period_us > 1000000) - timerlat_top_usage("Period longer than 1 s\n"); + fatal("Period longer than 1 s"); break; case 'P': retval =3D parse_prio(optarg, ¶ms->common.sched_param); if (retval =3D=3D -1) - timerlat_top_usage("Invalid -P priority"); + fatal("Invalid -P priority"); params->common.set_sched =3D 1; break; case 'q': @@ -735,7 +729,7 @@ static struct common_params if (retval) fatal("Error adding trigger %s", optarg); } else { - timerlat_top_usage("--trigger requires a previous -e\n"); + fatal("--trigger requires a previous -e"); } break; case '1': /* filter */ @@ -744,7 +738,7 @@ static struct common_params if (retval) fatal("Error adding filter %s", optarg); } else { - timerlat_top_usage("--filter requires a previous -e\n"); + fatal("--filter requires a previous -e"); } break; case '2': /* dma-latency */ @@ -780,7 +774,7 @@ static struct common_params fatal("Invalid action %s", optarg); break; default: - timerlat_top_usage("Invalid option"); + fatal("Invalid option"); } } =20 @@ -797,10 +791,10 @@ static struct common_params params->no_aa =3D 1; =20 if (params->no_aa && params->common.aa_only) - timerlat_top_usage("--no-aa and --aa-only are mutually exclusive!"); + fatal("--no-aa and --aa-only are mutually exclusive!"); =20 if (params->common.kernel_workload && params->common.user_workload) - timerlat_top_usage("--kernel-threads and --user-threads are mutually exc= lusive!"); + fatal("--kernel-threads and --user-threads are mutually exclusive!"); =20 /* * If auto-analysis or trace output is enabled, switch from BPF mode to --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5529930E0FA for ; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; cv=none; b=tbWIG+1Z/c9YDGWESEMHHEmUeQ+KV5EiHQ589QWBN9u+2tMCEbqH1DT2h6RWc+pKAPO9rNMSRpXoVPwDtuHF3jIeQUMgwRlUfugEknVETgBANYjZcVLy79Zi2ZxZeg2YatoTOnX+VjEfxmkHMI4vPfJ+BaRIcPJwWbXFS9nc3Z8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; c=relaxed/simple; bh=qZA3sqcF49+mmt4svzGC8rVGlQvokHq4EJY1K09BjSU=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=k0ytdePCpfD7T5GnHbbrKzaF8f/ZhTTC9+viUEsw9VZfh70viMBg9u8Phd4NRKO3H+uDpBo10bAvemVSEALPuffvVm2Nctl8Agn8iLjJUpLlK0qDII8Az5KRHEy+jG3eN8bfXubF5EAClNgV19G7rw68D6V6kYNeCmBU34MVAlY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Fu8GpOTm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Fu8GpOTm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9A4CC116B1; Thu, 20 Nov 2025 23:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681195; bh=qZA3sqcF49+mmt4svzGC8rVGlQvokHq4EJY1K09BjSU=; h=Date:From:To:Cc:Subject:References:From; b=Fu8GpOTmvzUOTa0HYdVfouQV8vOS2emct7fFQtK44BA2bAUynF1l59wtQGwq4Git6 UgLdYHAzAPaegNsdeNCqePV/A4iek5o1pi9DeUCURiaDa5v7PW6aJvfFwS8jol8x0k tpjmmKv1wRV72dtWIyDVimImfJhp53u9Sy+skDvS5NgmDyy5fljC7Gc7ey4VXFZhK2 osXYFLTgsIMdLlcQB/mEHdIshGKtaXUeGvDQWxrnViZL2grjN6Ec+V3QUalPgf3s3J /8yI4eDXiygDS/G8otfWKSX1VcczOd9aiCGGerCb/eoo8rCglbhmUOG/RoOExPpg+g EqSQEGdm2nWaA== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3R-000000041vA-0OgC; Thu, 20 Nov 2025 18:27:09 -0500 Message-ID: <20251120232708.950141984@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:33 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Costa Shulyupin Subject: [for-next][PATCH 10/16] tools/rtla: Replace timerlat_hist_usage("...") with fatal("...") References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Costa Shulyupin A long time ago, when the usage help was short, it was a favor to the user to show it on error. Now that the usage help has become very long, it is too noisy to dump the complete help text for each typo after the error message itself. Replace timerlat_hist_usage("...\n") with fatal("...") on errors. Remove the already unused 'usage' argument from timerlat_hist_usage(). Signed-off-by: Costa Shulyupin Reviewed-by: Tomas Glozar Link: https://lore.kernel.org/r/20251011082738.173670-4-costa.shul@redhat.c= om Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/timerlat_hist.c | 32 +++++++++++--------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index f98deb16b452..1b505531ad3b 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -694,7 +694,7 @@ timerlat_print_stats(struct osnoise_tool *tool) /* * timerlat_hist_usage - prints timerlat top usage message */ -static void timerlat_hist_usage(char *usage) +static void timerlat_hist_usage(void) { int i; =20 @@ -750,18 +750,12 @@ static void timerlat_hist_usage(char *usage) NULL, }; =20 - if (usage) - fprintf(stderr, "%s\n", usage); - fprintf(stderr, "rtla timerlat hist: a per-cpu histogram of the timer lat= ency (version %s)\n", VERSION); =20 for (i =3D 0; msg[i]; i++) fprintf(stderr, "%s\n", msg[i]); =20 - if (usage) - exit(EXIT_FAILURE); - exit(EXIT_SUCCESS); } =20 @@ -865,7 +859,7 @@ static struct common_params case 'c': retval =3D parse_cpu_set(optarg, ¶ms->common.monitored_cpus); if (retval) - timerlat_hist_usage("\nInvalid -c cpu list\n"); + fatal("Invalid -c cpu list"); params->common.cpus =3D optarg; break; case 'C': @@ -882,7 +876,7 @@ static struct common_params params->common.hist.bucket_size =3D get_llong_from_str(optarg); if (params->common.hist.bucket_size =3D=3D 0 || params->common.hist.bucket_size >=3D 1000000) - timerlat_hist_usage("Bucket size needs to be > 0 and <=3D 1000000\n"); + fatal("Bucket size needs to be > 0 and <=3D 1000000"); break; case 'D': config_debug =3D 1; @@ -890,7 +884,7 @@ static struct common_params case 'd': params->common.duration =3D parse_seconds_duration(optarg); if (!params->common.duration) - timerlat_hist_usage("Invalid -D duration\n"); + fatal("Invalid -D duration"); break; case 'e': tevent =3D trace_event_alloc(optarg); @@ -906,11 +900,11 @@ static struct common_params params->common.hist.entries =3D get_llong_from_str(optarg); if (params->common.hist.entries < 10 || params->common.hist.entries > 9999999) - timerlat_hist_usage("Entries must be > 10 and < 9999999\n"); + fatal("Entries must be > 10 and < 9999999"); break; case 'h': case '?': - timerlat_hist_usage(NULL); + timerlat_hist_usage(); break; case 'H': params->common.hk_cpus =3D 1; @@ -930,12 +924,12 @@ static struct common_params case 'p': params->timerlat_period_us =3D get_llong_from_str(optarg); if (params->timerlat_period_us > 1000000) - timerlat_hist_usage("Period longer than 1 s\n"); + fatal("Period longer than 1 s"); break; case 'P': retval =3D parse_prio(optarg, ¶ms->common.sched_param); if (retval =3D=3D -1) - timerlat_hist_usage("Invalid -P priority"); + fatal("Invalid -P priority"); params->common.set_sched =3D 1; break; case 's': @@ -985,7 +979,7 @@ static struct common_params if (retval) fatal("Error adding trigger %s", optarg); } else { - timerlat_hist_usage("--trigger requires a previous -e\n"); + fatal("--trigger requires a previous -e"); } break; case '7': /* filter */ @@ -994,7 +988,7 @@ static struct common_params if (retval) fatal("Error adding filter %s", optarg); } else { - timerlat_hist_usage("--filter requires a previous -e\n"); + fatal("--filter requires a previous -e"); } break; case '8': @@ -1041,10 +1035,10 @@ static struct common_params fatal("rtla needs root permission"); =20 if (params->common.hist.no_irq && params->common.hist.no_thread) - timerlat_hist_usage("no-irq and no-thread set, there is nothing to do he= re"); + fatal("no-irq and no-thread set, there is nothing to do here"); =20 if (params->common.hist.no_index && !params->common.hist.with_zeros) - timerlat_hist_usage("no-index set with with-zeros is not set - it does n= ot make sense"); + fatal("no-index set with with-zeros is not set - it does not make sense"= ); =20 /* * Auto analysis only happens if stop tracing, thus: @@ -1053,7 +1047,7 @@ static struct common_params params->no_aa =3D 1; =20 if (params->common.kernel_workload && params->common.user_workload) - timerlat_hist_usage("--kernel-threads and --user-threads are mutually ex= clusive!"); + fatal("--kernel-threads and --user-threads are mutually exclusive!"); =20 /* * If auto-analysis or trace output is enabled, switch from BPF mode to --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F5F230E0F2 for ; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; cv=none; b=DAFnEQR1ab1RHXc4xTJ6yScI8k6Z6m5xr+2RDrw4uY5+qvhiUmVg9+OOgy5FGG254ghFL5dVBEsbGy3AG64E77BcjffcQALHh0lvBs9ZnprTwzVhhzTuyWu+3uZpsrXb+hKps0EvtqhG6o//71QMuPFwCTkNoAPUafszE0d/Eu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; c=relaxed/simple; bh=XfvBng7ontzsxvqGcwXtl01KHWualoUe1o62QFRNRCk=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=ZH1eng7eH8pASGHYv25SlZbaZcq76KtCxJxtWSxDshSZjRQfAp3G32vj6pi7zGagzBtsaIJjXtfhS/ZHTZ/8MTcAU1IAgV4/holvOlZ+fh+NELPWFFWMQzxr6fqyd/tX0vHUGMwB60MnYKUcXOJts0wuEijjWHZD0jmJ7VbMhxM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cOfQDHSC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cOfQDHSC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F4C4C116C6; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681196; bh=XfvBng7ontzsxvqGcwXtl01KHWualoUe1o62QFRNRCk=; h=Date:From:To:Cc:Subject:References:From; b=cOfQDHSCGPCjjj26plCo0W1I3hfTgROQhW+4IE772seJUyPiub9KucNCpe2Yu2JHM e5g+Poo7vZMYoSpfeKgsuvkQxI38R/ZyfD2yog+VOU1RaT9jkqgzwpmIb7tO5PCn8I nge010/XxhWod+WHGs7Y6YB1kp0UlJv6R0/kui9E/3aQHCQ9Wj65dSybcSCznbYGpz Xm698TftGaR1atClPhFhDIjaGq9wZ1PjkBoJio2d45xXxIQUM3Bq0kAT+65ceCWoMh eV9eEuWqd7deQRC4ypl/C26HhrUgigBqR5rik6hTzBFfaFP6Vvrfg51fp7ed/SWktl 6Lml/yxKcb8og== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3R-000000041vf-17LJ; Thu, 20 Nov 2025 18:27:09 -0500 Message-ID: <20251120232709.115021875@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:34 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Costa Shulyupin Subject: [for-next][PATCH 11/16] tools/rtla: Replace osnoise_top_usage("...") with fatal("...") References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Costa Shulyupin A long time ago, when the usage help was short, it was a favor to the user to show it on error. Now that the usage help has become very long, it is too noisy to dump the complete help text for each typo after the error message itself. Replace osnoise_top_usage("...") with fatal("...") on errors. Remove the already unused 'usage' argument from osnoise_top_usage(). Signed-off-by: Costa Shulyupin Reviewed-by: Tomas Glozar Link: https://lore.kernel.org/r/20251011082738.173670-5-costa.shul@redhat.c= om Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/osnoise_top.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 487daac8908c..de8e26d7c68b 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -255,7 +255,7 @@ osnoise_print_stats(struct osnoise_tool *top) /* * osnoise_top_usage - prints osnoise top usage message */ -static void osnoise_top_usage(struct osnoise_params *params, char *usage) +static void osnoise_top_usage(struct osnoise_params *params) { int i; =20 @@ -294,9 +294,6 @@ static void osnoise_top_usage(struct osnoise_params *pa= rams, char *usage) NULL, }; =20 - if (usage) - fprintf(stderr, "%s\n", usage); - if (params->mode =3D=3D MODE_OSNOISE) { fprintf(stderr, "rtla osnoise top: a per-cpu summary of the OS noise (version %s)\n", @@ -316,9 +313,6 @@ static void osnoise_top_usage(struct osnoise_params *pa= rams, char *usage) for (i =3D 0; msg[i]; i++) fprintf(stderr, "%s\n", msg[i]); =20 - if (usage) - exit(EXIT_FAILURE); - exit(EXIT_SUCCESS); } =20 @@ -398,7 +392,7 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) case 'c': retval =3D parse_cpu_set(optarg, ¶ms->common.monitored_cpus); if (retval) - osnoise_top_usage(params, "\nInvalid -c cpu list\n"); + fatal("Invalid -c cpu list"); params->common.cpus =3D optarg; break; case 'C': @@ -417,7 +411,7 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) case 'd': params->common.duration =3D parse_seconds_duration(optarg); if (!params->common.duration) - osnoise_top_usage(params, "Invalid -d duration\n"); + fatal("Invalid -d duration"); break; case 'e': tevent =3D trace_event_alloc(optarg); @@ -431,7 +425,7 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) break; case 'h': case '?': - osnoise_top_usage(params, NULL); + osnoise_top_usage(params); break; case 'H': params->common.hk_cpus =3D 1; @@ -442,12 +436,12 @@ struct common_params *osnoise_top_parse_args(int argc= , char **argv) case 'p': params->period =3D get_llong_from_str(optarg); if (params->period > 10000000) - osnoise_top_usage(params, "Period longer than 10 s\n"); + fatal("Period longer than 10 s"); break; case 'P': retval =3D parse_prio(optarg, ¶ms->common.sched_param); if (retval =3D=3D -1) - osnoise_top_usage(params, "Invalid -P priority"); + fatal("Invalid -P priority"); params->common.set_sched =3D 1; break; case 'q': @@ -456,7 +450,7 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) case 'r': params->runtime =3D get_llong_from_str(optarg); if (params->runtime < 100) - osnoise_top_usage(params, "Runtime shorter than 100 us\n"); + fatal("Runtime shorter than 100 us"); break; case 's': params->common.stop_us =3D get_llong_from_str(optarg); @@ -484,7 +478,7 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) if (retval) fatal("Error adding trigger %s", optarg); } else { - osnoise_top_usage(params, "--trigger requires a previous -e\n"); + fatal("--trigger requires a previous -e"); } break; case '1': /* filter */ @@ -493,7 +487,7 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) if (retval) fatal("Error adding filter %s", optarg); } else { - osnoise_top_usage(params, "--filter requires a previous -e\n"); + fatal("--filter requires a previous -e"); } break; case '2': @@ -515,7 +509,7 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) fatal("Invalid action %s", optarg); break; default: - osnoise_top_usage(params, "Invalid option"); + fatal("Invalid option"); } } =20 --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A42730E846 for ; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; cv=none; b=QzTVt+EO7byizbZZvbHwJIXAL4Q03y1HWkF0c4gjItReiwWkX50vrhE4ZUImP00pqIpnSqS0rwbc61y6l+fCalrNBPz4PHQgQRWbWvCcGgITYi7HaJXPy81Bc1OZBhygVNGi8tJMKqoppN9dYLCvrK0VUtdM0gpiQXqJwN8v2j0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; c=relaxed/simple; bh=TZaQcTgJ45YFPh0gvdA/JfCWO6ou6uQ4Veh22IfFX6I=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=EbosGsYJ7JGOjBKKRKkC2qAePyLDHxsTag3qWHsGlGhXOFLlSMIqt9ball9AInuk8IrBabayjE0pxPM2o+DwREBYC8LT2ubQG8DDV++j0bnuaiIeMsrCrdp69diIf1GK/jUfuS5hcb/Oe1VYdNHaTfVS59EbfO1r92SrCGRL2+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZDlgvTUK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZDlgvTUK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B4ACC19424; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681196; bh=TZaQcTgJ45YFPh0gvdA/JfCWO6ou6uQ4Veh22IfFX6I=; h=Date:From:To:Cc:Subject:References:From; b=ZDlgvTUKx70j6fDzsb/ehC0giHViEY+w8aWTMmMzH/eZuCYeXABqvEFkuvqHZoEB8 bnBQVD70cqvhgn7rDCDKWQv7Fmsa0enmEcxDuwSNp4fwnwPvZumU+0M825+MnTNeND q+BmJwsfbiGQCnPFoyd+tRY7uOaNeTBsv0qAxizRVmDESj47AZ1HgIiHYLd0gRQwcC 3jxFZ7mw01Me7JYy7oRoc/F3XvHMxYwiF1DOuH+nNfKCaj0HXlvUwD3m6KsrOi5UtG zQcbd0800C3CGdBEFUFdxyLm5RK5gxrhvAIrbOVwgmF9Xl8SMTOQ9/Ebc7LaFfXuQO In9WaQlpm5dCg== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3R-000000041wC-1qdY; Thu, 20 Nov 2025 18:27:09 -0500 Message-ID: <20251120232709.284177809@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:35 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Costa Shulyupin Subject: [for-next][PATCH 12/16] tools/rtla: Replace osnoise_hist_usage("...") with fatal("...") References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Costa Shulyupin A long time ago, when the usage help was short, it was a favor to the user to show it on error. Now that the usage help has become very long, it is too noisy to dump the complete help text for each typo after the error message itself. Replace osnoise_hist_usage("...") with fatal("...") on errors. Remove the already unused 'usage' argument from osnoise_hist_usage(). Signed-off-by: Costa Shulyupin Reviewed-by: Tomas Glozar Link: https://lore.kernel.org/r/20251011082738.173670-6-costa.shul@redhat.c= om Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/osnoise_hist.c | 32 +++++++++++---------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index d30a9a03b764..1d841a3056bc 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -407,7 +407,7 @@ osnoise_print_stats(struct osnoise_tool *tool) /* * osnoise_hist_usage - prints osnoise hist usage message */ -static void osnoise_hist_usage(char *usage) +static void osnoise_hist_usage(void) { int i; =20 @@ -453,18 +453,12 @@ static void osnoise_hist_usage(char *usage) NULL, }; =20 - if (usage) - fprintf(stderr, "%s\n", usage); - fprintf(stderr, "rtla osnoise hist: a per-cpu histogram of the OS noise (= version %s)\n", VERSION); =20 for (i =3D 0; msg[i]; i++) fprintf(stderr, "%s\n", msg[i]); =20 - if (usage) - exit(EXIT_FAILURE); - exit(EXIT_SUCCESS); } =20 @@ -547,12 +541,12 @@ static struct common_params params->common.hist.bucket_size =3D get_llong_from_str(optarg); if (params->common.hist.bucket_size =3D=3D 0 || params->common.hist.bucket_size >=3D 1000000) - osnoise_hist_usage("Bucket size needs to be > 0 and <=3D 1000000\n"); + fatal("Bucket size needs to be > 0 and <=3D 1000000"); break; case 'c': retval =3D parse_cpu_set(optarg, ¶ms->common.monitored_cpus); if (retval) - osnoise_hist_usage("\nInvalid -c cpu list\n"); + fatal("Invalid -c cpu list"); params->common.cpus =3D optarg; break; case 'C': @@ -571,7 +565,7 @@ static struct common_params case 'd': params->common.duration =3D parse_seconds_duration(optarg); if (!params->common.duration) - osnoise_hist_usage("Invalid -D duration\n"); + fatal("Invalid -D duration"); break; case 'e': tevent =3D trace_event_alloc(optarg); @@ -587,11 +581,11 @@ static struct common_params params->common.hist.entries =3D get_llong_from_str(optarg); if (params->common.hist.entries < 10 || params->common.hist.entries > 9999999) - osnoise_hist_usage("Entries must be > 10 and < 9999999\n"); + fatal("Entries must be > 10 and < 9999999"); break; case 'h': case '?': - osnoise_hist_usage(NULL); + osnoise_hist_usage(); break; case 'H': params->common.hk_cpus =3D 1; @@ -602,18 +596,18 @@ static struct common_params case 'p': params->period =3D get_llong_from_str(optarg); if (params->period > 10000000) - osnoise_hist_usage("Period longer than 10 s\n"); + fatal("Period longer than 10 s"); break; case 'P': retval =3D parse_prio(optarg, ¶ms->common.sched_param); if (retval =3D=3D -1) - osnoise_hist_usage("Invalid -P priority"); + fatal("Invalid -P priority"); params->common.set_sched =3D 1; break; case 'r': params->runtime =3D get_llong_from_str(optarg); if (params->runtime < 100) - osnoise_hist_usage("Runtime shorter than 100 us\n"); + fatal("Runtime shorter than 100 us"); break; case 's': params->common.stop_us =3D get_llong_from_str(optarg); @@ -653,7 +647,7 @@ static struct common_params if (retval) fatal("Error adding trigger %s", optarg); } else { - osnoise_hist_usage("--trigger requires a previous -e\n"); + fatal("--trigger requires a previous -e"); } break; case '5': /* filter */ @@ -662,7 +656,7 @@ static struct common_params if (retval) fatal("Error adding filter %s", optarg); } else { - osnoise_hist_usage("--filter requires a previous -e\n"); + fatal("--filter requires a previous -e"); } break; case '6': @@ -684,7 +678,7 @@ static struct common_params fatal("Invalid action %s", optarg); break; default: - osnoise_hist_usage("Invalid option"); + fatal("Invalid option"); } } =20 @@ -695,7 +689,7 @@ static struct common_params fatal("rtla needs root permission"); =20 if (params->common.hist.no_index && !params->common.hist.with_zeros) - osnoise_hist_usage("no-index set and with-zeros not set - it does not ma= ke sense"); + fatal("no-index set and with-zeros not set - it does not make sense"); =20 return ¶ms->common; } --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3ECB30FC3A for ; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; cv=none; b=XJtJU9GDUXXZTAEUVJwHYBtar87/ReIOcqpnTCKuB1FEXRToFS1FTQYmURRoOU4kmseImDV6K7E4QyWrKAjY1ghCLn+zHVTBuVgC3pDGroFRYPIg33rx7kg9ape3v13+Qyen30OBQQU8NR22cBSEfe5g6T4UMxCMpcFhNF6YAgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; c=relaxed/simple; bh=5NpVl0L0hQCXyMFazN7nywqgD6DiVGnr6UgljlU/hcM=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=C/h9U5vRzLgkaIWU0VzlseEnx/MjCd4cxPxdZcLnw6r3+IRcyXYxCOFsnbHabGYLC5jUCY9snDc7V21+XTDk5p/JXIRTPMS8WTBHTXSwCyNSIfRVLg1mwRXOFOP2a0sSCFQqRC1O5dijU39Q+NXsicVQx/2MUx4bprYwtFvCuqs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X2osEocB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X2osEocB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8108FC4CEF1; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681196; bh=5NpVl0L0hQCXyMFazN7nywqgD6DiVGnr6UgljlU/hcM=; h=Date:From:To:Cc:Subject:References:From; b=X2osEocB4Sjl+gfaln82+NVvqlRhmwwZU7Kbaq3X/wa7oA0i0xShsEj9CV86T6ycT WXNjZj19xce3FD+Emc9u4kNKzafA3iEV7FRBioIwZUPpz7USGOce8UjUqzuCSRlG3R lPpCK6t+VPTd125nqqn+TPm7fQOr6Q9lG7O8doueOTJuROeb8LLtq/pko4qClZNLrL gvcf2uBcZrbrvda/dogRuEvuGCgstycszNOqHQp4Pnf0Kk8VOIbdb+tVzMWm7duOOF SZkZt7gxFMF+lQY0EtHseL5VMjgDamfoT84EpfFoDqgMY6WFB2tkzL/0ifQl4CjHay /8HDn1s3188Jg== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3R-000000041wh-2WXB; Thu, 20 Nov 2025 18:27:09 -0500 Message-ID: <20251120232709.461382606@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:36 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Ivan Pravdin Subject: [for-next][PATCH 13/16] rtla: Fix -C/--cgroup interface References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ivan Pravdin Currently, user can only specify cgroup to the tracer's thread the following ways: `-C[cgroup]` `-C[=3Dcgroup]` `--cgroup[=3Dcgroup]` If user tries to specify cgroup as `-C [cgroup]` or `--cgroup [cgroup]`, the parser silently fails and rtla's cgroup is used for the tracer threads. To make interface more user-friendly, allow user to specify cgroup in the aforementioned way, i.e. `-C [cgroup]` and `--cgroup [cgroup]`. Refactor identical logic between -t/--trace and -C/--cgroup into a common function. Change documentation to reflect this user interface change. Fixes: a957cbc02531 ("rtla: Add -C cgroup support") Signed-off-by: Ivan Pravdin Reviewed-by: Tomas Glozar Link: https://lore.kernel.org/r/16132f1565cf5142b5fbd179975be370b529ced7.17= 62186418.git.ipravdin.official@gmail.com [ use capital letter in subject, as required by tracing subsystem ] Signed-off-by: Tomas Glozar --- Documentation/tools/rtla/common_options.rst | 2 +- tools/tracing/rtla/src/osnoise_hist.c | 26 ++++++--------------- tools/tracing/rtla/src/osnoise_top.c | 26 ++++++--------------- tools/tracing/rtla/src/timerlat_hist.c | 26 ++++++--------------- tools/tracing/rtla/src/timerlat_top.c | 26 ++++++--------------- tools/tracing/rtla/src/utils.c | 26 +++++++++++++++++++++ tools/tracing/rtla/src/utils.h | 1 + 7 files changed, 56 insertions(+), 77 deletions(-) diff --git a/Documentation/tools/rtla/common_options.rst b/Documentation/to= ols/rtla/common_options.rst index 77ef35d3f831..edc8e850f5d0 100644 --- a/Documentation/tools/rtla/common_options.rst +++ b/Documentation/tools/rtla/common_options.rst @@ -42,7 +42,7 @@ - *f:prio* - use SCHED_FIFO with *prio*; - *d:runtime[us|ms|s]:period[us|ms|s]* - use SCHED_DEADLINE with *= runtime* and *period* in nanoseconds. =20 -**-C**, **--cgroup**\[*=3Dcgroup*] +**-C**, **--cgroup** \[*cgroup*] =20 Set a *cgroup* to the tracer's threads. If the **-C** option is pa= ssed without arguments, the tracer's thread will inherit **rtla**'s *cgroup= *. Otherwise, the threads will be placed on the *cgroup* passed to the opti= on. =20 diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index 1d841a3056bc..1d06ea47b663 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -414,9 +414,9 @@ static void osnoise_hist_usage(void) static const char * const msg[] =3D { "", " usage: rtla osnoise hist [-h] [-D] [-d s] [-a us] [-p us] [-r us] [-s= us] [-S us] \\", - " [-T us] [-t[file]] [-e sys[:event]] [--filter ] [--trigger <= trigger>] \\", + " [-T us] [-t [file]] [-e sys[:event]] [--filter ] [--trigger = ] \\", " [-c cpu-list] [-H cpu-list] [-P priority] [-b N] [-E N] [--no-header= ] [--no-summary] \\", - " [--no-index] [--with-zeros] [-C[=3Dcgroup_name]] [--warm-up]", + " [--no-index] [--with-zeros] [-C [cgroup_name]] [--warm-up]", "", " -h/--help: print this menu", " -a/--auto: set automatic trace mode, stopping the session if argumen= t in us sample is hit", @@ -427,10 +427,10 @@ static void osnoise_hist_usage(void) " -T/--threshold us: the minimum delta to be considered a noise", " -c/--cpus cpu-list: list of cpus to run osnoise threads", " -H/--house-keeping cpus: run rtla control threads only on the given = cpus", - " -C/--cgroup[=3Dcgroup_name]: set cgroup, if no cgroup_name is passed= , the rtla's cgroup will be inherited", + " -C/--cgroup [cgroup_name]: set cgroup, if no cgroup_name is passed, = the rtla's cgroup will be inherited", " -d/--duration time[s|m|h|d]: duration of the session", " -D/--debug: print debug info", - " -t/--trace[file]: save the stopped trace to [file|osnoise_trace.txt]= ", + " -t/--trace [file]: save the stopped trace to [file|osnoise_trace.txt= ]", " -e/--event : enable the in the trace instance= , multiple -e are allowed", " --filter : enable a trace event filter to the previous -e= event", " --trigger : enable a trace event trigger to the previous= -e event", @@ -551,13 +551,7 @@ static struct common_params break; case 'C': params->common.cgroup =3D 1; - if (!optarg) { - /* will inherit this cgroup */ - params->common.cgroup_name =3D NULL; - } else if (*optarg =3D=3D '=3D') { - /* skip the =3D */ - params->common.cgroup_name =3D ++optarg; - } + params->common.cgroup_name =3D parse_optional_arg(argc, argv); break; case 'D': config_debug =3D 1; @@ -619,14 +613,8 @@ static struct common_params params->threshold =3D get_llong_from_str(optarg); break; case 't': - if (optarg) { - if (optarg[0] =3D=3D '=3D') - trace_output =3D &optarg[1]; - else - trace_output =3D &optarg[0]; - } else if (optind < argc && argv[optind][0] !=3D '0') - trace_output =3D argv[optind]; - else + trace_output =3D parse_optional_arg(argc, argv); + if (!trace_output) trace_output =3D "osnoise_trace.txt"; break; case '0': /* no header */ diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index de8e26d7c68b..cac60e4c267e 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -261,8 +261,8 @@ static void osnoise_top_usage(struct osnoise_params *pa= rams) =20 static const char * const msg[] =3D { " [-h] [-q] [-D] [-d s] [-a us] [-p us] [-r us] [-s us] [-S us] \\", - " [-T us] [-t[file]] [-e sys[:event]] [--filter ] [--trigger <= trigger>] \\", - " [-c cpu-list] [-H cpu-list] [-P priority] [-C[=3Dcgroup_name]] [--wa= rm-up s]", + " [-T us] [-t [file]] [-e sys[:event]] [--filter ] [--trigger = ] \\", + " [-c cpu-list] [-H cpu-list] [-P priority] [-C [cgroup_name]] [--warm= -up s]", "", " -h/--help: print this menu", " -a/--auto: set automatic trace mode, stopping the session if argumen= t in us sample is hit", @@ -273,10 +273,10 @@ static void osnoise_top_usage(struct osnoise_params *= params) " -T/--threshold us: the minimum delta to be considered a noise", " -c/--cpus cpu-list: list of cpus to run osnoise threads", " -H/--house-keeping cpus: run rtla control threads only on the given = cpus", - " -C/--cgroup[=3Dcgroup_name]: set cgroup, if no cgroup_name is passed= , the rtla's cgroup will be inherited", + " -C/--cgroup [cgroup_name]: set cgroup, if no cgroup_name is passed, = the rtla's cgroup will be inherited", " -d/--duration time[s|m|h|d]: duration of the session", " -D/--debug: print debug info", - " -t/--trace[file]: save the stopped trace to [file|osnoise_trace.txt]= ", + " -t/--trace [file]: save the stopped trace to [file|osnoise_trace.txt= ]", " -e/--event : enable the in the trace instance= , multiple -e are allowed", " --filter : enable a trace event filter to the previous -e= event", " --trigger : enable a trace event trigger to the previous= -e event", @@ -397,13 +397,7 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) break; case 'C': params->common.cgroup =3D 1; - if (!optarg) { - /* will inherit this cgroup */ - params->common.cgroup_name =3D NULL; - } else if (*optarg =3D=3D '=3D') { - /* skip the =3D */ - params->common.cgroup_name =3D ++optarg; - } + params->common.cgroup_name =3D parse_optional_arg(argc, argv); break; case 'D': config_debug =3D 1; @@ -459,14 +453,8 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) params->common.stop_total_us =3D get_llong_from_str(optarg); break; case 't': - if (optarg) { - if (optarg[0] =3D=3D '=3D') - trace_output =3D &optarg[1]; - else - trace_output =3D &optarg[0]; - } else if (optind < argc && argv[optind][0] !=3D '-') - trace_output =3D argv[optind]; - else + trace_output =3D parse_optional_arg(argc, argv); + if (!trace_output) trace_output =3D "osnoise_trace.txt"; break; case 'T': diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 1b505531ad3b..961aa969c003 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -701,9 +701,9 @@ static void timerlat_hist_usage(void) char *msg[] =3D { "", " usage: [rtla] timerlat hist [-h] [-q] [-d s] [-D] [-n] [-a us] [-p us= ] [-i us] [-T us] [-s us] \\", - " [-t[file]] [-e sys[:event]] [--filter ] [--trigger ] [-c cpu-list] [-H cpu-list]\\", + " [-t [file]] [-e sys[:event]] [--filter ] [--trigger ] [-c cpu-list] [-H cpu-list]\\", " [-P priority] [-E N] [-b N] [--no-irq] [--no-thread] [--no-header] [= --no-summary] \\", - " [--no-index] [--with-zeros] [--dma-latency us] [-C[=3Dcgroup_name]] = [--no-aa] [--dump-task] [-u|-k]", + " [--no-index] [--with-zeros] [--dma-latency us] [-C [cgroup_name]] [-= -no-aa] [--dump-task] [-u|-k]", " [--warm-up s] [--deepest-idle-state n]", "", " -h/--help: print this menu", @@ -714,11 +714,11 @@ static void timerlat_hist_usage(void) " -s/--stack us: save the stack trace at the IRQ if a thread latency i= s higher than the argument in us", " -c/--cpus cpus: run the tracer only on the given cpus", " -H/--house-keeping cpus: run rtla control threads only on the given = cpus", - " -C/--cgroup[=3Dcgroup_name]: set cgroup, if no cgroup_name is passed= , the rtla's cgroup will be inherited", + " -C/--cgroup [cgroup_name]: set cgroup, if no cgroup_name is passed, = the rtla's cgroup will be inherited", " -d/--duration time[m|h|d]: duration of the session in seconds", " --dump-tasks: prints the task running on all CPUs if stop conditi= ons are met (depends on !--no-aa)", " -D/--debug: print debug info", - " -t/--trace[file]: save the stopped trace to [file|timerlat_trace.txt= ]", + " -t/--trace [file]: save the stopped trace to [file|timerlat_trace.tx= t]", " -e/--event : enable the in the trace instance= , multiple -e are allowed", " --filter : enable a trace event filter to the previous -e= event", " --trigger : enable a trace event trigger to the previous= -e event", @@ -864,13 +864,7 @@ static struct common_params break; case 'C': params->common.cgroup =3D 1; - if (!optarg) { - /* will inherit this cgroup */ - params->common.cgroup_name =3D NULL; - } else if (*optarg =3D=3D '=3D') { - /* skip the =3D */ - params->common.cgroup_name =3D ++optarg; - } + params->common.cgroup_name =3D parse_optional_arg(argc, argv); break; case 'b': params->common.hist.bucket_size =3D get_llong_from_str(optarg); @@ -939,14 +933,8 @@ static struct common_params params->common.stop_total_us =3D get_llong_from_str(optarg); break; case 't': - if (optarg) { - if (optarg[0] =3D=3D '=3D') - trace_output =3D &optarg[1]; - else - trace_output =3D &optarg[0]; - } else if (optind < argc && argv[optind][0] !=3D '-') - trace_output =3D argv[optind]; - else + trace_output =3D parse_optional_arg(argc, argv); + if (!trace_output) trace_output =3D "timerlat_trace.txt"; break; case 'u': diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 67a5b6ab78a6..213356a5be52 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -481,8 +481,8 @@ static void timerlat_top_usage(void) static const char *const msg[] =3D { "", " usage: rtla timerlat [top] [-h] [-q] [-a us] [-d s] [-D] [-n] [-p us]= [-i us] [-T us] [-s us] \\", - " [[-t[file]] [-e sys[:event]] [--filter ] [--trigger ] [-c cpu-list] [-H cpu-list]\\", - " [-P priority] [--dma-latency us] [--aa-only us] [-C[=3Dcgroup_name]]= [-u|-k] [--warm-up s] [--deepest-idle-state n]", + " [[-t [file]] [-e sys[:event]] [--filter ] [--trigger ] [-c cpu-list] [-H cpu-list]\\", + " [-P priority] [--dma-latency us] [--aa-only us] [-C [cgroup_name]] [= -u|-k] [--warm-up s] [--deepest-idle-state n]", "", " -h/--help: print this menu", " -a/--auto: set automatic trace mode, stopping the session if argumen= t in us latency is hit", @@ -493,11 +493,11 @@ static void timerlat_top_usage(void) " -s/--stack us: save the stack trace at the IRQ if a thread latency i= s higher than the argument in us", " -c/--cpus cpus: run the tracer only on the given cpus", " -H/--house-keeping cpus: run rtla control threads only on the given = cpus", - " -C/--cgroup[=3Dcgroup_name]: set cgroup, if no cgroup_name is passed= , the rtla's cgroup will be inherited", + " -C/--cgroup [cgroup_name]: set cgroup, if no cgroup_name is passed, = the rtla's cgroup will be inherited", " -d/--duration time[s|m|h|d]: duration of the session", " -D/--debug: print debug info", " --dump-tasks: prints the task running on all CPUs if stop conditi= ons are met (depends on !--no-aa)", - " -t/--trace[file]: save the stopped trace to [file|timerlat_trace.txt= ]", + " -t/--trace [file]: save the stopped trace to [file|timerlat_trace.tx= t]", " -e/--event : enable the in the trace instance= , multiple -e are allowed", " --filter : enable a trace event filter to the previous -= e event", " --trigger : enable a trace event trigger to the previous= -e event", @@ -642,13 +642,7 @@ static struct common_params break; case 'C': params->common.cgroup =3D 1; - if (!optarg) { - /* will inherit this cgroup */ - params->common.cgroup_name =3D NULL; - } else if (*optarg =3D=3D '=3D') { - /* skip the =3D */ - params->common.cgroup_name =3D ++optarg; - } + params->common.cgroup_name =3D optarg; break; case 'D': config_debug =3D 1; @@ -707,14 +701,8 @@ static struct common_params params->common.stop_total_us =3D get_llong_from_str(optarg); break; case 't': - if (optarg) { - if (optarg[0] =3D=3D '=3D') - trace_output =3D &optarg[1]; - else - trace_output =3D &optarg[0]; - } else if (optind < argc && argv[optind][0] !=3D '-') - trace_output =3D argv[optind]; - else + trace_output =3D parse_optional_arg(argc, argv); + if (!trace_output) trace_output =3D "timerlat_trace.txt"; break; case 'u': diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index 54334c676a22..9cf5a0098e9a 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -974,3 +974,29 @@ int auto_house_keeping(cpu_set_t *monitored_cpus) =20 return 1; } + +/** + * parse_optional_arg - Parse optional argument value + * + * Parse optional argument value, which can be in the form of: + * -sarg, -s/--long=3Darg, -s/--long arg + * + * Returns arg value if found, NULL otherwise. + */ +char *parse_optional_arg(int argc, char **argv) +{ + if (optarg) { + if (optarg[0] =3D=3D '=3D') { + /* skip the =3D */ + return &optarg[1]; + } else { + return optarg; + } + /* parse argument of form -s [arg] and --long [arg]*/ + } else if (optind < argc && argv[optind][0] !=3D '-') { + /* consume optind */ + return argv[optind++]; + } else { + return NULL; + } +} diff --git a/tools/tracing/rtla/src/utils.h b/tools/tracing/rtla/src/utils.h index 1be095f9a7e6..091df4ba4587 100644 --- a/tools/tracing/rtla/src/utils.h +++ b/tools/tracing/rtla/src/utils.h @@ -25,6 +25,7 @@ long parse_seconds_duration(char *val); void get_duration(time_t start_time, char *output, int output_size); =20 int parse_cpu_list(char *cpu_list, char **monitored_cpus); +char *parse_optional_arg(int argc, char **argv); long long get_llong_from_str(char *start); =20 static inline void --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2620310627 for ; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; cv=none; b=CBV4JhnqLgdOVBxYBHxRULDRO4spRHxIRwU0tVhckVlthNuYNjjCIecDfnXT8kvmJeJ6Rsso7K4aAf3ZWidX8rmLnVtkGydzsWRxbRFdgeeguUY7EKkoAqryHUE4eySyUN6gUqV9LmYlaunITW+o55vMKO3EAFeCgcQlZSCfoeo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681196; c=relaxed/simple; bh=iGs7BanQHddMZMGfKDEryE+zQ05RBV6r6JyCAjO90ng=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=rkcbBNmtT1FFpx5l3+tghsFoiATHHxuvSh0aVdY/B4aX5kPwzg4IFkVHOIukGhIjyjqM7naA4ZNfOns861QUbro+z+UB+0vErrMrdHKApMhxUni5sKBHtxXblTmv+lzxBpQbzXocMrhVG4r+oCqQtL3G4mXqh2XinHv2omHzVX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vPD40Bze; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vPD40Bze" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADD24C19425; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681196; bh=iGs7BanQHddMZMGfKDEryE+zQ05RBV6r6JyCAjO90ng=; h=Date:From:To:Cc:Subject:References:From; b=vPD40BzenR6nKT+4f97wD8DNHbnZntxVilvpSEYDhW7IuNwYvc/aBcydw+zp5TcT4 73Xk0dHo3qVOyqL46mQ/4cXiiodDM4PuPwINb5MIPMXuNCVPVQn3tKnjbADJV6XpkC 6KjND/qUqO0gLfnYeb5+8NJWPnu3iHMZ7P6tHvQhrstdJhZJuBNUWHUUCtRjPd74xK oTybvV4jSzkxSFXyUme0Dlh/RXSVuVR64B9jew9U4Pulu9z7hsI4JZG8tIhs362PXl f4yub/lKw8mKXNnLUswc80LJs2qwWdUJirX5S9m94epWPlcNftHAgfjuedZ6nltD3k UOC89Ada499Yg== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3R-000000041xB-3EFZ; Thu, 20 Nov 2025 18:27:09 -0500 Message-ID: <20251120232709.626030604@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:37 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Ivan Pravdin Subject: [for-next][PATCH 14/16] rtla: Fix -a overriding -t argument References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ivan Pravdin When running rtla as `rtla -t custom_file.txt -a 100` -a options override trace output filename specified by -t option. Running the command above will create _trace.txt file instead of custom_file.txt. Fix this by making sure that -a option does not override trace output filename even if it's passed after trace output filename is specified. Fixes: 173a3b014827 ("rtla/timerlat: Add the automatic trace option") Signed-off-by: Ivan Pravdin Reviewed-by: Tomas Glozar Link: https://lore.kernel.org/r/b6ae60424050b2c1c8709e18759adead6012b971.17= 62186418.git.ipravdin.official@gmail.com [ use capital letter in subject, as required by tracing subsystem ] Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/osnoise_hist.c | 3 ++- tools/tracing/rtla/src/osnoise_top.c | 3 ++- tools/tracing/rtla/src/timerlat_hist.c | 3 ++- tools/tracing/rtla/src/timerlat_top.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index 1d06ea47b663..ff8c231e47c4 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -534,7 +534,8 @@ static struct common_params params->threshold =3D 1; =20 /* set trace */ - trace_output =3D "osnoise_trace.txt"; + if (!trace_output) + trace_output =3D "osnoise_trace.txt"; =20 break; case 'b': diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index cac60e4c267e..04c699bdd736 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -386,7 +386,8 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) params->threshold =3D 1; =20 /* set trace */ - trace_output =3D "osnoise_trace.txt"; + if (!trace_output) + trace_output =3D "osnoise_trace.txt"; =20 break; case 'c': diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 961aa969c003..1fb471a787b7 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -853,7 +853,8 @@ static struct common_params params->print_stack =3D auto_thresh; =20 /* set trace */ - trace_output =3D "timerlat_trace.txt"; + if (!trace_output) + trace_output =3D "timerlat_trace.txt"; =20 break; case 'c': diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 213356a5be52..fec113ce370e 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -617,7 +617,8 @@ static struct common_params params->print_stack =3D auto_thresh; =20 /* set trace */ - trace_output =3D "timerlat_trace.txt"; + if (!trace_output) + trace_output =3D "timerlat_trace.txt"; =20 break; case '5': --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18A5C31196D for ; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681197; cv=none; b=lvx4Swr9EX15kBQVJx3eAV3cAZmpYvnwAuf8Fgs7oaFsQsNOr9EhLutbVArvQHtAKceZXCqeRdixbA6KneV924161madqj7WWfYbyAHCxZOrCHPnbCy0xKBftgH8GdWwrHfY3AFjjbcZpTuxRu4qcIc9mAK+p1AjT6f5TjXhp9U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681197; c=relaxed/simple; bh=5kM87JWVv3aVU0MV0JsAAPE/TljgzwR7VK/z9g16GxU=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=VdtVsSv6L1t9eHTckg4g2QNWYssKR4QJZgbVN/DGQujiTVQB5qeEpRJnzg7PM052WNTZWJrfULaZuiyMNtF8+FmlcxAIhcnyXDAUuuSwOm3K9RBYXjnkgtJLmtoBRnL56DCmry+1Yn/4ZHG5TLtKg84PztXfKYR1wvx6P58dQyw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kUrIoYso; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kUrIoYso" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCC3AC113D0; Thu, 20 Nov 2025 23:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681196; bh=5kM87JWVv3aVU0MV0JsAAPE/TljgzwR7VK/z9g16GxU=; h=Date:From:To:Cc:Subject:References:From; b=kUrIoYsoAB9z14dZULq4+kqYt1SNtnf3R3ZQ7lbsqjx6A1rttG+xD+FbjXkyBe2JW 1e9btGWdJWjbh2vP2wkLKYaPciwzc4a6NWAGMVmMdOSEoPt8o9tDBaPz8eEOmu3Ktu 26fU8ysqFtpEUDZRlke5IyBiKOH56yfTdp5Ek/7L12e24qhZ32jMSCXU867ou6Gbdp F1nqnWt0MNIyPiXF4eHyq/mqyp+V3JYM49EXo3ZlP2TqQfwkzjilLgqkfr3sLZSmjC u4iHIjaSmKKRcr3q9nUty8hI+kstNGT72GqIQ9r+7x0sBb2UWCVXg2MIvP6n3v6Sz1 /Uyw2Cb7DmjeA== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3R-000000041xg-3uHj; Thu, 20 Nov 2025 18:27:09 -0500 Message-ID: <20251120232709.790791802@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:38 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Crystal Wood Subject: [for-next][PATCH 15/16] rtla/tests: Dont rely on matching ^1ALL References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Crystal Wood The timerlat "top stop at failed action" test was relying on "ALL" being printed immediately after the "1" from the threshold action. Besides being fragile, this depends on stdbuf behavior, which is easy to miss when recreating the test outside of the framework for debugging purposes. Instead, use the expected/unexpected text mechanism from the corresponding osnoise test. Signed-off-by: Crystal Wood Link: https://lore.kernel.org/r/20251112152529.956778-2-crwood@redhat.com Signed-off-by: Tomas Glozar --- tools/tracing/rtla/tests/timerlat.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tracing/rtla/tests/timerlat.t b/tools/tracing/rtla/tests= /timerlat.t index b550a6ae2445..bbaa1897d8a8 100644 --- a/tools/tracing/rtla/tests/timerlat.t +++ b/tools/tracing/rtla/tests/timerlat.t @@ -58,7 +58,7 @@ check "multiple actions" \ check "hist stop at failed action" \ "timerlat hist -T 2 --on-threshold shell,command=3D'echo -n 1; false' --o= n-threshold shell,command=3D'echo -n 2'" 2 "^1# RTLA timerlat histogram$" check "top stop at failed action" \ - "timerlat top -T 2 --on-threshold shell,command=3D'echo -n 1; false' --on= -threshold shell,command=3D'echo -n 2'" 2 "^1ALL" + "timerlat top -T 2 --on-threshold shell,command=3D'echo -n abc; false' --= on-threshold shell,command=3D'echo -n defgh'" 2 "^abc" "defgh" check "hist with continue" \ "timerlat hist -T 2 -d 5s --on-threshold shell,command=3D'echo TestOutput= ' --on-threshold continue" 0 "^TestOutput$" check "top with continue" \ --=20 2.51.0 From nobody Tue Dec 2 01:51:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F779311C16 for ; Thu, 20 Nov 2025 23:26:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681197; cv=none; b=XUuVu6xOANSEg9RUmaiwcThL0CpC+Dsi2mmWrSWY+EFbZDpgKZMvtH99QFH2DPMLGUrfn8TFBEjzfV8yAU4mNWC6umWGgVMRMiOqhgPZRZZKiUUyo0GqjlCEcm5+l5aLNG6wFMc2VyQDku2KXcfc+1DuWAdUjWBGuvy5s5Xvyuw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763681197; c=relaxed/simple; bh=Tk+bmWNTvGL3KGPdeJJ62EH4IG2N1NKJfOjZqDPR7xY=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Fr5hhk7Kp5I0aDZRbBvWMAJwyxEPn3IlJSORBdYrUyGsLBhOZi/izMSpSuDVng5QOJ+FRIgkJqD7FpPnqbbNH5DpGEm8uYN2uui0MH+LPH3erGEBRSscYCI1SadtfF/4dt+EvsTsR7cSFPBj4hEoCqfb8O1LzOAslumSrwaju0k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=msmKhA/a; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="msmKhA/a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02324C19422; Thu, 20 Nov 2025 23:26:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763681197; bh=Tk+bmWNTvGL3KGPdeJJ62EH4IG2N1NKJfOjZqDPR7xY=; h=Date:From:To:Cc:Subject:References:From; b=msmKhA/aa+h9MgXfPigvKSBXXfVqyhUEj7ipNtf6naHKarSMeBWdK20/xg9H5Wkfc gfxDutMjNYf/FBVHYuJDZRdsb+MP9QsbOxJD85YamUW96rdbkj1lR8eRqbsTN+PgqJ t3Lvi1RJnfjT3QhvQTc5DUxCzI+xHGTB3XptJqltjwhvZbcOr3wKXZBF1KZS8R3dPM HxnTxdvRwvQHzduX4wbgxxGjDez+pPT1K+bd+Ma5tTD4k6Y5eVDim2olat+QYvs37L tj+mFjVLDG2OS5OHIVDhR5Jwj1uOsPs7RVMysDRSG7uiikhD7+BxTShy/PLMJQD8CA Ki7QGhtAfmOvQ== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vME3S-000000041yC-0PEV; Thu, 20 Nov 2025 18:27:10 -0500 Message-ID: <20251120232709.950942020@kernel.org> User-Agent: quilt/0.68 Date: Thu, 20 Nov 2025 18:23:39 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Tomas Glozar , John Kacur , Crystal Wood Subject: [for-next][PATCH 16/16] rtla/timerlat: Exit top main loop on any non-zero wait_retval References: <20251120232323.271532418@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Crystal Wood Comparing to exactly 1 will fail if more than one ring buffer event was seen since the last call to timerlat_bpf_wait(), which can happen in some race scenarios. Signed-off-by: Crystal Wood Link: https://lore.kernel.org/r/20251112152529.956778-5-crwood@redhat.com Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/timerlat_top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index fec113ce370e..29c2c1f717ed 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -878,7 +878,7 @@ timerlat_top_bpf_main_loop(struct osnoise_tool *tool) if (!params->common.quiet) timerlat_print_stats(tool); =20 - if (wait_retval =3D=3D 1) { + if (wait_retval !=3D 0) { /* Stopping requested by tracer */ actions_perform(¶ms->common.threshold_actions); =20 --=20 2.51.0