From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 55E47182D6 for ; Wed, 29 Jul 2026 00:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785283522; cv=none; b=S4RPevbExCHC3v22pP4m5Z0B7EQyXBK0rSIALiMU8lc6kLhwa/cpTxuwM7HdEIT8ajbC7jbJoXX3bRu/9gQhSi1mrcGIGbNn8ou7StpK7POvCN/7ZioOVRyAGrL7rv7pI0B9K34g/mcs5VkktN/Tg/N6lk5njzxnl6vcWhGg2aQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785283522; c=relaxed/simple; bh=ubhRIxF8SKn9XA8xvPJmXUPbq2XqeiUF4afa+3R9xIs=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=NG1+a6g77QxaOqBYb1zKQ6N2K7yobnsvk6kabtELbicqbiu6cyTW2zIvxgrhdFpPkdWARdC99yXiQOVepMB0Aoe228zJx2RfkHSkUH280IYVI818amXyPRyCFPCk27sc5wZa28vWruUuK2335tWuuDfQJJ99nV63TxXxHIr0u5o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NUGBjo1c; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NUGBjo1c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F8321F00A3F; Wed, 29 Jul 2026 00:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785283521; bh=msTjoUxobF6s7t1fF158GHVzG3RgmCsmAGaetwfzKQs=; h=Date:From:To:Cc:Subject:References; b=NUGBjo1cFiMdLQZyXndj6tpIq1EoNvnwog3tScaNbbtTfnhyVHFa7J2CObar/U1u6 b4LNFdbNzwGfbcVs7J10gy38EOI/VO2/JlfkGT/SpNCdu5z98mkIz90hMmGZTH32QD uY8uDHcQMIueEUALOGgNmp4UbJVdP3BV/eIxEBQt/9TNSnbWxvh1TpNwVO0PrR+uyr y51Omtp0Z03Q762oeuvb3vjeNfZBBbJcwVfmoJu1zSf9sjjPoxtTtUCJTznKd1D+MG WT8AiXhtKW86mI6FmbyF734ZFltxQtCeBdHpBkpfCdYCw0ZRCgeUU9YL0Kwb2xaMUL YNP8EXtZLYWVg== Received: from rostedt by gandalf with local (Exim 4.99.4) (envelope-from ) id 1woro3-00000006Uaj-2hel; Tue, 28 Jul 2026 20:05:55 -0400 Message-ID: <20260729000555.499009197@kernel.org> User-Agent: quilt/0.69 Date: Tue, 28 Jul 2026 20:05:25 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Mykyta Yatsenko Subject: [for-next][PATCH 02/16] tracing: Expose tracepoint BTF ids via tracefs References: <20260729000523.093060274@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: Mykyta Yatsenko Add events///btf_ids, a per-template file that exposes the BTF ids resolve_btfids fills in for each tracepoint: btf_obj_id BTF object owning the ids below raw_btf_id FUNC_PROTO of __bpf_trace_ (named args), consumed by raw_tp / tp_btf BPF programs tp_btf_id trace_event_raw_ ring-buffer record, consumed by classic BPF_PROG_TYPE_TRACEPOINT programs DECLARE_EVENT_CLASS now emits a 2-entry BTF_ID_LIST (FUNC __bpf_trace_* and STRUCT trace_event_raw_*) and stores the pointer in trace_event_class. Per-syscall events under syscalls/ share the handcrafted classes event_class_syscall_{enter,exit} instead of going through DECLARE_EVENT_CLASS. Wire those classes to the BTF id lists generated for sys_enter / sys_exit so all ~700 per-syscall events expose the shared dispatcher prototype and record. The per-syscall events do not own their own tracepoint (they share sys_enter/sys_exit), so raw_btf_id is reported as 0 on those events; the meaningful raw_btf_id is exposed on raw_syscalls/sys_{enter,exit}/btf_ids where raw_tp / tp_btf programs can actually attach. Link: https://patch.msgid.link/20260518-generic_tracepoint-v2-2-b755a5cf67bb@meta.com Signed-off-by: Mykyta Yatsenko Signed-off-by: Steven Rostedt --- include/linux/trace_events.h | 9 ++++ include/trace/trace_events.h | 24 +++++++++++ kernel/trace/trace_events.c | 80 ++++++++++++++++++++++++++++++++++- kernel/trace/trace_syscalls.c | 17 ++++++++ 4 files changed, 129 insertions(+), 1 deletion(-) diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 308c76b57d13..5cbd09c8be8d 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -298,6 +298,15 @@ struct trace_event_class { struct list_head *(*get_fields)(struct trace_event_call *); struct list_head fields; int (*raw_init)(struct trace_event_call *); +#ifdef CONFIG_BPF_EVENTS + /* + * Per-template BTF ids set by DECLARE_EVENT_CLASS via BTF_ID() and + * patched by resolve_btfids at link time. NULL for handcrafted classes. + * [0] FUNC __bpf_trace_