]> www.infradead.org Git - users/hch/misc.git/commitdiff
perf arm_spe: Use full type for data_src
authorJames Clark <james.clark@linaro.org>
Fri, 12 Sep 2025 15:42:10 +0000 (16:42 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 19 Sep 2025 15:14:27 +0000 (12:14 -0300)
data_src has an actual type rather than just being a u64. To help
readers, delay decomposing it to a u64 until it's finally assigned to
the sample.

Signed-off-by: James Clark <james.clark@linaro.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ali Saidi <alisaidi@amazon.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/arm-spe.c

index 6fb012d89488c1e5d4866ec62a2df2bc895cb6ca..38e6f8331f2790b9cd3bc94d5a18657d7e0f5e42 100644 (file)
@@ -469,7 +469,8 @@ arm_spe_deliver_synth_event(struct arm_spe *spe,
 }
 
 static int arm_spe__synth_mem_sample(struct arm_spe_queue *speq,
-                                    u64 spe_events_id, u64 data_src)
+                                    u64 spe_events_id,
+                                    union perf_mem_data_src data_src)
 {
        struct arm_spe *spe = speq->spe;
        struct arm_spe_record *record = &speq->decoder->record;
@@ -484,7 +485,7 @@ static int arm_spe__synth_mem_sample(struct arm_spe_queue *speq,
        sample.stream_id = spe_events_id;
        sample.addr = record->virt_addr;
        sample.phys_addr = record->phys_addr;
-       sample.data_src = data_src;
+       sample.data_src = data_src.val;
        sample.weight = record->latency;
 
        ret = arm_spe_deliver_synth_event(spe, speq, event, &sample);
@@ -517,7 +518,8 @@ static int arm_spe__synth_branch_sample(struct arm_spe_queue *speq,
 }
 
 static int arm_spe__synth_instruction_sample(struct arm_spe_queue *speq,
-                                            u64 spe_events_id, u64 data_src)
+                                            u64 spe_events_id,
+                                            union perf_mem_data_src data_src)
 {
        struct arm_spe *spe = speq->spe;
        struct arm_spe_record *record = &speq->decoder->record;
@@ -532,7 +534,7 @@ static int arm_spe__synth_instruction_sample(struct arm_spe_queue *speq,
        sample.stream_id = spe_events_id;
        sample.addr = record->to_ip;
        sample.phys_addr = record->phys_addr;
-       sample.data_src = data_src;
+       sample.data_src = data_src.val;
        sample.weight = record->latency;
        sample.flags = speq->flags;
        sample.branch_stack = speq->last_branch;
@@ -880,21 +882,22 @@ static bool arm_spe__synth_ds(struct arm_spe_queue *speq,
        return false;
 }
 
-static u64 arm_spe__synth_data_source(struct arm_spe_queue *speq,
-                                     const struct arm_spe_record *record)
+static union perf_mem_data_src
+arm_spe__synth_data_source(struct arm_spe_queue *speq,
+                          const struct arm_spe_record *record)
 {
-       union perf_mem_data_src data_src = { .mem_op = PERF_MEM_OP_NA };
+       union perf_mem_data_src data_src = {};
 
        /* Only synthesize data source for LDST operations */
        if (!is_ldst_op(record->op))
-               return 0;
+               return data_src;
 
        if (record->op & ARM_SPE_OP_LD)
                data_src.mem_op = PERF_MEM_OP_LOAD;
        else if (record->op & ARM_SPE_OP_ST)
                data_src.mem_op = PERF_MEM_OP_STORE;
        else
-               return 0;
+               return data_src;
 
        if (!arm_spe__synth_ds(speq, record, &data_src))
                arm_spe__synth_memory_level(record, &data_src);
@@ -908,14 +911,14 @@ static u64 arm_spe__synth_data_source(struct arm_spe_queue *speq,
                        data_src.mem_dtlb |= PERF_MEM_TLB_HIT;
        }
 
-       return data_src.val;
+       return data_src;
 }
 
 static int arm_spe_sample(struct arm_spe_queue *speq)
 {
        const struct arm_spe_record *record = &speq->decoder->record;
        struct arm_spe *spe = speq->spe;
-       u64 data_src;
+       union perf_mem_data_src data_src;
        int err;
 
        /*