]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf s390-sample-raw: Don't pass evsel or its PMU with sample
authorIan Rogers <irogers@google.com>
Wed, 20 May 2026 19:05:26 +0000 (12:05 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 20 May 2026 19:39:40 +0000 (16:39 -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 s390-sample-raw-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/s390-sample-raw.c

index c6ae0ae8d86a3920b3dbafd21ef8b880145f23ba..52bbca5c56c8e1b30c80cc674728f4052606b50c 100644 (file)
@@ -222,8 +222,9 @@ static char *get_counter_name(int set, int nr, struct perf_pmu *pmu)
        return result;
 }
 
-static void s390_cpumcfdg_dump(struct perf_pmu *pmu, struct perf_sample *sample)
+static void s390_cpumcfdg_dump(struct perf_sample *sample)
 {
+       struct perf_pmu *pmu = sample->evsel->pmu;
        size_t i, len = sample->raw_size, offset = 0;
        unsigned char *buf = sample->raw_data;
        const char *color = PERF_COLOR_BLUE;
@@ -284,8 +285,9 @@ static bool s390_pai_all_test(struct perf_sample *sample)
        return true;
 }
 
-static void s390_pai_all_dump(struct evsel *evsel, struct perf_sample *sample)
+static void s390_pai_all_dump(struct perf_sample *sample)
 {
+       struct evsel *evsel = sample->evsel;
        size_t len = sample->raw_size, offset = 0;
        unsigned char *p = sample->raw_data;
        const char *color = PERF_COLOR_BLUE;
@@ -332,31 +334,32 @@ void evlist__s390_sample_raw(struct evlist *evlist, union perf_event *event,
                             struct perf_sample *sample)
 {
        const char *pai_name;
-       struct evsel *evsel;
 
        if (event->header.type != PERF_RECORD_SAMPLE)
                return;
 
-       evsel = evlist__event2evsel(evlist, event);
-       if (!evsel)
-               return;
+       if (!sample->evsel) {
+               sample->evsel = evlist__event2evsel(evlist, event);
+               if (!sample->evsel)
+                       return;
+       }
 
        /* Check for raw data in sample */
        if (!sample->raw_size || !sample->raw_data)
                return;
 
        /* Display raw data on screen */
-       if (evsel->core.attr.config == PERF_EVENT_CPUM_CF_DIAG) {
-               if (!evsel->pmu)
-                       evsel->pmu = perf_pmus__find("cpum_cf");
+       if (sample->evsel->core.attr.config == PERF_EVENT_CPUM_CF_DIAG) {
+               if (!sample->evsel->pmu)
+                       sample->evsel->pmu = perf_pmus__find("cpum_cf");
                if (!s390_cpumcfdg_testctr(sample))
                        pr_err("Invalid counter set data encountered\n");
                else
-                       s390_cpumcfdg_dump(evsel->pmu, sample);
+                       s390_cpumcfdg_dump(sample);
                return;
        }
 
-       switch (evsel->core.attr.config) {
+       switch (sample->evsel->core.attr.config) {
        case PERF_EVENT_PAI_NNPA_ALL:
                pai_name = "NNPA_ALL";
                break;
@@ -370,8 +373,8 @@ void evlist__s390_sample_raw(struct evlist *evlist, union perf_event *event,
        if (!s390_pai_all_test(sample)) {
                pr_err("Invalid %s raw data encountered\n", pai_name);
        } else {
-               if (!evsel->pmu)
-                       evsel->pmu = perf_pmus__find_by_type(evsel->core.attr.type);
-               s390_pai_all_dump(evsel, sample);
+               if (!sample->evsel->pmu)
+                       sample->evsel->pmu = perf_pmus__find_by_type(sample->evsel->core.attr.type);
+               s390_pai_all_dump(sample);
        }
 }