]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf db-export: Remove evsel from struct export_sample
authorIan Rogers <irogers@google.com>
Wed, 20 May 2026 19:05:14 +0000 (12:05 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 20 May 2026 19:35:59 +0000 (16:35 -0300)
As struct perf_sample now directly contains its own resolved evsel pointer,
passing the evsel separately is redundant and clutters the interface.

Remove the redundant evsel parameter from db-export-specific handlers and
structures, ensuring the tool always directly accesses the evsel bound to the
sample. This simplifies the API signatures and eliminates the risk of passing
an inconsistent evsel.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Andrew Jones <ajones@ventanamicro.com>
Cc: Anup Patel <anup@brainfault.org>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Blake Jones <blakejones@google.com>
Cc: Chen Ni <nichen@iscas.ac.cn>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Derek Foreman <derek.foreman@collabora.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Hrishikesh Suresh <hrishikesh123s@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Krzysztof Ɓopatowski <krzysztof.m.lopatowski@gmail.com>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quan Zhou <zhouquan@iscas.ac.cn>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Swapnil Sapkal <swapnil.sapkal@amd.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Tianyou Li <tianyou.li@intel.com>
Cc: Yujie Liu <yujie.liu@intel.com>
Cc: tanze <tanze@kylinos.cn>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/db-export.c
tools/perf/util/db-export.h
tools/perf/util/scripting-engines/trace-event-python.c

index d991e3168aed6d1369898819c2801c9e598fa34c..ba54b1119ee63cc10c2565bd63520475de3e68ab 100644 (file)
@@ -344,14 +344,13 @@ static int db_export__threads(struct db_export *dbe, struct thread *thread,
 }
 
 int db_export__sample(struct db_export *dbe, union perf_event *event,
-                     struct perf_sample *sample, struct evsel *evsel,
+                     struct perf_sample *sample,
                      struct addr_location *al, struct addr_location *addr_al)
 {
        struct thread *thread = al->thread;
        struct export_sample es = {
                .event = event,
                .sample = sample,
-               .evsel = evsel,
                .al = al,
        };
        struct thread *main_thread;
@@ -364,7 +363,7 @@ int db_export__sample(struct db_export *dbe, union perf_event *event,
        if (!machine)
                return -1;
 
-       err = db_export__evsel(dbe, evsel);
+       err = db_export__evsel(dbe, sample->evsel);
        if (err)
                return err;
 
index 23983cb35706b9a91725ec47e35ff5745afb3647..1abbfd398e3a435df7dfd696b7855284b983cbd5 100644 (file)
@@ -25,7 +25,6 @@ struct call_return;
 struct export_sample {
        union perf_event        *event;
        struct perf_sample      *sample;
-       struct evsel            *evsel;
        struct addr_location    *al;
        u64                     db_id;
        u64                     comm_db_id;
@@ -96,7 +95,7 @@ int db_export__symbol(struct db_export *dbe, struct symbol *sym,
 int db_export__branch_type(struct db_export *dbe, u32 branch_type,
                           const char *name);
 int db_export__sample(struct db_export *dbe, union perf_event *event,
-                     struct perf_sample *sample, struct evsel *evsel,
+                     struct perf_sample *sample,
                      struct addr_location *al, struct addr_location *addr_al);
 
 int db_export__branch_types(struct db_export *dbe);
index 1537122167d52635e304c470c09facbdd318e7a2..9e1069ec0578205cff2675573dc21b96968dabe0 100644 (file)
@@ -1312,7 +1312,7 @@ static void python_export_sample_table(struct db_export *dbe,
        t = tuple_new(28);
 
        tuple_set_d64(t, 0, es->db_id);
-       tuple_set_d64(t, 1, es->evsel->db_id);
+       tuple_set_d64(t, 1, es->sample->evsel->db_id);
        tuple_set_d64(t, 2, maps__machine(thread__maps(es->al->thread))->db_id);
        tuple_set_d64(t, 3, thread__db_id(es->al->thread));
        tuple_set_d64(t, 4, es->comm_db_id);
@@ -1353,7 +1353,7 @@ static void python_export_synth(struct db_export *dbe, struct export_sample *es)
        t = tuple_new(3);
 
        tuple_set_d64(t, 0, es->db_id);
-       tuple_set_d64(t, 1, es->evsel->core.attr.config);
+       tuple_set_d64(t, 1, es->sample->evsel->core.attr.config);
        tuple_set_bytes(t, 2, es->sample->raw_data, es->sample->raw_size);
 
        call_object(tables->synth_handler, t, "synth_data");
@@ -1368,7 +1368,7 @@ static int python_export_sample(struct db_export *dbe,
 
        python_export_sample_table(dbe, es);
 
-       if (es->evsel->core.attr.type == PERF_TYPE_SYNTH && tables->synth_handler)
+       if (es->sample->evsel->core.attr.type == PERF_TYPE_SYNTH && tables->synth_handler)
                python_export_synth(dbe, es);
 
        return 0;
@@ -1517,7 +1517,7 @@ static void python_process_event(union perf_event *event,
        /* Reserve for future process_hw/sw/raw APIs */
        default:
                if (tables->db_export_mode)
-                       db_export__sample(&tables->dbe, event, sample, evsel, al, addr_al);
+                       db_export__sample(&tables->dbe, event, sample, al, addr_al);
                else
                        python_process_general_event(sample, evsel, al, addr_al);
        }