Skip to content

Commit b0529b9

Browse files
Kan LiangKAGA-KOKO
authored andcommitted
perf/x86/intel/uncore: Cosmetic renames in response to multi-die/pkg support
Syntax update only -- no logical or functional change. In response to the new multi-die/package changes, update variable names to use "die" terminology, instead of "pkg". For previous platforms which doesn't have multi-die, "die" is identical as "pkg". Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Len Brown <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Ingo Molnar <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/f0ea5e501288329135e94f51969ff54a03c50e2e.1557769318.git.len.brown@intel.com
1 parent 835896a commit b0529b9

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

arch/x86/events/intel/uncore.c

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct pci_driver *uncore_pci_driver;
1414
DEFINE_RAW_SPINLOCK(pci2phy_map_lock);
1515
struct list_head pci2phy_map_head = LIST_HEAD_INIT(pci2phy_map_head);
1616
struct pci_extra_dev *uncore_extra_pci_dev;
17-
static int max_packages;
17+
static int max_dies;
1818

1919
/* mask of cpus that collect uncore events */
2020
static cpumask_t uncore_cpu_mask;
@@ -100,13 +100,13 @@ ssize_t uncore_event_show(struct kobject *kobj,
100100

101101
struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)
102102
{
103-
unsigned int pkgid = topology_logical_die_id(cpu);
103+
unsigned int dieid = topology_logical_die_id(cpu);
104104

105105
/*
106106
* The unsigned check also catches the '-1' return value for non
107107
* existent mappings in the topology map.
108108
*/
109-
return pkgid < max_packages ? pmu->boxes[pkgid] : NULL;
109+
return dieid < max_dies ? pmu->boxes[dieid] : NULL;
110110
}
111111

112112
u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event)
@@ -311,7 +311,7 @@ static struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type,
311311
uncore_pmu_init_hrtimer(box);
312312
box->cpu = -1;
313313
box->pci_phys_id = -1;
314-
box->pkgid = -1;
314+
box->dieid = -1;
315315

316316
/* set default hrtimer timeout */
317317
box->hrtimer_duration = UNCORE_PMU_HRTIMER_INTERVAL;
@@ -826,10 +826,10 @@ static void uncore_pmu_unregister(struct intel_uncore_pmu *pmu)
826826

827827
static void uncore_free_boxes(struct intel_uncore_pmu *pmu)
828828
{
829-
int pkg;
829+
int die;
830830

831-
for (pkg = 0; pkg < max_packages; pkg++)
832-
kfree(pmu->boxes[pkg]);
831+
for (die = 0; die < max_dies; die++)
832+
kfree(pmu->boxes[die]);
833833
kfree(pmu->boxes);
834834
}
835835

@@ -866,7 +866,7 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
866866
if (!pmus)
867867
return -ENOMEM;
868868

869-
size = max_packages * sizeof(struct intel_uncore_box *);
869+
size = max_dies * sizeof(struct intel_uncore_box *);
870870

871871
for (i = 0; i < type->num_boxes; i++) {
872872
pmus[i].func_id = setid ? i : -1;
@@ -936,21 +936,21 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id
936936
struct intel_uncore_type *type;
937937
struct intel_uncore_pmu *pmu = NULL;
938938
struct intel_uncore_box *box;
939-
int phys_id, pkg, ret;
939+
int phys_id, die, ret;
940940

941941
phys_id = uncore_pcibus_to_physid(pdev->bus);
942942
if (phys_id < 0)
943943
return -ENODEV;
944944

945-
pkg = (topology_max_die_per_package() > 1) ? phys_id :
945+
die = (topology_max_die_per_package() > 1) ? phys_id :
946946
topology_phys_to_logical_pkg(phys_id);
947-
if (pkg < 0)
947+
if (die < 0)
948948
return -EINVAL;
949949

950950
if (UNCORE_PCI_DEV_TYPE(id->driver_data) == UNCORE_EXTRA_PCI_DEV) {
951951
int idx = UNCORE_PCI_DEV_IDX(id->driver_data);
952952

953-
uncore_extra_pci_dev[pkg].dev[idx] = pdev;
953+
uncore_extra_pci_dev[die].dev[idx] = pdev;
954954
pci_set_drvdata(pdev, NULL);
955955
return 0;
956956
}
@@ -989,7 +989,7 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id
989989
pmu = &type->pmus[UNCORE_PCI_DEV_IDX(id->driver_data)];
990990
}
991991

992-
if (WARN_ON_ONCE(pmu->boxes[pkg] != NULL))
992+
if (WARN_ON_ONCE(pmu->boxes[die] != NULL))
993993
return -EINVAL;
994994

995995
box = uncore_alloc_box(type, NUMA_NO_NODE);
@@ -1003,21 +1003,21 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id
10031003

10041004
atomic_inc(&box->refcnt);
10051005
box->pci_phys_id = phys_id;
1006-
box->pkgid = pkg;
1006+
box->dieid = die;
10071007
box->pci_dev = pdev;
10081008
box->pmu = pmu;
10091009
uncore_box_init(box);
10101010
pci_set_drvdata(pdev, box);
10111011

1012-
pmu->boxes[pkg] = box;
1012+
pmu->boxes[die] = box;
10131013
if (atomic_inc_return(&pmu->activeboxes) > 1)
10141014
return 0;
10151015

10161016
/* First active box registers the pmu */
10171017
ret = uncore_pmu_register(pmu);
10181018
if (ret) {
10191019
pci_set_drvdata(pdev, NULL);
1020-
pmu->boxes[pkg] = NULL;
1020+
pmu->boxes[die] = NULL;
10211021
uncore_box_exit(box);
10221022
kfree(box);
10231023
}
@@ -1028,17 +1028,17 @@ static void uncore_pci_remove(struct pci_dev *pdev)
10281028
{
10291029
struct intel_uncore_box *box;
10301030
struct intel_uncore_pmu *pmu;
1031-
int i, phys_id, pkg;
1031+
int i, phys_id, die;
10321032

10331033
phys_id = uncore_pcibus_to_physid(pdev->bus);
10341034

10351035
box = pci_get_drvdata(pdev);
10361036
if (!box) {
1037-
pkg = (topology_max_die_per_package() > 1) ? phys_id :
1037+
die = (topology_max_die_per_package() > 1) ? phys_id :
10381038
topology_phys_to_logical_pkg(phys_id);
10391039
for (i = 0; i < UNCORE_EXTRA_PCI_DEV_MAX; i++) {
1040-
if (uncore_extra_pci_dev[pkg].dev[i] == pdev) {
1041-
uncore_extra_pci_dev[pkg].dev[i] = NULL;
1040+
if (uncore_extra_pci_dev[die].dev[i] == pdev) {
1041+
uncore_extra_pci_dev[die].dev[i] = NULL;
10421042
break;
10431043
}
10441044
}
@@ -1051,7 +1051,7 @@ static void uncore_pci_remove(struct pci_dev *pdev)
10511051
return;
10521052

10531053
pci_set_drvdata(pdev, NULL);
1054-
pmu->boxes[box->pkgid] = NULL;
1054+
pmu->boxes[box->dieid] = NULL;
10551055
if (atomic_dec_return(&pmu->activeboxes) == 0)
10561056
uncore_pmu_unregister(pmu);
10571057
uncore_box_exit(box);
@@ -1063,7 +1063,7 @@ static int __init uncore_pci_init(void)
10631063
size_t size;
10641064
int ret;
10651065

1066-
size = max_packages * sizeof(struct pci_extra_dev);
1066+
size = max_dies * sizeof(struct pci_extra_dev);
10671067
uncore_extra_pci_dev = kzalloc(size, GFP_KERNEL);
10681068
if (!uncore_extra_pci_dev) {
10691069
ret = -ENOMEM;
@@ -1110,11 +1110,11 @@ static void uncore_change_type_ctx(struct intel_uncore_type *type, int old_cpu,
11101110
{
11111111
struct intel_uncore_pmu *pmu = type->pmus;
11121112
struct intel_uncore_box *box;
1113-
int i, pkg;
1113+
int i, die;
11141114

1115-
pkg = topology_logical_die_id(old_cpu < 0 ? new_cpu : old_cpu);
1115+
die = topology_logical_die_id(old_cpu < 0 ? new_cpu : old_cpu);
11161116
for (i = 0; i < type->num_boxes; i++, pmu++) {
1117-
box = pmu->boxes[pkg];
1117+
box = pmu->boxes[die];
11181118
if (!box)
11191119
continue;
11201120

@@ -1147,7 +1147,7 @@ static int uncore_event_cpu_offline(unsigned int cpu)
11471147
struct intel_uncore_type *type, **types = uncore_msr_uncores;
11481148
struct intel_uncore_pmu *pmu;
11491149
struct intel_uncore_box *box;
1150-
int i, pkg, target;
1150+
int i, die, target;
11511151

11521152
/* Check if exiting cpu is used for collecting uncore events */
11531153
if (!cpumask_test_and_clear_cpu(cpu, &uncore_cpu_mask))
@@ -1166,12 +1166,12 @@ static int uncore_event_cpu_offline(unsigned int cpu)
11661166

11671167
unref:
11681168
/* Clear the references */
1169-
pkg = topology_logical_die_id(cpu);
1169+
die = topology_logical_die_id(cpu);
11701170
for (; *types; types++) {
11711171
type = *types;
11721172
pmu = type->pmus;
11731173
for (i = 0; i < type->num_boxes; i++, pmu++) {
1174-
box = pmu->boxes[pkg];
1174+
box = pmu->boxes[die];
11751175
if (box && atomic_dec_return(&box->refcnt) == 0)
11761176
uncore_box_exit(box);
11771177
}
@@ -1180,7 +1180,7 @@ static int uncore_event_cpu_offline(unsigned int cpu)
11801180
}
11811181

11821182
static int allocate_boxes(struct intel_uncore_type **types,
1183-
unsigned int pkg, unsigned int cpu)
1183+
unsigned int die, unsigned int cpu)
11841184
{
11851185
struct intel_uncore_box *box, *tmp;
11861186
struct intel_uncore_type *type;
@@ -1193,20 +1193,20 @@ static int allocate_boxes(struct intel_uncore_type **types,
11931193
type = *types;
11941194
pmu = type->pmus;
11951195
for (i = 0; i < type->num_boxes; i++, pmu++) {
1196-
if (pmu->boxes[pkg])
1196+
if (pmu->boxes[die])
11971197
continue;
11981198
box = uncore_alloc_box(type, cpu_to_node(cpu));
11991199
if (!box)
12001200
goto cleanup;
12011201
box->pmu = pmu;
1202-
box->pkgid = pkg;
1202+
box->dieid = die;
12031203
list_add(&box->active_list, &allocated);
12041204
}
12051205
}
12061206
/* Install them in the pmus */
12071207
list_for_each_entry_safe(box, tmp, &allocated, active_list) {
12081208
list_del_init(&box->active_list);
1209-
box->pmu->boxes[pkg] = box;
1209+
box->pmu->boxes[die] = box;
12101210
}
12111211
return 0;
12121212

@@ -1223,18 +1223,18 @@ static int uncore_event_cpu_online(unsigned int cpu)
12231223
struct intel_uncore_type *type, **types = uncore_msr_uncores;
12241224
struct intel_uncore_pmu *pmu;
12251225
struct intel_uncore_box *box;
1226-
int i, ret, pkg, target;
1226+
int i, ret, die, target;
12271227

1228-
pkg = topology_logical_die_id(cpu);
1229-
ret = allocate_boxes(types, pkg, cpu);
1228+
die = topology_logical_die_id(cpu);
1229+
ret = allocate_boxes(types, die, cpu);
12301230
if (ret)
12311231
return ret;
12321232

12331233
for (; *types; types++) {
12341234
type = *types;
12351235
pmu = type->pmus;
12361236
for (i = 0; i < type->num_boxes; i++, pmu++) {
1237-
box = pmu->boxes[pkg];
1237+
box = pmu->boxes[die];
12381238
if (box && atomic_inc_return(&box->refcnt) == 1)
12391239
uncore_box_init(box);
12401240
}
@@ -1419,7 +1419,7 @@ static int __init intel_uncore_init(void)
14191419
if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
14201420
return -ENODEV;
14211421

1422-
max_packages = topology_max_packages() * topology_max_die_per_package();
1422+
max_dies = topology_max_packages() * topology_max_die_per_package();
14231423

14241424
uncore_init = (struct intel_uncore_init_fun *)id->driver_data;
14251425
if (uncore_init->pci_init) {

arch/x86/events/intel/uncore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct intel_uncore_extra_reg {
108108

109109
struct intel_uncore_box {
110110
int pci_phys_id;
111-
int pkgid; /* Logical package ID */
111+
int dieid; /* Logical die ID */
112112
int n_active; /* number of active events */
113113
int n_events;
114114
int cpu; /* cpu to collect events */
@@ -467,7 +467,7 @@ static inline void uncore_box_exit(struct intel_uncore_box *box)
467467

468468
static inline bool uncore_box_is_fake(struct intel_uncore_box *box)
469469
{
470-
return (box->pkgid < 0);
470+
return (box->dieid < 0);
471471
}
472472

473473
static inline struct intel_uncore_pmu *uncore_event_to_pmu(struct perf_event *event)

arch/x86/events/intel/uncore_snbep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,8 +1058,8 @@ static void snbep_qpi_enable_event(struct intel_uncore_box *box, struct perf_eve
10581058

10591059
if (reg1->idx != EXTRA_REG_NONE) {
10601060
int idx = box->pmu->pmu_idx + SNBEP_PCI_QPI_PORT0_FILTER;
1061-
int pkg = box->pkgid;
1062-
struct pci_dev *filter_pdev = uncore_extra_pci_dev[pkg].dev[idx];
1061+
int die = box->dieid;
1062+
struct pci_dev *filter_pdev = uncore_extra_pci_dev[die].dev[idx];
10631063

10641064
if (filter_pdev) {
10651065
pci_write_config_dword(filter_pdev, reg1->reg,

0 commit comments

Comments
 (0)