From nobody Tue Dec 2 02:05:04 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