From nobody Wed Feb 11 02:06:33 2026 Received: from mail-dl1-f74.google.com (mail-dl1-f74.google.com [74.125.82.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 426472FE579 for ; Mon, 9 Feb 2026 17:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770658859; cv=none; b=aHPjePl3rm88vAoOngMBpHfHfNina3JRPT3BrBZjWhgqSnroxOISYuLROa2uVyy3Mofjy8DGlNu8EPPoEvEWRlp3LTgmrYihM5y3RuJSFvATq/QQHyMBDRPRltRG/KgJcIcVUpyhrpErW/60b2BH+9w8LucjzoodN6wGioB5OD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770658859; c=relaxed/simple; bh=dxHa93PslZklWVkkyAQ7K6HkTaBVMQoUUV8a+BraVtk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=TjojLT3VxJmsKk4nEkdBfc26zKW0bmy8IQ4Y8T72elij7Kn3qyodyrrvTT7sOHKUZWddRrj9FawT/nXpqtlj00vn8HaO5Q9IwqUOY5j3+HTCK4c+rpRUSE684YwsPBpXP7yQie4Zqy+/Dw0SqWx1uo5VFR/hcMp8aoe115MTnGs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=WzlPQ7Uh; arc=none smtp.client-ip=74.125.82.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WzlPQ7Uh" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-124a95b6f61so23134120c88.0 for ; Mon, 09 Feb 2026 09:40:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770658858; x=1771263658; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=w1tRJX7J5r1dPfFcNrmsO1GQ74CBF5h4ta5FV7G1gKM=; b=WzlPQ7UhUmOUEwqz1h89xbtah4MxoWuPflJjgJ/sSmLcqI880SIRtkGzXBGCLqqZyp Pxf7uU5B/OXkdLjQDTJmpulX56tMI7Ll9uw5ZnXekQ877ERFvZaEPoZot0CAReag1mh7 BaFnG6IBishL/l+br3gDGEqIbSpshtaDXFd2m8A7yFUWufFTVgFoFdmOfugnGYHFSUpF Uxcqz4hEv2/Ly9RuMGo4+q8KZn33/82nz8kVWv0DLAh0kbYsOCsp48j2G7JSTuIWKeDJ UsnWNE2zsWnp0gXY8nNkX65GzMJPz7551TuIWYvLkGCHfhpH+Tt4BSiER6tKANlXSZ0u xuNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770658858; x=1771263658; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=w1tRJX7J5r1dPfFcNrmsO1GQ74CBF5h4ta5FV7G1gKM=; b=OXXzq43MY7CoPKkrQH2IpMXdod5xfhwwrQOnGDCqMGsBtSOkh6pX4bTqtViRXxsx6j Rc0HAAbqJCEP/FlA3LHXqb1SAjG4iPhtp/fQFxgVFwwreP2hM3Ff0X4PXcHtuXBPKCwG pKcgN+pHh9HD4wTG/kt2uBQ2Bcudk5JvXmK4q1IkLwyuTFaEjiQUQrUBtAbwpbu1N1E7 hu0ptdb8gN4PL0+V6koP9fn1/LJc6sGGk5n4TzY1OfdAufgvM/Tw0qXEZ61+U1OB2djq pw6aDHp4ZoX4eaGZ61nZDl29248oFJtWJsRz1gTYLdscJyHoT5StaXFiO2TVITu/xzYH ELJA== X-Forwarded-Encrypted: i=1; AJvYcCWEAni5T5SPmTgYrLUIMdDSYR/i9VqWi5WWoWL6xMfyEpZMcyCOVfv4BPTnSGKCYMuoE8txxIoimbxk0mM=@vger.kernel.org X-Gm-Message-State: AOJu0Ywnka9yGh8Tt7f2Zql0vYzbxMIW6tsuwRfjdx2yOnCEO+/BPmSS ZxS70sRV3f0Y0n+QIQpNrNr06E0p+0OEqeccxJMO5GCk8uiuzi9yW3kX2HBgjqkgRTaKaeGrRxT pg/uTauZCDw== X-Received: from dlii7.prod.google.com ([2002:a05:7022:4187:b0:124:a7b4:135d]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:220b:b0:119:e56b:c74b with SMTP id a92af1059eb24-12704001542mr5701226c88.16.1770658858094; Mon, 09 Feb 2026 09:40:58 -0800 (PST) Date: Mon, 9 Feb 2026 09:40:14 -0800 In-Reply-To: <20260209174032.4142096-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260209174032.4142096-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.239.g8d8fc8a987-goog Message-ID: <20260209174032.4142096-8-irogers@google.com> Subject: [PATCH v1 07/25] perf trace: Don't pass evsel with sample From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Leo Yan , Tianyou Li , Athira Rajeev , Derek Foreman , Thomas Falcon , Howard Chu , Dmitry Vyukov , Andi Kleen , tanze , Hrishikesh Suresh , Quan Zhou , Andrew Jones , Anup Patel , Dapeng Mi , "Dr. David Alan Gilbert" , "=?UTF-8?q?Krzysztof=20=C5=81opatowski?=" , Chun-Tse Shao , Ravi Bangoria , Swapnil Sapkal , Chen Ni , Blake Jones , Yujie Liu , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The sample now contains the evsel and so don't unnecessarily pass the evsel. Signed-off-by: Ian Rogers --- tools/perf/builtin-trace.c | 55 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index a092405e84aa..7a0913595943 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -536,12 +536,12 @@ static struct evsel *perf_evsel__raw_syscall_newtp(co= nst char *direction, void * return NULL; } =20 -#define perf_evsel__sc_tp_uint(evsel, name, sample) \ - ({ struct syscall_tp *fields =3D __evsel__syscall_tp(evsel); \ +#define perf_evsel__sc_tp_uint(name, sample) \ + ({ struct syscall_tp *fields =3D __evsel__syscall_tp(sample->evsel); \ fields->name.integer(&fields->name, sample); }) =20 -#define perf_evsel__sc_tp_ptr(evsel, name, sample) \ - ({ struct syscall_tp *fields =3D __evsel__syscall_tp(evsel); \ +#define perf_evsel__sc_tp_ptr(name, sample) \ + ({ struct syscall_tp *fields =3D __evsel__syscall_tp(sample->evsel); \ fields->name.pointer(&fields->name, sample); }) =20 size_t strarray__scnprintf_suffix(struct strarray *sa, char *bf, size_t si= ze, const char *intfmt, bool show_suffix, int val) @@ -2718,8 +2718,8 @@ static int trace__printf_interrupted_entry(struct tra= ce *trace) return printed; } =20 -static int trace__fprintf_sample(struct trace *trace, struct evsel *evsel, - struct perf_sample *sample, struct thread *thread) +static int trace__fprintf_sample(struct trace *trace, struct perf_sample *= sample, + struct thread *thread) { int printed =3D 0; =20 @@ -2727,7 +2727,7 @@ static int trace__fprintf_sample(struct trace *trace,= struct evsel *evsel, double ts =3D (double)sample->time / NSEC_PER_MSEC; =20 printed +=3D fprintf(trace->output, "%22s %10.3f %s %d/%d [%d]\n", - evsel__name(evsel), ts, + evsel__name(sample->evsel), ts, thread__comm_str(thread), sample->pid, sample->tid, sample->cpu); } @@ -2782,7 +2782,7 @@ static int trace__sys_enter(struct trace *trace, stru= ct evsel *evsel, void *args; int printed =3D 0; struct thread *thread; - int id =3D perf_evsel__sc_tp_uint(evsel, id, sample), err =3D -1; + int id =3D perf_evsel__sc_tp_uint(id, sample), err =3D -1; int augmented_args_size =3D 0, e_machine; void *augmented_args =3D NULL; struct syscall *sc; @@ -2797,9 +2797,9 @@ static int trace__sys_enter(struct trace *trace, stru= ct evsel *evsel, if (ttrace =3D=3D NULL) goto out_put; =20 - trace__fprintf_sample(trace, evsel, sample, thread); + trace__fprintf_sample(trace, sample, thread); =20 - args =3D perf_evsel__sc_tp_ptr(evsel, args, sample); + args =3D perf_evsel__sc_tp_ptr(args, sample); =20 if (ttrace->entry_str =3D=3D NULL) { ttrace->entry_str =3D malloc(trace__entry_str_size); @@ -2854,12 +2854,11 @@ static int trace__sys_enter(struct trace *trace, st= ruct evsel *evsel, return err; } =20 -static int trace__fprintf_sys_enter(struct trace *trace, struct evsel *evs= el, - struct perf_sample *sample) +static int trace__fprintf_sys_enter(struct trace *trace, struct perf_sampl= e *sample) { struct thread_trace *ttrace; struct thread *thread; - int id =3D perf_evsel__sc_tp_uint(evsel, id, sample), err =3D -1; + int id =3D perf_evsel__sc_tp_uint(id, sample), err =3D -1; struct syscall *sc; char msg[1024]; void *args, *augmented_args =3D NULL; @@ -2869,7 +2868,7 @@ static int trace__fprintf_sys_enter(struct trace *tra= ce, struct evsel *evsel, =20 thread =3D machine__findnew_thread(trace->host, sample->pid, sample->tid); e_machine =3D thread__e_machine(thread, trace->host, /*e_flags=3D*/NULL); - sc =3D trace__syscall_info(trace, evsel, e_machine, id); + sc =3D trace__syscall_info(trace, sample->evsel, e_machine, id); if (sc =3D=3D NULL) goto out_put; ttrace =3D thread__trace(thread, trace); @@ -2880,7 +2879,7 @@ static int trace__fprintf_sys_enter(struct trace *tra= ce, struct evsel *evsel, if (ttrace =3D=3D NULL) goto out_put; =20 - args =3D perf_evsel__sc_tp_ptr(evsel, args, sample); + args =3D perf_evsel__sc_tp_ptr(args, sample); augmented_args =3D syscall__augmented_args(sc, sample, &augmented_args_si= ze, trace->raw_augmented_syscalls_args_size); printed +=3D syscall__scnprintf_args(sc, msg, sizeof(msg), args, augmente= d_args, augmented_args_size, trace, thread); fprintf(trace->output, "%.*s", (int)printed, msg); @@ -2890,10 +2889,11 @@ static int trace__fprintf_sys_enter(struct trace *t= race, struct evsel *evsel, return err; } =20 -static int trace__resolve_callchain(struct trace *trace, struct evsel *evs= el, +static int trace__resolve_callchain(struct trace *trace, struct perf_sample *sample, struct callchain_cursor *cursor) { + struct evsel *evsel =3D sample->evsel; struct addr_location al; int max_stack =3D evsel->core.attr.sample_max_stack ? evsel->core.attr.sample_max_stack : @@ -2928,7 +2928,7 @@ static int trace__sys_exit(struct trace *trace, struc= t evsel *evsel, u64 duration =3D 0; bool duration_calculated =3D false; struct thread *thread; - int id =3D perf_evsel__sc_tp_uint(evsel, id, sample), err =3D -1, callcha= in_ret =3D 0, printed =3D 0; + int id =3D perf_evsel__sc_tp_uint(id, sample), err =3D -1, callchain_ret = =3D 0, printed =3D 0; int alignment =3D trace->args_alignment, e_machine; struct syscall *sc; struct thread_trace *ttrace; @@ -2942,9 +2942,9 @@ static int trace__sys_exit(struct trace *trace, struc= t evsel *evsel, if (ttrace =3D=3D NULL) goto out_put; =20 - trace__fprintf_sample(trace, evsel, sample, thread); + trace__fprintf_sample(trace, sample, thread); =20 - ret =3D perf_evsel__sc_tp_uint(evsel, ret, sample); + ret =3D perf_evsel__sc_tp_uint(ret, sample); =20 if (trace->summary) thread__update_stats(thread, ttrace, id, sample, ret, trace); @@ -2966,7 +2966,7 @@ static int trace__sys_exit(struct trace *trace, struc= t evsel *evsel, if (sample->callchain) { struct callchain_cursor *cursor =3D get_tls_callchain_cursor(); =20 - callchain_ret =3D trace__resolve_callchain(trace, evsel, sample, cursor); + callchain_ret =3D trace__resolve_callchain(trace, sample, cursor); if (callchain_ret =3D=3D 0) { if (cursor->nr < trace->min_stack) goto out; @@ -3181,9 +3181,10 @@ static void bpf_output__fprintf(struct trace *trace, ++trace->nr_events_printed; } =20 -static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *= evsel, struct perf_sample *sample, +static size_t trace__fprintf_tp_fields(struct trace *trace, struct perf_sa= mple *sample, struct thread *thread, void *augmented_args, int augmented_args= _size) { + struct evsel *evsel =3D sample->evsel; char bf[2048]; size_t size =3D sizeof(bf); const struct tep_event *tp_format =3D evsel__tp_format(evsel); @@ -3266,7 +3267,7 @@ static int trace__event_handler(struct trace *trace, = struct evsel *evsel, if (sample->callchain) { struct callchain_cursor *cursor =3D get_tls_callchain_cursor(); =20 - callchain_ret =3D trace__resolve_callchain(trace, evsel, sample, cursor); + callchain_ret =3D trace__resolve_callchain(trace, sample, cursor); if (callchain_ret =3D=3D 0) { if (cursor->nr < trace->min_stack) goto out; @@ -3284,7 +3285,7 @@ static int trace__event_handler(struct trace *trace, = struct evsel *evsel, trace__fprintf_comm_tid(trace, thread, trace->output); =20 if (evsel =3D=3D trace->syscalls.events.bpf_output) { - int id =3D perf_evsel__sc_tp_uint(evsel, id, sample); + int id =3D perf_evsel__sc_tp_uint(id, sample); int e_machine =3D thread ? thread__e_machine(thread, trace->host, /*e_flags=3D*/NULL) : EM_HOST; @@ -3292,7 +3293,7 @@ static int trace__event_handler(struct trace *trace, = struct evsel *evsel, =20 if (sc) { fprintf(trace->output, "%s(", sc->name); - trace__fprintf_sys_enter(trace, evsel, sample); + trace__fprintf_sys_enter(trace, sample); fputc(')', trace->output); goto newline; } @@ -3312,13 +3313,13 @@ static int trace__event_handler(struct trace *trace= , struct evsel *evsel, const struct tep_event *tp_format =3D evsel__tp_format(evsel); =20 if (tp_format && (strncmp(tp_format->name, "sys_enter_", 10) || - trace__fprintf_sys_enter(trace, evsel, sample))) { + trace__fprintf_sys_enter(trace, sample))) { if (trace->libtraceevent_print) { event_format__fprintf(tp_format, sample->cpu, sample->raw_data, sample->raw_size, trace->output); } else { - trace__fprintf_tp_fields(trace, evsel, sample, thread, NULL, 0); + trace__fprintf_tp_fields(trace, sample, thread, NULL, 0); } } } @@ -3377,7 +3378,7 @@ static int trace__pgfault(struct trace *trace, if (sample->callchain) { struct callchain_cursor *cursor =3D get_tls_callchain_cursor(); =20 - callchain_ret =3D trace__resolve_callchain(trace, evsel, sample, cursor); + callchain_ret =3D trace__resolve_callchain(trace, sample, cursor); if (callchain_ret =3D=3D 0) { if (cursor->nr < trace->min_stack) goto out_put; --=20 2.53.0.239.g8d8fc8a987-goog