From nobody Sun Feb 8 00:49:36 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 79757296BB6 for ; Mon, 27 Oct 2025 14:48:48 +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=1761576531; cv=none; b=jjZiClN4FNDu+h5ceaT2JUWlxOYVs5cDEau0n62llFKM+Fo8yMp8t5nT3j9Js2UTbXwC5mOO5+5Qi1wNEwkvCGFp/yqGWStlkh5nGRU7HvkMN4gb0UPz6ESMBAAt18XJyh31Ta391ynMNVem+BiMYJnezAIBr6BcCFUTMFU22Rc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761576531; c=relaxed/simple; bh=rGu5A3OU4ZSpORG0UAOqi+ojq3qcrJOfyOMyESOti20=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yp/q8fPUZuzDd6O/YjOJ1c35ufXE5vA3beYZRCHwPrdkEcHS746emyLuhMLc85krqJOCUxgf5WIpdK6E/svvcUP/i+GJ9l8ilp+DWaWMowWMnG7p01rhFCy2MA1woHPrBWKnIHKFDKLru35X+kehkChAkR1GNbdpA7+uT5XKa7M= 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=BVBlDJAw; 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="BVBlDJAw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761576527; 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=BVBlDJAwP8lNAvVzPywp0uJXnUx4+4uc1GpU1Wer/oNbddm2MQZdkCDE0qvY/hWDewn2TI MFLLbLYXQqBN00w+v19b3BAyLPFygmlgdPuvEjhSSaJVO1heXfZuSIT2671m6jqOnuBpMr j01qeER7egUOWtOWyXMOYgEu+6HbwSo= 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-688-1tFd7PKDNhCpee1abHuv5Q-1; Mon, 27 Oct 2025 10:48:44 -0400 X-MC-Unique: 1tFd7PKDNhCpee1abHuv5Q-1 X-Mimecast-MFC-AGG-ID: 1tFd7PKDNhCpee1abHuv5Q_1761576523 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 F188A18089A5; Mon, 27 Oct 2025 14:48:42 +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 0BD3E19540EB; Mon, 27 Oct 2025 14:48:39 +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 v2 1/7] rtla/timerlat: Support tail call from BPF program Date: Mon, 27 Oct 2025 15:48:13 +0100 Message-ID: <20251027144819.1034041-2-tglozar@redhat.com> In-Reply-To: <20251027144819.1034041-1-tglozar@redhat.com> References: <20251027144819.1034041-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 --- 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 00:49:36 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 4B1322C21CC for ; Mon, 27 Oct 2025 14:48:51 +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=1761576534; cv=none; b=CVqEIfWJUVkvDixJwo/0Rg21SBzwUkktQ20Amc//9gLKf6JiWKffAyJHMJW9nyPwBVwjB8tGqgDBOn0LPBziyT7Zmo82okyrt6Z4Advu/wduyayeFq8Y6ikShgF4Pj5+A/WnqF0fH+1o1MiDsVYhVLVaiMWNCyNf23Iqv33Q2XE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761576534; c=relaxed/simple; bh=DrtTcPaaONlvitINNzOtl7+O4J1J7ACmIWmosPpDBoo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OKUJAThWutUREUr+6+Ctj5/vodMqMZEZE6F91wJSDLRavzKJB8l1/PMjpfS+Hi8s2V4d2bCnrcAGJdv88e5nuxDKlgcfNIq/t19uZO441YHsAC4SzGpNodYQDcYmBDlq2eIfHwA/a6ClXCBFkIeZNXGjyh22GIwc4N5ZPO6WlcY= 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=H5ZT5KmX; 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="H5ZT5KmX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761576531; 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=H5ZT5KmXblRbGyBWMHeldh8Xtj72yjnkN2EeBY4T8gOaG5AfzYxL0b8h8YtFs8Us3rdpIM 8sVo2AWN1ZDgy/60s1ku3zTHalZ456va5YyiMuiH9bcFWFrEkwqhdCHY3Fje0cG9Jkjt0t VSn/scXXaCYH6s5OgBQbAZpKCI47CGw= 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-85-W0AUlqXgMdWOl5FSIHFyIg-1; Mon, 27 Oct 2025 10:48:47 -0400 X-MC-Unique: W0AUlqXgMdWOl5FSIHFyIg-1 X-Mimecast-MFC-AGG-ID: W0AUlqXgMdWOl5FSIHFyIg_1761576526 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 6B7C2180121B; Mon, 27 Oct 2025 14:48:46 +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 82BB51955F1B; Mon, 27 Oct 2025 14:48:43 +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 v2 2/7] rtla/timerlat: Add --bpf-action option Date: Mon, 27 Oct 2025 15:48:14 +0100 Message-ID: <20251027144819.1034041-3-tglozar@redhat.com> In-Reply-To: <20251027144819.1034041-1-tglozar@redhat.com> References: <20251027144819.1034041-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 --- 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 00:49:36 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 BA5982D2493 for ; Mon, 27 Oct 2025 14:48:56 +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=1761576538; cv=none; b=gZiq4iJOKI4eFi3xWlnXu/ZJz4UgsRGcCouTaKFtTeSy6QKScOH7HgRY5H3ZJ5bKCQ24jUeYm3UJ679LsRyx124hs2JUUeHD60fuaSDcR+Dq2X1MIPBr4eVGCNUsgj2GqtSqzmIHKkroepjgHkQbSShnprLuMw1aYxdEmIwM9cE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761576538; c=relaxed/simple; bh=H4YFI6jMBxuTfma66yvWdpil+xS6qySRpqzaahtkstw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MFLahiGbhDOhj866FRc3RyH8+xdJ19HcG1yqXfGjymsSVBBqw/FbELppChFtGTj4cBmvrxzvcpo9xqvHvEgKDHvjAigEem6Kk89+O8ILuWXqW2hdQbPU3/cW7Lq3QOd/FkFvuShR1DvQqSR/k29oSK4JZ6LUTulgsLUnBl91QE0= 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=Dpd9R3Xe; 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="Dpd9R3Xe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761576536; 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=Dpd9R3XeR/ZIS+6AQs5U5i8nVMMFCFyaYaJMouu6h6z8Nt6tZB9+zEEq63kh3RGtZ+dPxI 2wBE/Va8BQvN8C7X1WhT0hYMxwfovJg+TbT1oRnaLcpXP/zBzTnDNQwj+jHDVd5OtS+agT oYEw6FHHGAigp+ojU4eBucT70g1fR2U= 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-302-wmAMHQNYOjGQEUBYrHpqKw-1; Mon, 27 Oct 2025 10:48:51 -0400 X-MC-Unique: wmAMHQNYOjGQEUBYrHpqKw-1 X-Mimecast-MFC-AGG-ID: wmAMHQNYOjGQEUBYrHpqKw_1761576530 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 293971800743; Mon, 27 Oct 2025 14:48:50 +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 DAEB0195398C; Mon, 27 Oct 2025 14:48:46 +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 v2 3/7] rtla/timerlat: Add example for BPF action program Date: Mon, 27 Oct 2025 15:48:15 +0100 Message-ID: <20251027144819.1034041-4-tglozar@redhat.com> In-Reply-To: <20251027144819.1034041-1-tglozar@redhat.com> References: <20251027144819.1034041-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 --- 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 00:49:36 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 F25352D1916 for ; Mon, 27 Oct 2025 14:48:58 +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=1761576540; cv=none; b=Xz8UeBShn3As/7gKnXtqlWRLkUhDzhuRiNskUcpt9/mDkAwcIECoPDCYv4qhA2saLqWzsOZASIdVQKTMRqlSnDr3uc8akVpFtpJQ3qXK6UMzMsizYpPZt6tT0CCISrmoa+G/BnuuJ+G+t3CjhmPdtRiEeyckuQzrjtOQgPDR4Mo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761576540; c=relaxed/simple; bh=UBJ/37A7WlMN9ZjPjuDzh79HvqMoDgHgJ6Zw2w7kmsw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cSo7O8Vi6fVKLhxLA6GTtzl6NOXYvrOC4aBHK7kDFXosWNe5BQRn/kzyFBJLbCrG9WL4k0l+tEhvVN5pWfFQHw20/gQtEXTywUEf/xZVOJPvzroNhXfrWn15FWXhTLiZQZTu3sIqvNLypxSpbDDKYVLPdH2+WiHXpsD8YTsK8FY= 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=PKOLcxca; 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="PKOLcxca" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761576537; 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=+nSe6Dqx1Zz4gyONo9npX6Dn7VQSJT1f+7SYleKGnDM=; b=PKOLcxcaf5Eam/GpVobzp4tpOQEmBSVtCD7RkGNymLk3WhqpuUeV83KWbl1lkhqpKXYeJ5 U/LAr+kQ/g6vwu/2ghk23QmcG9HcvxnvmBpl6tHiQH+N3PnDxan9g1aQow9uPhy+V7KFBi PPMk49gKkT+kWAVJHnYqN+AYmFBUyYg= 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-148-PVPl4-dmPWyoC_XdtBQKtg-1; Mon, 27 Oct 2025 10:48:54 -0400 X-MC-Unique: PVPl4-dmPWyoC_XdtBQKtg-1 X-Mimecast-MFC-AGG-ID: PVPl4-dmPWyoC_XdtBQKtg_1761576533 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 7680419541BD; Mon, 27 Oct 2025 14:48:53 +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 8EE8A19540EB; Mon, 27 Oct 2025 14:48:50 +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 v2 4/7] rtla/tests: Test BPF action program Date: Mon, 27 Oct 2025 15:48:16 +0100 Message-ID: <20251027144819.1034041-5-tglozar@redhat.com> In-Reply-To: <20251027144819.1034041-1-tglozar@redhat.com> References: <20251027144819.1034041-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 --- tools/tracing/rtla/Makefile | 10 ++++++++-- tools/tracing/rtla/tests/timerlat.t | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) 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/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 00:49:36 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 AE9612C11CD for ; Mon, 27 Oct 2025 14:49: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=1761576544; cv=none; b=Vl0nRZ9qE1KaeTNKjJ7dSrzcqCjinjvn6nJyMmumpF1fs3SCwcTNEVg0HF6ku97iHlBGxxFo831nCq61IIiSwgY/eLKBzQbtI0voGQFVczXV6k2fK57d4tiE9xAQ0sjq4Ja2NmuQEb3jQNOkGDrT6NhrnV50S81WzSbkJuFDOGo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761576544; c=relaxed/simple; bh=YMf+9R/PB7Rn/nSanJ1qN6xwBpW1JxcXcqf/9NeCKjQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JoXYh1fzZph1ktiv1sKceS4/9xdWbPmvoM7hiPJL3z9TgEE6w0kjb53zBFOsI+N+Ee/Y3snpFhIEI3ULceilSRsYAGMtLlpqKkf24nP5KdOfNk+Xzkwe7iaG8oEQl+9HVuo2gyHodRb2ufQdUVaTRhHgt4u+kBeWJsCUXHKX4GQ= 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=PhJ+82Nb; 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="PhJ+82Nb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761576541; 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=PhJ+82NbFhAZ7TdSIxizIQ0KRbsQSaa2LfZlhhxzW90aE/qe8v2GDsQbQCMSDYFwOB/Vv1 5CC/qhvou5fXsFe1rbTljNNfb3Qt2GZ66M903HVxjLZQv5fVw2gacsjB4gCcB6TOoBIERS c3ijOmUnsHx8MTwlHRn0X4ytpAdaMAs= 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-612-0k8VIRHROMutYg2ed3q6Aw-1; Mon, 27 Oct 2025 10:48:58 -0400 X-MC-Unique: 0k8VIRHROMutYg2ed3q6Aw-1 X-Mimecast-MFC-AGG-ID: 0k8VIRHROMutYg2ed3q6Aw_1761576537 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 4EA3B1809A03; Mon, 27 Oct 2025 14:48:57 +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 E58611955F1B; Mon, 27 Oct 2025 14:48:53 +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 v2 5/7] rtla/tests: Run Test::Harness in verbose mode Date: Mon, 27 Oct 2025 15:48:17 +0100 Message-ID: <20251027144819.1034041-6-tglozar@redhat.com> In-Reply-To: <20251027144819.1034041-1-tglozar@redhat.com> References: <20251027144819.1034041-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 --- 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 00:49:36 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 D6BE82C235A for ; Mon, 27 Oct 2025 14:49:06 +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=1761576548; cv=none; b=W/fUTbEXSahJSh0OEwcQikr1FyFXvfLkfUjOJHtUjdTb5MnSBeXmZIMJ898AbD5OJqZX7BaQLIFNQDG3fxpipkHgzwoncB6Tq0ESUJ9XhUcwUT7EBlqIZwRw2NRKpbUJ22QZJuwbvsNd1HuxM016VcYEM1+BdzB71xx75mlAgUQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761576548; c=relaxed/simple; bh=E4UmDRrfK427SBmAu3QgG9274GYyOCRnkLTnbkQSZ48=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OKVgvVA7dQfG4qa09ls9FchsL4bGdA4IEVYlgyURDp3fmCwHn+mzJYXC+KkdFIwhwajK2pHghKlKUm8sxFx7Ck3KbY4NJiycbXh+MyDgvEO85C1zDt2vKg91szkf0KiLdSaN/obxukKvITa/iNqQv0N2jdyG3tKFqCr0quVY0Zc= 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=WSWxiXtI; 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="WSWxiXtI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761576545; 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=WSWxiXtI9AXZ75wNw4HzsLZS/e1ykYkwH4HtJOl8zGLPnVlZTkBhfI41IInjsmPfc7QzLK w8xEchsx5ay1N75gyilFHseL3iEhihpVed7S5RcYkLmB8lysZ5GlLBnXGLu/ngrqYrNPcf 94uE03K2eqXfEohcquGRduKQHm1jsC0= 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-226-6oaRRRBXNY-BuMGr1MHJvw-1; Mon, 27 Oct 2025 10:49:02 -0400 X-MC-Unique: 6oaRRRBXNY-BuMGr1MHJvw-1 X-Mimecast-MFC-AGG-ID: 6oaRRRBXNY-BuMGr1MHJvw_1761576541 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 ECA791954102; Mon, 27 Oct 2025 14:49:00 +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 CFA0F1955F1B; Mon, 27 Oct 2025 14:48:57 +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 v2 6/7] Documentation/rtla: Rename sample/ to example/ Date: Mon, 27 Oct 2025 15:48:18 +0100 Message-ID: <20251027144819.1034041-7-tglozar@redhat.com> In-Reply-To: <20251027144819.1034041-1-tglozar@redhat.com> References: <20251027144819.1034041-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 --- 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 00:49:36 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 7C4982D12EB for ; Mon, 27 Oct 2025 14:49:13 +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=1761576554; cv=none; b=LHozIQoX1y58cRtOiwBwcq8dik+yoYBT1DgSsbQlXb92qNf1UEE3xpyUOXdgxGvYlZFsp/3xQ7WFoSMfVrIjrKAN8YesJ28NdNmpooYsqmzwDV50TFI/G6B3jtlKKc+ip8MU9UdASLajD0OzKBKAYGeK+u670IWaLT1CdIpLymo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761576554; c=relaxed/simple; bh=89ucxqi8UIsE4Lu6FVkMFUShD/uliEoam2sKnl0i6sM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JQlnYX+rN9eWQ9vjraqBdxcxtyluMFyDKagdYykyykrc5jsq1UrF0SC/dBlXi7uQwobFYI9dsLXiUjIutsxlvJlZpvrVT8PkzDpV7RTRqhyB71BqpFDXRRbTmAGhyE6YZ0zTSb5ytL6a0Ur6FRs5+RR4JVwdoC7ro9xhkBreox0= 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=hf2bfNRR; 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="hf2bfNRR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761576552; 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=hf2bfNRRpcVZeDWlt12bxAFkEEjoUAUiI5Z0M9Im+3Z3xJnKyE/R8D2b1NaCXei/wKbAHb eSIlI95MZsPEhfd3zb0VZz5Pr93xvnyg/ZO0pXSzZx+J2uxoAsSd9P/msGrXA/Y1aC4/xK CsooKO860wxz/ekIBF0YTfj6di16JIw= 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-310-J5WOj1J2Pt-xZZAcuuQ6xQ-1; Mon, 27 Oct 2025 10:49:05 -0400 X-MC-Unique: J5WOj1J2Pt-xZZAcuuQ6xQ-1 X-Mimecast-MFC-AGG-ID: J5WOj1J2Pt-xZZAcuuQ6xQ_1761576544 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 731F319560AE; Mon, 27 Oct 2025 14:49:04 +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 894AC1955F1B; Mon, 27 Oct 2025 14:49:01 +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 v2 7/7] Documentation/rtla: Document --bpf-action option Date: Mon, 27 Oct 2025 15:48:19 +0100 Message-ID: <20251027144819.1034041-8-tglozar@redhat.com> In-Reply-To: <20251027144819.1034041-1-tglozar@redhat.com> References: <20251027144819.1034041-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 --- .../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