Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libperf evsel: Rename own_cpus to pmu_cpus

own_cpus is generally the cpumask from the PMU. Rename to pmu_cpus to
try to make this clearer. Variable rename with no other changes.

Reviewed-by: Thomas Falcon <thomas.falcon@intel.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: James Clark <james.clark@linaro.org>
Link: https://lore.kernel.org/r/20250719030517.1990983-7-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
6d765f5f 175c8523

+22 -22
+4 -4
tools/lib/perf/evlist.c
··· 46 46 * are valid by intersecting with those of the PMU. 47 47 */ 48 48 perf_cpu_map__put(evsel->cpus); 49 - evsel->cpus = perf_cpu_map__intersect(evlist->user_requested_cpus, evsel->own_cpus); 49 + evsel->cpus = perf_cpu_map__intersect(evlist->user_requested_cpus, evsel->pmu_cpus); 50 50 51 51 /* 52 52 * Empty cpu lists would eventually get opened as "any" so remove ··· 61 61 list_for_each_entry_from(next, &evlist->entries, node) 62 62 next->idx--; 63 63 } 64 - } else if (!evsel->own_cpus || evlist->has_user_cpus || 64 + } else if (!evsel->pmu_cpus || evlist->has_user_cpus || 65 65 (!evsel->requires_cpu && perf_cpu_map__has_any_cpu(evlist->user_requested_cpus))) { 66 66 /* 67 67 * The PMU didn't specify a default cpu map, this isn't a core ··· 72 72 */ 73 73 perf_cpu_map__put(evsel->cpus); 74 74 evsel->cpus = perf_cpu_map__get(evlist->user_requested_cpus); 75 - } else if (evsel->cpus != evsel->own_cpus) { 75 + } else if (evsel->cpus != evsel->pmu_cpus) { 76 76 /* 77 77 * No user requested cpu map but the PMU cpu map doesn't match 78 78 * the evsel's. Reset it back to the PMU cpu map. 79 79 */ 80 80 perf_cpu_map__put(evsel->cpus); 81 - evsel->cpus = perf_cpu_map__get(evsel->own_cpus); 81 + evsel->cpus = perf_cpu_map__get(evsel->pmu_cpus); 82 82 } 83 83 84 84 if (evsel->system_wide) {
+1 -1
tools/lib/perf/evsel.c
··· 46 46 assert(evsel->mmap == NULL); /* If not munmap wasn't called. */ 47 47 assert(evsel->sample_id == NULL); /* If not free_id wasn't called. */ 48 48 perf_cpu_map__put(evsel->cpus); 49 - perf_cpu_map__put(evsel->own_cpus); 49 + perf_cpu_map__put(evsel->pmu_cpus); 50 50 perf_thread_map__put(evsel->threads); 51 51 free(evsel); 52 52 }
+1 -1
tools/lib/perf/include/internal/evsel.h
··· 99 99 * cpu map for opening the event on, for example, the first CPU on a 100 100 * socket for an uncore event. 101 101 */ 102 - struct perf_cpu_map *own_cpus; 102 + struct perf_cpu_map *pmu_cpus; 103 103 struct perf_thread_map *threads; 104 104 struct xyarray *fd; 105 105 struct xyarray *mmap;
+2 -2
tools/perf/tests/event_update.c
··· 109 109 TEST_ASSERT_VAL("failed to synthesize attr update name", 110 110 !perf_event__synthesize_event_update_name(&tmp.tool, evsel, process_event_name)); 111 111 112 - perf_cpu_map__put(evsel->core.own_cpus); 113 - evsel->core.own_cpus = perf_cpu_map__new("1,2,3"); 112 + perf_cpu_map__put(evsel->core.pmu_cpus); 113 + evsel->core.pmu_cpus = perf_cpu_map__new("1,2,3"); 114 114 115 115 TEST_ASSERT_VAL("failed to synthesize attr update cpus", 116 116 !perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus));
+3 -3
tools/perf/util/evsel.c
··· 488 488 return NULL; 489 489 490 490 evsel->core.cpus = perf_cpu_map__get(orig->core.cpus); 491 - evsel->core.own_cpus = perf_cpu_map__get(orig->core.own_cpus); 491 + evsel->core.pmu_cpus = perf_cpu_map__get(orig->core.pmu_cpus); 492 492 evsel->core.threads = perf_thread_map__get(orig->core.threads); 493 493 evsel->core.nr_members = orig->core.nr_members; 494 494 evsel->core.system_wide = orig->core.system_wide; ··· 1527 1527 attr->exclude_user = 1; 1528 1528 } 1529 1529 1530 - if (evsel->core.own_cpus || evsel->unit) 1530 + if (evsel->core.pmu_cpus || evsel->unit) 1531 1531 evsel->core.attr.read_format |= PERF_FORMAT_ID; 1532 1532 1533 1533 /* ··· 1680 1680 evsel__free_config_terms(evsel); 1681 1681 cgroup__put(evsel->cgrp); 1682 1682 perf_cpu_map__put(evsel->core.cpus); 1683 - perf_cpu_map__put(evsel->core.own_cpus); 1683 + perf_cpu_map__put(evsel->core.pmu_cpus); 1684 1684 perf_thread_map__put(evsel->core.threads); 1685 1685 zfree(&evsel->group_name); 1686 1686 zfree(&evsel->name);
+2 -2
tools/perf/util/header.c
··· 4507 4507 case PERF_EVENT_UPDATE__CPUS: 4508 4508 map = cpu_map__new_data(&ev->cpus.cpus); 4509 4509 if (map) { 4510 - perf_cpu_map__put(evsel->core.own_cpus); 4511 - evsel->core.own_cpus = map; 4510 + perf_cpu_map__put(evsel->core.pmu_cpus); 4511 + evsel->core.pmu_cpus = map; 4512 4512 } else 4513 4513 pr_err("failed to get event_update cpus\n"); 4514 4514 default:
+1 -1
tools/perf/util/parse-events.c
··· 320 320 321 321 (*idx)++; 322 322 evsel->core.cpus = cpus; 323 - evsel->core.own_cpus = perf_cpu_map__get(cpus); 323 + evsel->core.pmu_cpus = perf_cpu_map__get(cpus); 324 324 evsel->core.requires_cpu = pmu ? pmu->is_uncore : false; 325 325 evsel->core.is_pmu_core = is_pmu_core; 326 326 evsel->pmu = pmu;
+2 -2
tools/perf/util/synthetic-events.c
··· 2045 2045 int perf_event__synthesize_event_update_cpus(const struct perf_tool *tool, struct evsel *evsel, 2046 2046 perf_event__handler_t process) 2047 2047 { 2048 - struct synthesize_cpu_map_data syn_data = { .map = evsel->core.own_cpus }; 2048 + struct synthesize_cpu_map_data syn_data = { .map = evsel->core.pmu_cpus }; 2049 2049 struct perf_record_event_update *ev; 2050 2050 int err; 2051 2051 ··· 2126 2126 } 2127 2127 } 2128 2128 2129 - if (evsel->core.own_cpus) { 2129 + if (evsel->core.pmu_cpus) { 2130 2130 err = perf_event__synthesize_event_update_cpus(tool, evsel, process); 2131 2131 if (err < 0) { 2132 2132 pr_err("Couldn't synthesize evsel cpus.\n");
+6 -6
tools/perf/util/tool_pmu.c
··· 357 357 /* 358 358 * "Any CPU" event that can be scheduled on any CPU in 359 359 * the PMU's cpumask. The PMU cpumask should be saved in 360 - * own_cpus. If not present fall back to max. 360 + * pmu_cpus. If not present fall back to max. 361 361 */ 362 - if (!perf_cpu_map__is_empty(evsel->core.own_cpus)) 363 - *result = perf_cpu_map__nr(evsel->core.own_cpus); 362 + if (!perf_cpu_map__is_empty(evsel->core.pmu_cpus)) 363 + *result = perf_cpu_map__nr(evsel->core.pmu_cpus); 364 364 else 365 365 *result = cpu__max_present_cpu().cpu; 366 366 } ··· 386 386 /* 387 387 * "Any CPU" event that can be scheduled on any CPU in 388 388 * the PMU's cpumask. The PMU cpumask should be saved in 389 - * own_cpus, if not present then just the online cpu 389 + * pmu_cpus, if not present then just the online cpu 390 390 * mask. 391 391 */ 392 - if (!perf_cpu_map__is_empty(evsel->core.own_cpus)) { 392 + if (!perf_cpu_map__is_empty(evsel->core.pmu_cpus)) { 393 393 struct perf_cpu_map *tmp = 394 - perf_cpu_map__intersect(online, evsel->core.own_cpus); 394 + perf_cpu_map__intersect(online, evsel->core.pmu_cpus); 395 395 396 396 *result = perf_cpu_map__nr(tmp); 397 397 perf_cpu_map__put(tmp);