From nobody Sun Feb 8 06:55:57 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 455B630C60A for ; Mon, 27 Oct 2025 15:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761579263; cv=none; b=eROpC76R53BLgTCztyktPR0yJTGzsXeMMpXDK/9Job3Zphm8APYsv0CWZbUyhhqviRIuIl/pv/nWEgmRNtnx+lRLne+PrBmxzutffVfkvUiGQrpwFE/UZLe4Q0d3vNbQ3qk3mB1Izn7x/xGkganZ5M2GP3/f5evZTsFQsYfZnT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761579263; c=relaxed/simple; bh=rGu5A3OU4ZSpORG0UAOqi+ojq3qcrJOfyOMyESOti20=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HGAIssFmPgtaIMUcI4it7LE8KsGKjlMbMzNs8Hk5lAYBIolPEU9tWlMOUF8g+TPVg3jDXpjpzydXlcRQaLfgRGTlf6wO0B9FO/RzqJMaj9yEOZNQm90xJzwZVqPz2BxtVT1cfo2zYplOj2WCMu9W5w9HI8AMVZu5Efh2L9X0zIQ= 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=i8po8+ZD; arc=none smtp.client-ip=170.10.129.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="i8po8+ZD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761579261; 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: in-reply-to:in-reply-to:references:references; bh=mb0dB1veQuyN7Er4i7PkFCiU6cwrLRWf+Zv8v4WzqA0=; b=i8po8+ZDe534OLeD43ij/QbMTzhTRJgNbOZKEzX79ck2OVthbbz+Fkll3QsyDIwcEzpPcw V+G0qRlvq1mJS/TUiIY/v++rtb0rN2FS7x6P3esc0EFtPQIM9VQQbIqUU874l26aOlsU56 Zq3/LCxvYEtUidtsszlS9344W9IcQTw= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-93-vi5hkl8oMqCGWrodI2R52g-1; Mon, 27 Oct 2025 11:34:17 -0400 X-MC-Unique: vi5hkl8oMqCGWrodI2R52g-1 X-Mimecast-MFC-AGG-ID: vi5hkl8oMqCGWrodI2R52g_1761579255 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EC93C19540E7; Mon, 27 Oct 2025 15:34:14 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.137]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EF7EA195398C; Mon, 27 Oct 2025 15:34:11 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: LKML , Linux Trace Kernel , John Kacur , Luis Goncalves , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Arnaldo Carvalho de Melo , Tomas Glozar Subject: [PATCH v3 1/7] rtla/timerlat: Support tail call from BPF program Date: Mon, 27 Oct 2025 16:33:55 +0100 Message-ID: <20251027153401.1039217-2-tglozar@redhat.com> In-Reply-To: <20251027153401.1039217-1-tglozar@redhat.com> References: <20251027153401.1039217-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.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" Add a map to the rtla-timerlat BPF program that holds a file descriptor of another BPF program, to be executed on threshold overflow. timerlat_bpf_set_action() is added as an interface to set the program. Signed-off-by: Tomas Glozar Reviewed-by: Crystal Wood --- tools/tracing/rtla/src/timerlat.bpf.c | 23 ++++++++++++++++++++--- tools/tracing/rtla/src/timerlat_bpf.c | 13 +++++++++++++ tools/tracing/rtla/src/timerlat_bpf.h | 1 + 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/tools/tracing/rtla/src/timerlat.bpf.c b/tools/tracing/rtla/src= /timerlat.bpf.c index 084cd10c21fc..19ccd9abf8d4 100644 --- a/tools/tracing/rtla/src/timerlat.bpf.c +++ b/tools/tracing/rtla/src/timerlat.bpf.c @@ -40,6 +40,17 @@ struct { __uint(max_entries, 1); } signal_stop_tracing SEC(".maps"); =20 +struct { + __uint(type, BPF_MAP_TYPE_PROG_ARRAY); + __uint(key_size, sizeof(unsigned int)); + __uint(max_entries, 1); + __array(values, unsigned int (void *)); +} bpf_action SEC(".maps") =3D { + .values =3D { + [0] =3D 0 + }, +}; + /* Params to be set by rtla */ const volatile int bucket_size =3D 1; const volatile int output_divisor =3D 1000; @@ -109,7 +120,7 @@ nosubprog void update_summary(void *map, map_set(map, SUMMARY_SUM, map_get(map, SUMMARY_SUM) + latency); } =20 -nosubprog void set_stop_tracing(void) +nosubprog void set_stop_tracing(struct trace_event_raw_timerlat_sample *tp= _args) { int value =3D 0; =20 @@ -118,6 +129,12 @@ nosubprog void set_stop_tracing(void) =20 /* Signal to userspace */ bpf_ringbuf_output(&signal_stop_tracing, &value, sizeof(value), 0); + + /* + * Call into BPF action program, if attached. + * Otherwise, just silently fail. + */ + bpf_tail_call(tp_args, &bpf_action, 0); } =20 SEC("tp/osnoise/timerlat_sample") @@ -138,13 +155,13 @@ int handle_timerlat_sample(struct trace_event_raw_tim= erlat_sample *tp_args) update_summary(&summary_irq, latency, bucket); =20 if (irq_threshold !=3D 0 && latency_us >=3D irq_threshold) - set_stop_tracing(); + set_stop_tracing(tp_args); } else if (tp_args->context =3D=3D 1) { update_main_hist(&hist_thread, bucket); update_summary(&summary_thread, latency, bucket); =20 if (thread_threshold !=3D 0 && latency_us >=3D thread_threshold) - set_stop_tracing(); + set_stop_tracing(tp_args); } else { update_main_hist(&hist_user, bucket); update_summary(&summary_user, latency, bucket); diff --git a/tools/tracing/rtla/src/timerlat_bpf.c b/tools/tracing/rtla/src= /timerlat_bpf.c index e97d16646bcd..1d619e502c65 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.c +++ b/tools/tracing/rtla/src/timerlat_bpf.c @@ -59,6 +59,19 @@ int timerlat_bpf_init(struct timerlat_params *params) return 0; } =20 +/* + * timerlat_bpf_set_action - set action on threshold executed on BPF side + */ +static int timerlat_bpf_set_action(struct bpf_program *prog) +{ + unsigned int key =3D 0, value =3D bpf_program__fd(prog); + + return bpf_map__update_elem(bpf->maps.bpf_action, + &key, sizeof(key), + &value, sizeof(value), + BPF_ANY); +} + /* * timerlat_bpf_attach - attach BPF program to collect timerlat data */ diff --git a/tools/tracing/rtla/src/timerlat_bpf.h b/tools/tracing/rtla/src= /timerlat_bpf.h index 118487436d30..b5009092c7a3 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.h +++ b/tools/tracing/rtla/src/timerlat_bpf.h @@ -12,6 +12,7 @@ enum summary_field { }; =20 #ifndef __bpf__ +#include #ifdef HAVE_BPF_SKEL int timerlat_bpf_init(struct timerlat_params *params); int timerlat_bpf_attach(void); --=20 2.51.0 From nobody Sun Feb 8 06:55:57 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 CDB6430BBBF for ; Mon, 27 Oct 2025 15:34:24 +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=1761579266; cv=none; b=NKJ4dpjUBIApZsNWKvUGoU+f3IkA6QubDnZXzKGYBCpN9pvUY99+OfmIuzIKoUlMJFrMZgANiY2vfjbc9kYysnFf4fmQEEGPFJ99fx713rZ8FJjvzmtrMW1LfX6Djx4Q4psN0lYWluxLIzC+JyaQ0/z930RAwso1Ye28GNiuXlU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761579266; c=relaxed/simple; bh=DrtTcPaaONlvitINNzOtl7+O4J1J7ACmIWmosPpDBoo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FaoIdTcBq3HikXEwflmS1SpYw15GoxKRj8qx2fkEgP5SNDnEk5Bq+zkxPmbV+b41nK6Gl4sDPel4thukOJCID3iZCl5Ba9B4iFEoGgtNHzLFEHXhVnFQVgQtbt6g0NqCLMBKsbUmUXdn2fU//dLtjONKqLpThO9sboDB+iWApS8= 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=FpcqSJAA; 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="FpcqSJAA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761579263; 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: in-reply-to:in-reply-to:references:references; bh=Qn9DAbDJZJluNE63oWsS31K29+gHzG8u9dg7ZIjAzuc=; b=FpcqSJAApBN5YkQzCZBGMF19e9KZcZmX3qgZwv/LwhW795n7/daioNNHjgAkCLx8EDsy5E RHil6UU4pW0Hfi+f0eUo9eI5EDrI3DnpeVXXPCP64SCfhtBdTi5Rqj40YAG3mXQYCxUiGU ODaoYITcFXNDyBBp5NzF2uO5v4QUKhc= 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-558-ZCuYrMX4OZuAiwV1GG7Yfg-1; Mon, 27 Oct 2025 11:34:19 -0400 X-MC-Unique: ZCuYrMX4OZuAiwV1GG7Yfg-1 X-Mimecast-MFC-AGG-ID: ZCuYrMX4OZuAiwV1GG7Yfg_1761579258 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 983421800D88; Mon, 27 Oct 2025 15:34:18 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.137]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7EE6319540EB; Mon, 27 Oct 2025 15:34:15 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: LKML , Linux Trace Kernel , John Kacur , Luis Goncalves , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Arnaldo Carvalho de Melo , Tomas Glozar Subject: [PATCH v3 2/7] rtla/timerlat: Add --bpf-action option Date: Mon, 27 Oct 2025 16:33:56 +0100 Message-ID: <20251027153401.1039217-3-tglozar@redhat.com> In-Reply-To: <20251027153401.1039217-1-tglozar@redhat.com> References: <20251027153401.1039217-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.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" Add option --bpf-action that allows the user to attach an external BPF program that will be executed via BPF tail call on latency threshold overflow. Executing additional BPF code on latency threshold overflow allows doing doing low-latency and in-kernel troubleshooting of the cause of the overflow. The option takes an argument, which is a path to a BPF ELF file expected to contain a function named "action_handler" in a section named "tp/timerlat_action" (the section is necessary for libbpf to assign the correct BPF program type to it). Signed-off-by: Tomas Glozar Reviewed-by: Crystal Wood --- tools/tracing/rtla/src/timerlat.c | 11 ++++++ tools/tracing/rtla/src/timerlat.h | 2 +- tools/tracing/rtla/src/timerlat_bpf.c | 53 ++++++++++++++++++++++++++ tools/tracing/rtla/src/timerlat_bpf.h | 6 ++- tools/tracing/rtla/src/timerlat_hist.c | 5 +++ tools/tracing/rtla/src/timerlat_top.c | 5 +++ 6 files changed, 80 insertions(+), 2 deletions(-) diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/tim= erlat.c index b69212874127..6907a323f9ec 100644 --- a/tools/tracing/rtla/src/timerlat.c +++ b/tools/tracing/rtla/src/timerlat.c @@ -48,6 +48,17 @@ timerlat_apply_config(struct osnoise_tool *tool, struct = timerlat_params *params) } } =20 + /* Check if BPF action program is requested but BPF is not available */ + if (params->bpf_action_program) { + if (params->mode =3D=3D TRACING_MODE_TRACEFS) { + err_msg("BPF actions are not supported in tracefs-only mode\n"); + goto out_err; + } + + if (timerlat_load_bpf_action_program(params->bpf_action_program)) + goto out_err; + } + if (params->mode !=3D TRACING_MODE_BPF) { /* * In tracefs and mixed mode, timerlat tracer handles stopping diff --git a/tools/tracing/rtla/src/timerlat.h b/tools/tracing/rtla/src/tim= erlat.h index fd6065f48bb7..8dd5d134ce08 100644 --- a/tools/tracing/rtla/src/timerlat.h +++ b/tools/tracing/rtla/src/timerlat.h @@ -27,6 +27,7 @@ struct timerlat_params { int dump_tasks; int deepest_idle_state; enum timerlat_tracing_mode mode; + const char *bpf_action_program; }; =20 #define to_timerlat_params(ptr) container_of(ptr, struct timerlat_params, = common) @@ -36,4 +37,3 @@ int timerlat_main(int argc, char *argv[]); int timerlat_enable(struct osnoise_tool *tool); void timerlat_analyze(struct osnoise_tool *tool, bool stopped); void timerlat_free(struct osnoise_tool *tool); - diff --git a/tools/tracing/rtla/src/timerlat_bpf.c b/tools/tracing/rtla/src= /timerlat_bpf.c index 1d619e502c65..05adf18303df 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.c +++ b/tools/tracing/rtla/src/timerlat_bpf.c @@ -7,6 +7,10 @@ =20 static struct timerlat_bpf *bpf; =20 +/* BPF object and program for action program */ +static struct bpf_object *obj; +static struct bpf_program *prog; + /* * timerlat_bpf_init - load and initialize BPF program to collect timerlat= data */ @@ -96,6 +100,11 @@ void timerlat_bpf_detach(void) void timerlat_bpf_destroy(void) { timerlat_bpf__destroy(bpf); + bpf =3D NULL; + if (obj) + bpf_object__close(obj); + obj =3D NULL; + prog =3D NULL; } =20 static int handle_rb_event(void *ctx, void *data, size_t data_sz) @@ -190,4 +199,48 @@ int timerlat_bpf_get_summary_value(enum summary_field = key, bpf->maps.summary_user, key, value_irq, value_thread, value_user, cpus); } + +/* + * timerlat_load_bpf_action_program - load and register a BPF action progr= am + */ +int timerlat_load_bpf_action_program(const char *program_path) +{ + int err; + + obj =3D bpf_object__open_file(program_path, NULL); + if (!obj) { + err_msg("Failed to open BPF action program: %s\n", program_path); + goto out_err; + } + + err =3D bpf_object__load(obj); + if (err) { + err_msg("Failed to load BPF action program: %s\n", program_path); + goto out_obj_err; + } + + prog =3D bpf_object__find_program_by_name(obj, "action_handler"); + if (!prog) { + err_msg("BPF action program must have 'action_handler' function: %s\n", + program_path); + goto out_obj_err; + } + + err =3D timerlat_bpf_set_action(prog); + if (err) { + err_msg("Failed to register BPF action program: %s\n", program_path); + goto out_prog_err; + } + + return 0; + +out_prog_err: + prog =3D NULL; +out_obj_err: + bpf_object__close(obj); + obj =3D NULL; +out_err: + return 1; +} + #endif /* HAVE_BPF_SKEL */ diff --git a/tools/tracing/rtla/src/timerlat_bpf.h b/tools/tracing/rtla/src= /timerlat_bpf.h index b5009092c7a3..169abeaf4363 100644 --- a/tools/tracing/rtla/src/timerlat_bpf.h +++ b/tools/tracing/rtla/src/timerlat_bpf.h @@ -30,7 +30,7 @@ int timerlat_bpf_get_summary_value(enum summary_field key, long long *value_thread, long long *value_user, int cpus); - +int timerlat_load_bpf_action_program(const char *program_path); static inline int have_libbpf_support(void) { return 1; } #else static inline int timerlat_bpf_init(struct timerlat_params *params) @@ -58,6 +58,10 @@ static inline int timerlat_bpf_get_summary_value(enum su= mmary_field key, { return -1; } +static inline int timerlat_load_bpf_action_program(const char *program_pat= h) +{ + return -1; +} static inline int have_libbpf_support(void) { return 0; } #endif /* HAVE_BPF_SKEL */ #endif /* __bpf__ */ diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 606c1688057b..5e639cc34f64 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -763,6 +763,7 @@ static void timerlat_hist_usage(char *usage) " --deepest-idle-state n: only go down to idle state n on cpus used= by timerlat to reduce exit from idle latency", " --on-threshold : define action to be executed at latency = threshold, multiple are allowed", " --on-end : define action to be executed at measurement en= d, multiple are allowed", + " --bpf-action : load and execute BPF program when latency= threshold is exceeded", NULL, }; =20 @@ -853,6 +854,7 @@ static struct common_params {"deepest-idle-state", required_argument, 0, '\4'}, {"on-threshold", required_argument, 0, '\5'}, {"on-end", required_argument, 0, '\6'}, + {"bpf-action", required_argument, 0, '\7'}, {0, 0, 0, 0} }; =20 @@ -1062,6 +1064,9 @@ static struct common_params exit(EXIT_FAILURE); } break; + case '\7': + params->bpf_action_program =3D optarg; + break; default: timerlat_hist_usage("Invalid option"); } diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index fc479a0dcb59..da5d5db1bc17 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -521,6 +521,7 @@ static void timerlat_top_usage(char *usage) " --deepest-idle-state n: only go down to idle state n on cpus used= by timerlat to reduce exit from idle latency", " --on-threshold : define action to be executed at latency = threshold, multiple are allowed", " --on-end: define action to be executed at measurement end, multip= le are allowed", + " --bpf-action : load and execute BPF program when latency= threshold is exceeded", NULL, }; =20 @@ -603,6 +604,7 @@ static struct common_params {"deepest-idle-state", required_argument, 0, '8'}, {"on-threshold", required_argument, 0, '9'}, {"on-end", required_argument, 0, '\1'}, + {"bpf-action", required_argument, 0, '\2'}, {0, 0, 0, 0} }; =20 @@ -798,6 +800,9 @@ static struct common_params exit(EXIT_FAILURE); } break; + case '\2': + params->bpf_action_program =3D optarg; + break; default: timerlat_top_usage("Invalid option"); } --=20 2.51.0 From nobody Sun Feb 8 06:55:57 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 EE90830C637 for ; Mon, 27 Oct 2025 15:34:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761579267; cv=none; b=H0BZ491tjyi/a4T4waCh2JVqU304+L4v1G0iu87lN4nsJ5gXy3AI64YaH2KLpKfB0Snw/4/AG5Cz2VJrcWvoZEvAs0JIe1Yr6K1bC5YZt6r9mjBn+Hh0oWjLVQ8RxiSxJJ5oSGwmq1jZeSa8H08v4wr12f1yZKOert19VTBpsng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761579267; c=relaxed/simple; bh=H4YFI6jMBxuTfma66yvWdpil+xS6qySRpqzaahtkstw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gs+4BMVRzL0ME4IecFl4/EahdhyWQ99O64qNGLCWOE/c3x0/hOvuufzzBvcD2ayA83iYl2g71fkN2i3USDzmzO/oTHQXMmbaFmGiFZP/8SHvtp2CiQeExDqnJykYLC0a5hWoNd+0+klXKu9oqQHu0QJwJEJDFwDtd6Xa5Yt5//g= 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=f9ROXPmE; arc=none smtp.client-ip=170.10.129.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="f9ROXPmE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761579265; 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: in-reply-to:in-reply-to:references:references; bh=dkdOfBoeQUK++FxdaoJ0VFHifIEmAE6q/udIJ/iSXRc=; b=f9ROXPmEfMaRzNTrp7DwA5VK8VLUv2174d0hyEJddYqWWM5bbbHF2THBj+mJEcvIiseDnH WCPuTDfDg7XxHydRrGztoFqXox6OC0VIGjfclAL8gWuwNr/lnyUCENhguImLRwkORqgxtp jZ/KIadvNQ7NNplA/mbRVh7FJ6kDc5g= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-629-oP4RHh2zPC6ysJKkAhmKiw-1; Mon, 27 Oct 2025 11:34:23 -0400 X-MC-Unique: oP4RHh2zPC6ysJKkAhmKiw-1 X-Mimecast-MFC-AGG-ID: oP4RHh2zPC6ysJKkAhmKiw_1761579262 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 45ABB19560B2; Mon, 27 Oct 2025 15:34:22 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.137]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 130AA1955F1B; Mon, 27 Oct 2025 15:34:18 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: LKML , Linux Trace Kernel , John Kacur , Luis Goncalves , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Arnaldo Carvalho de Melo , Tomas Glozar Subject: [PATCH v3 3/7] rtla/timerlat: Add example for BPF action program Date: Mon, 27 Oct 2025 16:33:57 +0100 Message-ID: <20251027153401.1039217-4-tglozar@redhat.com> In-Reply-To: <20251027153401.1039217-1-tglozar@redhat.com> References: <20251027153401.1039217-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.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" Add an example BPF action program that prints the measured latency to the tracefs buffer via bpf_printk(). A new Makefile target, "examples", is added to build the example. In addition, "sample/" subfolder is renamed to "example". If BPF skeleton support is unavailable or disabled, a warning will be displayed when building the BPF action program example. Signed-off-by: Tomas Glozar Reviewed-by: Crystal Wood --- tools/tracing/rtla/Makefile | 9 ++++++++- tools/tracing/rtla/example/timerlat_bpf_action.c | 16 ++++++++++++++++ .../rtla/{sample =3D> example}/timerlat_load.py | 0 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tools/tracing/rtla/example/timerlat_bpf_action.c rename tools/tracing/rtla/{sample =3D> example}/timerlat_load.py (100%) diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile index 746ccf2f5808..5f1529ce3693 100644 --- a/tools/tracing/rtla/Makefile +++ b/tools/tracing/rtla/Makefile @@ -73,9 +73,15 @@ src/timerlat.bpf.o: src/timerlat.bpf.c =20 src/timerlat.skel.h: src/timerlat.bpf.o $(QUIET_GENSKEL)$(SYSTEM_BPFTOOL) gen skeleton $< > $@ + +example/timerlat_bpf_action.o: example/timerlat_bpf_action.c + $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -c $(filter %.c,$^) -o $@ else src/timerlat.skel.h: $(Q)echo '/* BPF skeleton is disabled */' > src/timerlat.skel.h + +example/timerlat_bpf_action.o: example/timerlat_bpf_action.c + $(Q)echo "BPF skeleton support is disabled, skipping example/timerlat_bpf= _action.o" endif =20 $(RTLA): $(RTLA_IN) @@ -96,7 +102,8 @@ clean: doc_clean fixdep-clean $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d= ' -delete $(Q)rm -f rtla rtla-static fixdep FEATURE-DUMP rtla-* $(Q)rm -rf feature - $(Q)rm -f src/timerlat.bpf.o src/timerlat.skel.h + $(Q)rm -f src/timerlat.bpf.o src/timerlat.skel.h example/timerlat_bpf_act= ion.o check: $(RTLA) RTLA=3D$(RTLA) prove -o -f tests/ +examples: example/timerlat_bpf_action.o .PHONY: FORCE clean check diff --git a/tools/tracing/rtla/example/timerlat_bpf_action.c b/tools/traci= ng/rtla/example/timerlat_bpf_action.c new file mode 100644 index 000000000000..ac1be049a848 --- /dev/null +++ b/tools/tracing/rtla/example/timerlat_bpf_action.c @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include + +char LICENSE[] SEC("license") =3D "GPL"; + +struct trace_event_raw_timerlat_sample { + unsigned long long timer_latency; +} __attribute__((preserve_access_index)); + +SEC("tp/timerlat_action") +int action_handler(struct trace_event_raw_timerlat_sample *tp_args) +{ + bpf_printk("Latency: %lld\n", tp_args->timer_latency); + return 0; +} diff --git a/tools/tracing/rtla/sample/timerlat_load.py b/tools/tracing/rtl= a/example/timerlat_load.py similarity index 100% rename from tools/tracing/rtla/sample/timerlat_load.py rename to tools/tracing/rtla/example/timerlat_load.py --=20 2.51.0 From nobody Sun Feb 8 06:55:57 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 EBE9E30DD3B for ; Mon, 27 Oct 2025 15:34:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761579270; cv=none; b=uFvT2WWLWkGSNv4/F7bN9LjjfMACBZkz1UhbSJYsXU+A03YUNd/pUexEo4Gm2y4PU7TXP5lYtQ4nFum7NKuL8vs1LQAY0vXsh5g00znPb2Bi70gBT4hcdSpYres4CnlPvtkDVPJlBc/EvSwn5Hn667ejwHINI5pSZm9rb8YqEqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761579270; c=relaxed/simple; bh=2oQSV9XgUGkg6jQHRe1t9svN3YE2EGz+HNiqFyAIsag=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eUyzp/cqkQVYuhghl9Pf2tOY7QJWdr49s5QtRCxZ18x1gxe7hxpa1W0gU2jRvbdTvju9UzZc1qThBtBb2R++aP3aUV+r4domIB0ZmlOqrLKeuEvbJmlKm1RHH5srWZqbWohLJQB8/Kr7yYRcWi9XdNFlKElF9WBbWBT/wLa3mCk= 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=KA7FsxZb; arc=none smtp.client-ip=170.10.129.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="KA7FsxZb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761579268; 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: in-reply-to:in-reply-to:references:references; bh=N/iHIiffeDazbY91Xe6Oc1ltPdWNmNo+bcnVBjuCQOQ=; b=KA7FsxZbUW7wpMa4Mq2iHl09WkxGhzwYPuo0ncnEeDlhTRnxuZyBSQd2RjhlTBkAjGfR24 rCQe8WojQsTACvc03yJlI9X9vT2gWEcUpDJGRmxyk27ZshOvcaNDDDlDB+TBoKKE9b+vZQ 9U7S2NIAFjuLPd+oHwS/q89dqvEa5e8= 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-661-JT-FdNv1My2H-oWw3gXg2g-1; Mon, 27 Oct 2025 11:34:26 -0400 X-MC-Unique: JT-FdNv1My2H-oWw3gXg2g-1 X-Mimecast-MFC-AGG-ID: JT-FdNv1My2H-oWw3gXg2g_1761579266 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 D1CBE18001D6; Mon, 27 Oct 2025 15:34:25 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.137]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B51AF1955F1B; Mon, 27 Oct 2025 15:34:22 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: LKML , Linux Trace Kernel , John Kacur , Luis Goncalves , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Arnaldo Carvalho de Melo , Tomas Glozar Subject: [PATCH v3 4/7] rtla/tests: Test BPF action program Date: Mon, 27 Oct 2025 16:33:58 +0100 Message-ID: <20251027153401.1039217-5-tglozar@redhat.com> In-Reply-To: <20251027153401.1039217-1-tglozar@redhat.com> References: <20251027153401.1039217-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.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" Add a test that implements a BPF program writing to a test map, which is attached to RTLA via --bpf-action to be executed on theshold overflow. A combination of --on-threshold shell with bpftool (which is always present if BPF support is enabled) is used to check whether the BPF program has executed successfully. Suggested-by: Crystal Wood Signed-off-by: Tomas Glozar Reviewed-by: Crystal Wood --- tools/tracing/rtla/Makefile | 10 ++++++-- tools/tracing/rtla/tests/bpf/bpf_action_map.c | 25 +++++++++++++++++++ tools/tracing/rtla/tests/timerlat.t | 15 +++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 tools/tracing/rtla/tests/bpf/bpf_action_map.c diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile index 5f1529ce3693..aef814b639b7 100644 --- a/tools/tracing/rtla/Makefile +++ b/tools/tracing/rtla/Makefile @@ -76,12 +76,18 @@ src/timerlat.skel.h: src/timerlat.bpf.o =20 example/timerlat_bpf_action.o: example/timerlat_bpf_action.c $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -c $(filter %.c,$^) -o $@ + +tests/bpf/bpf_action_map.o: tests/bpf/bpf_action_map.c + $(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -c $(filter %.c,$^) -o $@ else src/timerlat.skel.h: $(Q)echo '/* BPF skeleton is disabled */' > src/timerlat.skel.h =20 example/timerlat_bpf_action.o: example/timerlat_bpf_action.c $(Q)echo "BPF skeleton support is disabled, skipping example/timerlat_bpf= _action.o" + +tests/bpf/bpf_action_map.o: tests/bpf/bpf_action_map.c + $(Q)echo "BPF skeleton support is disabled, skipping tests/bpf/bpf_action= _map.o" endif =20 $(RTLA): $(RTLA_IN) @@ -103,7 +109,7 @@ clean: doc_clean fixdep-clean $(Q)rm -f rtla rtla-static fixdep FEATURE-DUMP rtla-* $(Q)rm -rf feature $(Q)rm -f src/timerlat.bpf.o src/timerlat.skel.h example/timerlat_bpf_act= ion.o -check: $(RTLA) - RTLA=3D$(RTLA) prove -o -f tests/ +check: $(RTLA) tests/bpf/bpf_action_map.o + RTLA=3D$(RTLA) BPFTOOL=3D$(SYSTEM_BPFTOOL) prove -o -f tests/ examples: example/timerlat_bpf_action.o .PHONY: FORCE clean check diff --git a/tools/tracing/rtla/tests/bpf/bpf_action_map.c b/tools/tracing/= rtla/tests/bpf/bpf_action_map.c new file mode 100644 index 000000000000..1686e0b858e6 --- /dev/null +++ b/tools/tracing/rtla/tests/bpf/bpf_action_map.c @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include + +char LICENSE[] SEC("license") =3D "GPL"; + +struct { + __uint(type, BPF_MAP_TYPE_ARRAY); + __uint(max_entries, 1); + __type(key, unsigned int); + __type(value, unsigned long long); +} rtla_test_map SEC(".maps"); + +struct trace_event_raw_timerlat_sample; + +SEC("tp/timerlat_action") +int action_handler(struct trace_event_raw_timerlat_sample *tp_args) +{ + unsigned int key =3D 0; + unsigned long long value =3D 42; + + bpf_map_update_elem(&rtla_test_map, &key, &value, BPF_ANY); + + return 0; +} diff --git a/tools/tracing/rtla/tests/timerlat.t b/tools/tracing/rtla/tests= /timerlat.t index b5d1e7260a9b..89e28cc6df82 100644 --- a/tools/tracing/rtla/tests/timerlat.t +++ b/tools/tracing/rtla/tests/timerlat.t @@ -67,6 +67,21 @@ 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" \ "timerlat top -d 1s --on-end trace" 0 "^ Saving trace to timerlat_trace.= txt$" + +# BPF action program tests +if [ "$option" -eq 0 ] +then + # Test BPF action program properly in BPF mode + [ -z "$BPFTOOL" ] && BPFTOOL=3Dbpftool + check "hist with BPF action program (BPF mode)" \ + "timerlat hist -T 2 --bpf-action tests/bpf/bpf_action_map.o --on-thresho= ld shell,command=3D'$BPFTOOL map dump name rtla_test_map'" \ + 2 '"value": 42' +else + # Test BPF action program failure in non-BPF mode + check "hist with BPF action program (non-BPF mode)" \ + "timerlat hist -T 2 --bpf-action tests/bpf/bpf_action_map.o" \ + 1 "BPF actions are not supported in tracefs-only mode" +fi done =20 test_end --=20 2.51.0 From nobody Sun Feb 8 06:55:57 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 E356330E856 for ; Mon, 27 Oct 2025 15:34:35 +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=1761579277; cv=none; b=KQ1poge6rbD/tr14wFnpEjZMpGBoWyBTdh5/9AYHlhBqmAfcYSYkEMzDxybBOHSkkbbqkBIAdIuzrbQQst43LijE01O0rPpmHSmY0E2NROCE0Kb84bAHtvAwO4895FfbradnWlTswkuPaTX7iTmrQZGIv62lfOwUAPFm9TJ0DX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761579277; c=relaxed/simple; bh=YMf+9R/PB7Rn/nSanJ1qN6xwBpW1JxcXcqf/9NeCKjQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eOSJs/yAusNFGeueQO7suoJPaoTieY/F4yCGSC79QIe7U0GaBjcL05w0M1C/neAgkoDpQvvcw8o7ewWmmBtros2evVbNYKGWaQZyMmXdeo9z6K/Rxk9AyfkROiyCSknzgDeptA0cuOvK0m50tqLHfOnVwqM7v2talp4TDhe2EsY= 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=GnmvUMgd; 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="GnmvUMgd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761579274; 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: in-reply-to:in-reply-to:references:references; bh=RSN84v7pXU4iL2XOp2r81stsd6YXOv55W/nDN5c8mgU=; b=GnmvUMgdakfxMxinpIhUaGKiFX+2je2eYwtAmsjXucxT57R20Tm/ShunIGEcKwLGoy+dr4 PW9vECID5/5o3NXENlSCGtfxbuu9iRgDse0o8Qh3E2VWt00F5wNyk7L5RvYZjsbU1zKOEU NlMy7Vg0qj8Ibwn69rC9RTC9ZEjbGJo= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-304-xoKuXJJQM4CUYuUx_eblBQ-1; Mon, 27 Oct 2025 11:34:31 -0400 X-MC-Unique: xoKuXJJQM4CUYuUx_eblBQ-1 X-Mimecast-MFC-AGG-ID: xoKuXJJQM4CUYuUx_eblBQ_1761579270 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2E4D219540DF; Mon, 27 Oct 2025 15:34:30 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.137]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5DD0E195398C; Mon, 27 Oct 2025 15:34:26 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: LKML , Linux Trace Kernel , John Kacur , Luis Goncalves , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Arnaldo Carvalho de Melo , Tomas Glozar Subject: [PATCH v3 5/7] rtla/tests: Run Test::Harness in verbose mode Date: Mon, 27 Oct 2025 16:33:59 +0100 Message-ID: <20251027153401.1039217-6-tglozar@redhat.com> In-Reply-To: <20251027153401.1039217-1-tglozar@redhat.com> References: <20251027153401.1039217-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.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" Add -v flag to prove command to also print the names of tests that succeeded, not only those that failed, to allow easier debugging of the test suite. Also, drop printing the option and value to stdout in check_with_osnoise_options, which was a debugging print that was accidentally left in the final commit, and which would be otherwise now visible in make check output, as stdout is no longer suppressed. Suggested-by: Crystal Wood Signed-off-by: Tomas Glozar Reviewed-by: Crystal Wood Reviewed-by: Wander Lairson Costa --- tools/tracing/rtla/Makefile | 2 +- tools/tracing/rtla/tests/engine.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile index aef814b639b7..2701256abaf3 100644 --- a/tools/tracing/rtla/Makefile +++ b/tools/tracing/rtla/Makefile @@ -110,6 +110,6 @@ clean: doc_clean fixdep-clean $(Q)rm -rf feature $(Q)rm -f src/timerlat.bpf.o src/timerlat.skel.h example/timerlat_bpf_act= ion.o check: $(RTLA) tests/bpf/bpf_action_map.o - RTLA=3D$(RTLA) BPFTOOL=3D$(SYSTEM_BPFTOOL) prove -o -f tests/ + RTLA=3D$(RTLA) BPFTOOL=3D$(SYSTEM_BPFTOOL) prove -o -f -v tests/ examples: example/timerlat_bpf_action.o .PHONY: FORCE clean check diff --git a/tools/tracing/rtla/tests/engine.sh b/tools/tracing/rtla/tests/= engine.sh index c7de3d6ed6a8..ed261e07c6d9 100644 --- a/tools/tracing/rtla/tests/engine.sh +++ b/tools/tracing/rtla/tests/engine.sh @@ -105,7 +105,6 @@ check_with_osnoise_options() { [ "$1" =3D=3D "" ] && continue option=3D$(echo $1 | cut -d '=3D' -f 1) value=3D$(echo $1 | cut -d '=3D' -f 2) - echo "option: $option, value: $value" echo "$value" > "/sys/kernel/tracing/osnoise/$option" || return 1 done fi --=20 2.51.0 From nobody Sun Feb 8 06:55:57 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 048B930EF85 for ; Mon, 27 Oct 2025 15:34:37 +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=1761579280; cv=none; b=nrmbHRE1SM2nDeKQQPz9Zu/MgoxCo0J5bLnTN/yAaBzYypWB7lQNYkdqnCqECm7TRu/V8PtEhXWZVB5ddBFjgX31Co3hMPzXGy+Ynv0q5Fb0BLC48AuUjgoYtbyZLCN9qmQfC09Ga3S4IKY4d9ZhnskLO5QF8x/W5f03Svk5Pmc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761579280; c=relaxed/simple; bh=E4UmDRrfK427SBmAu3QgG9274GYyOCRnkLTnbkQSZ48=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EUJRhBG5+k/wbx7+xkcZKPPIzRgfc8xjG1HkA22ihGItIPCwiWyPKvykPPBONWA6STWyq0Zf5jYDylDy1NBlbYR9jsPCDCt3c6czqO+13naHDliOmxv60KtpyiW3RkK5NcOWPUsaUzqD8ryTYL5Recx1RlassHTscVR+GSmjk7Q= 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=d18Jgdoq; 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="d18Jgdoq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761579276; 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: in-reply-to:in-reply-to:references:references; bh=Z8kAhx3O+cWF32TZgKmRfF3DYFNfvgUR9bkHyjA8PvA=; b=d18Jgdoqe7Aun30kkEkUDu0ukkMIN7pVOiwFbUHFh2PDc7S7c2FBeF9VWMV0ZsCwG1v/te Od5i+joSYx+ywq9E2p2Ket62zQCKsmX+SMjqZK97qsid+Pkzbx6wptASLeDWROBzEYzTsq 2O6xV4ySCBjJkyxS6PEn16R1wvEpWcU= Received: from mx-prod-mc-06.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-624-NvjvoCvuOj2zeU0NjRNbkQ-1; Mon, 27 Oct 2025 11:34:35 -0400 X-MC-Unique: NvjvoCvuOj2zeU0NjRNbkQ-1 X-Mimecast-MFC-AGG-ID: NvjvoCvuOj2zeU0NjRNbkQ_1761579274 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 40A4E180A224; Mon, 27 Oct 2025 15:34:34 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.137]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CB21419539B2; Mon, 27 Oct 2025 15:34:30 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: LKML , Linux Trace Kernel , John Kacur , Luis Goncalves , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Arnaldo Carvalho de Melo , Tomas Glozar Subject: [PATCH v3 6/7] Documentation/rtla: Rename sample/ to example/ Date: Mon, 27 Oct 2025 16:34:00 +0100 Message-ID: <20251027153401.1039217-7-tglozar@redhat.com> In-Reply-To: <20251027153401.1039217-1-tglozar@redhat.com> References: <20251027153401.1039217-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.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" The sample/ directory in tools/tracing/rtla was renamed to example/ in an earlier commit. Rename it also in the documentation. Signed-off-by: Tomas Glozar Reviewed-by: Crystal Wood Reviewed-by: Wander Lairson Costa --- Documentation/tools/rtla/common_timerlat_options.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/tools/rtla/common_timerlat_options.rst b/Documen= tation/tools/rtla/common_timerlat_options.rst index 1f5d024b53aa..c6046fcf52dc 100644 --- a/Documentation/tools/rtla/common_timerlat_options.rst +++ b/Documentation/tools/rtla/common_timerlat_options.rst @@ -64,4 +64,4 @@ =20 Set timerlat to run without workload, waiting for the user to disp= atch a per-cpu task that waits for a new period on the tracing/osnoise/per_cpu/cp= u$ID/timerlat_fd. - See linux/tools/rtla/sample/timerlat_load.py for an example of use= r-load code. + See linux/tools/rtla/example/timerlat_load.py for an example of us= er-load code. --=20 2.51.0 From nobody Sun Feb 8 06:55:57 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 BEF1A30E856 for ; Mon, 27 Oct 2025 15:34:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761579283; cv=none; b=fHY8oXRa05c8/TcXy/jJK5dDhn24HH7i6oSXnLCtD6U2tlkbnJM13eH8w9Mh69TMdqcnaqY3K5tQvTU7GEa7y47oqb1xA+dNLcL0txbXZHSPWvrGz//5Zgbn3uPk56wGgbB+6Uc3eYNzVXeMq7or2xof21LuWeS9zL/IuM6rqsI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761579283; c=relaxed/simple; bh=89ucxqi8UIsE4Lu6FVkMFUShD/uliEoam2sKnl0i6sM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SkbRN6P+V0ytcJ3fgDXNIQJmc4WjbnGY23Y4MbUCYPHgW2HTZlh4irC4+YJPC1peuWL+uIZXndh57CYBxMS0V/AktSpn0lpUFnO+Uy9JlNemB8oyz2Gtmn2KRzfA6bE4BEF/KXnPFbfvr7iDmXwTeE4TNX5qZNuxWJvH/ERZhPw= 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=gFXXYxfP; arc=none smtp.client-ip=170.10.129.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="gFXXYxfP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761579280; 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: in-reply-to:in-reply-to:references:references; bh=+CRXrGVKrG927a4Z2bRgFJY9SvFsbOnohlu9r+MEylo=; b=gFXXYxfPwpZeCcxnVaz9P3K5xxyU49sYcwFAQOqoh9bmdSVZrblh9amKaEx1mYg9ylzZ1W gm0GrkgNtA4vGBU6FW9aO0z1R30h+IoDka0VL0nk9ygcksqEMoF69sEYx6MxE8tWqTscVn AtYPTLABJ/0WzOQBNi6TqkID96tIuMQ= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-383-jWuY3DnLN8OGXWU_4Dno7w-1; Mon, 27 Oct 2025 11:34:39 -0400 X-MC-Unique: jWuY3DnLN8OGXWU_4Dno7w-1 X-Mimecast-MFC-AGG-ID: jWuY3DnLN8OGXWU_4Dno7w_1761579278 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1054019540D1; Mon, 27 Oct 2025 15:34:38 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.137]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CCC0A1955F1B; Mon, 27 Oct 2025 15:34:34 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: LKML , Linux Trace Kernel , John Kacur , Luis Goncalves , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Arnaldo Carvalho de Melo , Tomas Glozar Subject: [PATCH v3 7/7] Documentation/rtla: Document --bpf-action option Date: Mon, 27 Oct 2025 16:34:01 +0100 Message-ID: <20251027153401.1039217-8-tglozar@redhat.com> In-Reply-To: <20251027153401.1039217-1-tglozar@redhat.com> References: <20251027153401.1039217-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.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" Add new option --bpf-action into common_timerlat_options.txt, including the format in which it takes the BPF program, and a reference to an example. Signed-off-by: Tomas Glozar Reviewed-by: Crystal Wood --- .../tools/rtla/common_timerlat_options.rst | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Documentation/tools/rtla/common_timerlat_options.rst b/Documen= tation/tools/rtla/common_timerlat_options.rst index c6046fcf52dc..7e08a27e87fe 100644 --- a/Documentation/tools/rtla/common_timerlat_options.rst +++ b/Documentation/tools/rtla/common_timerlat_options.rst @@ -65,3 +65,23 @@ Set timerlat to run without workload, waiting for the user to disp= atch a per-cpu task that waits for a new period on the tracing/osnoise/per_cpu/cp= u$ID/timerlat_fd. See linux/tools/rtla/example/timerlat_load.py for an example of us= er-load code. + +**--bpf-action** *bpf-program* + + Loads a BPF program from an ELF file and executes it when a latenc= y threshold is exceeded. + + The BPF program must be a valid ELF file loadable with libbpf. The= program must contain + a function named ``action_handler``, declared with ``SEC("tp/timer= lat_action")`` or + a different section name beginning with "tp/". This tells libbpf t= hat the program type is + BPF_PROG_TYPE_TRACEPOINT, without it, the program will not be load= ed properly. + + The program receives a ``struct trace_event_raw_timerlat_sample`` = parameter + containing timerlat sample data. + + An example is provided in ``tools/tracing/rtla/example/timerlat_bp= f_action.c``. + This example demonstrates how to create a BPF program that prints = latency information using + bpf_trace_printk() when a threshold is exceeded. + + **Note**: BPF actions require BPF support to be available. If BPF = is not available + or disabled, the tool will fall back to tracefs mode and BPF actio= ns will not be + supported. --=20 2.51.0