From nobody Sat Jul 25 21:20:42 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 286FC21FF25 for ; Mon, 13 Jul 2026 14:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783951864; cv=none; b=Bu0TwnajWIW1mLb90tHAz51/9GU31KAOnJ9+2/m9TZEFarZ9/tSnn047g0+81/dw9bvAq+zmRn0wcUHm76iToiDxL8tq32Dq0LlnU93dBFnJ2B285BgY+3aoAnogwRIAvDJV2k8NSpTAarN0qPoi12XmNtwu5ylKnrjNXsntS9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783951864; c=relaxed/simple; bh=+GT4GEimZN6BsXH0kV+jWdh++F8o7fRLAVmYJM+PxW4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=S1rWPs1IEY9t+vSmceJDrdzcTTXzrq0/hmoxVXuI3211PUBHFXXP6LpuGzIfwbO0vK8g/jUO5Ppm6V7fcgXo6UXQTdV5nH1HAJNrvbCBmVa0nAnoWIsfYNFsStwfL5HwVYv2t0PQA6yd2keeQ+k7MrRPQjeNHz3wCkriJQ9akt4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=OQXGPK+3; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OQXGPK+3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783951862; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=LiKxkmmrwlHgOmnYzkquHoAVOmvSL6iPKoX+bXiuwgA=; b=OQXGPK+3KRcP/oMEI9J1w/q7mQK7KkqULWr+lpVxIX5Y17J6/Yb6I9bXit0TsKjGm+HM13 gJ0lK5Jc8VoegmVGsMs1bCVnW+v3zc2oo0bJSg66UjQ627KjwofK/MvvHoL2B0F89MOA8N zbZlSFYv9kpfE8GIfFyiItQvWThAfHY= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-252-qOePKv5WMuWu5uveJ_EUSA-1; Mon, 13 Jul 2026 10:11:00 -0400 X-MC-Unique: qOePKv5WMuWu5uveJ_EUSA-1 X-Mimecast-MFC-AGG-ID: qOePKv5WMuWu5uveJ_EUSA_1783951859 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AE76A18052F9; Mon, 13 Jul 2026 14:10:59 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.32.150]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2C45A3000B4C; Mon, 13 Jul 2026 14:10:55 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt , Tomas Glozar Cc: John Kacur , Luis Goncalves , Crystal Wood , Costa Shulyupin , Wander Lairson Costa , LKML , linux-trace-kernel , Attila Fazekas Subject: [PATCH] rtla/timerlat_top: Fix on-threshold actions firing on signal Date: Mon, 13 Jul 2026 16:10:47 +0200 Message-ID: <20260713141047.687877-1-tglozar@redhat.com> 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" A bug was reported when rtla-timerlat-top tool performs on-threshold actions, even though no threshold was hit. This is reproduced even if no threshold is set at all: $ rtla timerlat top -q -c 0 --on-threshold shell,command=3D'echo BAD' BAD Timer Latency ... The bug is due to incorrect logic in timerlat_top_bpf_main_loop(). The loop uses timerlat_bpf_wait(), the return values of which are: - > 0 (number of ringbuffer entries): at least 1 CPU hit threshold - =3D 0: time out - < 0: wait was interrupted by a signal Commit 3138df6f0cd0 ("rtla/timerlat: Exit top main loop on any non-zero wait_retval") changed the condition for "threshold hit" from "wait_reval =3D=3D 1" (exactly 1 CPU hit threshold) to "wait_retval !=3D 0", to fix a race where multiple CPUs hit the threshold at the same time. That also made it incorrectly include a signal (< 0), coming from either duration expired (SIGALRM) or user interrupt (SIGINT). Check for wait_retval greater than zero in the if condition to cover all return values correctly. Fixes: 3138df6f0cd0 ("rtla/timerlat: Exit top main loop on any non-zero wai= t_retval") Reported-by: Attila Fazekas Signed-off-by: Tomas Glozar Reviewed-by: Wander Lairson Costa --- 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 18e1071a2e242..6206a0a565ad3 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -536,7 +536,7 @@ timerlat_top_bpf_main_loop(struct osnoise_tool *tool) if (!params->quiet) timerlat_print_stats(tool); =20 - if (wait_retval !=3D 0) { + if (wait_retval > 0) { /* Stopping requested by tracer */ retval =3D common_threshold_handler(tool); if (retval) --=20 2.55.0