Skip to content

Commit 02fb601

Browse files
committed
x86/cpu: Move phys_proc_id into topology info
Rename it to pkg_id which is the terminology used in the kernel. No functional change. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Juergen Gross <[email protected]> Tested-by: Sohil Mehta <[email protected]> Tested-by: Michael Kelley <[email protected]> Tested-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Zhang Rui <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b9655e7 commit 02fb601

File tree

15 files changed

+30
-34
lines changed

15 files changed

+30
-34
lines changed

Documentation/arch/x86/topology.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Package-related topology information in the kernel:
5959

6060
The physical ID of the die. This information is retrieved via CPUID.
6161

62-
- cpuinfo_x86.phys_proc_id:
62+
- cpuinfo_x86.topo.pkg_id:
6363

6464
The physical ID of the package. This information is retrieved via CPUID
6565
and deduced from the APIC IDs of the cores in the package.

arch/x86/include/asm/processor.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ struct cpuinfo_topology {
8383
u32 apicid;
8484
// The initial APIC ID provided by CPUID
8585
u32 initial_apicid;
86+
87+
// Physical package ID
88+
u32 pkg_id;
8689
};
8790

8891
struct cpuinfo_x86 {
@@ -134,8 +137,6 @@ struct cpuinfo_x86 {
134137
u16 x86_clflush_size;
135138
/* number of cores as seen by the OS: */
136139
u16 booted_cores;
137-
/* Physical processor id: */
138-
u16 phys_proc_id;
139140
/* Logical processor id: */
140141
u16 logical_proc_id;
141142
/* Core id: */

arch/x86/include/asm/topology.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
106106
extern const struct cpumask *cpu_clustergroup_mask(int cpu);
107107

108108
#define topology_logical_package_id(cpu) (cpu_data(cpu).logical_proc_id)
109-
#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
109+
#define topology_physical_package_id(cpu) (cpu_data(cpu).topo.pkg_id)
110110
#define topology_logical_die_id(cpu) (cpu_data(cpu).logical_die_id)
111111
#define topology_die_id(cpu) (cpu_data(cpu).cpu_die_id)
112112
#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)

arch/x86/include/asm/x86_init.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ struct x86_init_ops {
177177
* struct x86_cpuinit_ops - platform specific cpu hotplug setups
178178
* @setup_percpu_clockev: set up the per cpu clock event device
179179
* @early_percpu_clock_init: early init of the per cpu clock event device
180-
* @fixup_cpu_id: fixup function for cpuinfo_x86::phys_proc_id
180+
* @fixup_cpu_id: fixup function for cpuinfo_x86::topo.pkg_id
181181
* @parallel_bringup: Parallel bringup control
182182
*/
183183
struct x86_cpuinit_ops {

arch/x86/kernel/apic/apic_numachip.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static void fixup_cpu_id(struct cpuinfo_x86 *c, int node)
169169
nodes = ((val >> 3) & 7) + 1;
170170
}
171171

172-
c->phys_proc_id = node / nodes;
172+
c->topo.pkg_id = node / nodes;
173173
}
174174

175175
static int __init numachip_system_init(void)

arch/x86/kernel/cpu/amd.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c)
461461
/* Low order bits define the core id (index of core in socket) */
462462
c->cpu_core_id = c->topo.initial_apicid & ((1 << bits)-1);
463463
/* Convert the initial APIC ID into the socket ID */
464-
c->phys_proc_id = c->topo.initial_apicid >> bits;
464+
c->topo.pkg_id = c->topo.initial_apicid >> bits;
465465
/* use socket ID also for last level cache */
466-
per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->phys_proc_id;
466+
per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->topo.pkg_id;
467467
}
468468

469469
u32 amd_get_nodes_per_socket(void)

arch/x86/kernel/cpu/cacheinfo.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,10 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
875875
* turns means that the only possibility is SMT (as indicated in
876876
* cpuid1). Since cpuid2 doesn't specify shared caches, and we know
877877
* that SMT shares all caches, we can unconditionally set cpu_llc_id to
878-
* c->phys_proc_id.
878+
* c->topo.pkg_id.
879879
*/
880880
if (per_cpu(cpu_llc_id, cpu) == BAD_APICID)
881-
per_cpu(cpu_llc_id, cpu) = c->phys_proc_id;
881+
per_cpu(cpu_llc_id, cpu) = c->topo.pkg_id;
882882
#endif
883883

884884
c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d));

arch/x86/kernel/cpu/common.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ void detect_ht(struct cpuinfo_x86 *c)
914914
return;
915915

916916
index_msb = get_count_order(smp_num_siblings);
917-
c->phys_proc_id = apic->phys_pkg_id(c->topo.initial_apicid, index_msb);
917+
c->topo.pkg_id = apic->phys_pkg_id(c->topo.initial_apicid, index_msb);
918918

919919
smp_num_siblings = smp_num_siblings / c->x86_max_cores;
920920

@@ -1769,7 +1769,7 @@ static void generic_identify(struct cpuinfo_x86 *c)
17691769
c->topo.apicid = c->topo.initial_apicid;
17701770
# endif
17711771
#endif
1772-
c->phys_proc_id = c->topo.initial_apicid;
1772+
c->topo.pkg_id = c->topo.initial_apicid;
17731773
}
17741774

17751775
get_model_name(c); /* Default name */
@@ -1807,7 +1807,7 @@ static void validate_apic_and_package_id(struct cpuinfo_x86 *c)
18071807
pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x APIC: %x\n",
18081808
cpu, apicid, c->topo.initial_apicid);
18091809
}
1810-
BUG_ON(topology_update_package_map(c->phys_proc_id, cpu));
1810+
BUG_ON(topology_update_package_map(c->topo.pkg_id, cpu));
18111811
BUG_ON(topology_update_die_map(c->cpu_die_id, cpu));
18121812
#else
18131813
c->logical_proc_id = 0;

arch/x86/kernel/cpu/hygon.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static void hygon_get_topology(struct cpuinfo_x86 *c)
9292
* when running on host.
9393
*/
9494
if (!boot_cpu_has(X86_FEATURE_HYPERVISOR) && c->x86_model <= 0x3)
95-
c->phys_proc_id = c->topo.apicid >> APICID_SOCKET_ID_BIT;
95+
c->topo.pkg_id = c->topo.apicid >> APICID_SOCKET_ID_BIT;
9696

9797
cacheinfo_hygon_init_llc_id(c, cpu);
9898
} else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) {
@@ -122,9 +122,9 @@ static void hygon_detect_cmp(struct cpuinfo_x86 *c)
122122
/* Low order bits define the core id (index of core in socket) */
123123
c->cpu_core_id = c->topo.initial_apicid & ((1 << bits)-1);
124124
/* Convert the initial APIC ID into the socket ID */
125-
c->phys_proc_id = c->topo.initial_apicid >> bits;
125+
c->topo.pkg_id = c->topo.initial_apicid >> bits;
126126
/* use socket ID also for last level cache */
127-
per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->phys_proc_id;
127+
per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->topo.pkg_id;
128128
}
129129

130130
static void srat_detect_node(struct cpuinfo_x86 *c)

arch/x86/kernel/cpu/mce/apei.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ int apei_smca_report_x86_error(struct cper_ia_proc_ctx *ctx_info, u64 lapic_id)
105105
for_each_possible_cpu(cpu) {
106106
if (cpu_data(cpu).topo.initial_apicid == lapic_id) {
107107
m.extcpu = cpu;
108-
m.socketid = cpu_data(m.extcpu).phys_proc_id;
108+
m.socketid = cpu_data(m.extcpu).topo.pkg_id;
109109
break;
110110
}
111111
}

arch/x86/kernel/cpu/mce/core.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void mce_setup(struct mce *m)
123123
m->time = __ktime_get_real_seconds();
124124
m->cpuvendor = boot_cpu_data.x86_vendor;
125125
m->cpuid = cpuid_eax(1);
126-
m->socketid = cpu_data(m->extcpu).phys_proc_id;
126+
m->socketid = cpu_data(m->extcpu).topo.pkg_id;
127127
m->apicid = cpu_data(m->extcpu).topo.initial_apicid;
128128
m->mcgcap = __rdmsr(MSR_IA32_MCG_CAP);
129129
m->ppin = cpu_data(m->extcpu).ppin;

arch/x86/kernel/cpu/proc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c,
2020
unsigned int cpu)
2121
{
2222
#ifdef CONFIG_SMP
23-
seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
23+
seq_printf(m, "physical id\t: %d\n", c->topo.pkg_id);
2424
seq_printf(m, "siblings\t: %d\n",
2525
cpumask_weight(topology_core_cpumask(cpu)));
2626
seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);

arch/x86/kernel/cpu/topology.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ int detect_extended_topology(struct cpuinfo_x86 *c)
154154
core_plus_mask_width) & die_select_mask;
155155
}
156156

157-
c->phys_proc_id = apic->phys_pkg_id(c->topo.initial_apicid,
158-
pkg_mask_width);
157+
c->topo.pkg_id = apic->phys_pkg_id(c->topo.initial_apicid, pkg_mask_width);
159158
/*
160159
* Reinit the apicid, now that we have extended initial_apicid.
161160
*/

arch/x86/kernel/smpboot.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ int topology_phys_to_logical_pkg(unsigned int phys_pkg)
339339
for_each_possible_cpu(cpu) {
340340
struct cpuinfo_x86 *c = &cpu_data(cpu);
341341

342-
if (c->initialized && c->phys_proc_id == phys_pkg)
342+
if (c->initialized && c->topo.pkg_id == phys_pkg)
343343
return c->logical_proc_id;
344344
}
345345
return -1;
@@ -355,13 +355,13 @@ EXPORT_SYMBOL(topology_phys_to_logical_pkg);
355355
*/
356356
static int topology_phys_to_logical_die(unsigned int die_id, unsigned int cur_cpu)
357357
{
358-
int cpu, proc_id = cpu_data(cur_cpu).phys_proc_id;
358+
int cpu, proc_id = cpu_data(cur_cpu).topo.pkg_id;
359359

360360
for_each_possible_cpu(cpu) {
361361
struct cpuinfo_x86 *c = &cpu_data(cpu);
362362

363363
if (c->initialized && c->cpu_die_id == die_id &&
364-
c->phys_proc_id == proc_id)
364+
c->topo.pkg_id == proc_id)
365365
return c->logical_die_id;
366366
}
367367
return -1;
@@ -421,7 +421,7 @@ static void __init smp_store_boot_cpu_info(void)
421421

422422
*c = boot_cpu_data;
423423
c->cpu_index = id;
424-
topology_update_package_map(c->phys_proc_id, id);
424+
topology_update_package_map(c->topo.pkg_id, id);
425425
topology_update_die_map(c->cpu_die_id, id);
426426
c->initialized = true;
427427
}
@@ -476,7 +476,7 @@ static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
476476
if (boot_cpu_has(X86_FEATURE_TOPOEXT)) {
477477
int cpu1 = c->cpu_index, cpu2 = o->cpu_index;
478478

479-
if (c->phys_proc_id == o->phys_proc_id &&
479+
if (c->topo.pkg_id == o->topo.pkg_id &&
480480
c->cpu_die_id == o->cpu_die_id &&
481481
per_cpu(cpu_llc_id, cpu1) == per_cpu(cpu_llc_id, cpu2)) {
482482
if (c->cpu_core_id == o->cpu_core_id)
@@ -488,7 +488,7 @@ static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
488488
return topology_sane(c, o, "smt");
489489
}
490490

491-
} else if (c->phys_proc_id == o->phys_proc_id &&
491+
} else if (c->topo.pkg_id == o->topo.pkg_id &&
492492
c->cpu_die_id == o->cpu_die_id &&
493493
c->cpu_core_id == o->cpu_core_id) {
494494
return topology_sane(c, o, "smt");
@@ -499,7 +499,7 @@ static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
499499

500500
static bool match_die(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
501501
{
502-
if (c->phys_proc_id == o->phys_proc_id &&
502+
if (c->topo.pkg_id == o->topo.pkg_id &&
503503
c->cpu_die_id == o->cpu_die_id)
504504
return true;
505505
return false;
@@ -527,7 +527,7 @@ static bool match_l2c(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
527527
*/
528528
static bool match_pkg(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
529529
{
530-
if (c->phys_proc_id == o->phys_proc_id)
530+
if (c->topo.pkg_id == o->topo.pkg_id)
531531
return true;
532532
return false;
533533
}

drivers/scsi/lpfc/lpfc_init.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -12442,9 +12442,6 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)
1244212442
int max_core_id, min_core_id;
1244312443
struct lpfc_vector_map_info *cpup;
1244412444
struct lpfc_vector_map_info *new_cpup;
12445-
#ifdef CONFIG_X86
12446-
struct cpuinfo_x86 *cpuinfo;
12447-
#endif
1244812445
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1244912446
struct lpfc_hdwq_stat *c_stat;
1245012447
#endif
@@ -12458,8 +12455,7 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)
1245812455
for_each_present_cpu(cpu) {
1245912456
cpup = &phba->sli4_hba.cpu_map[cpu];
1246012457
#ifdef CONFIG_X86
12461-
cpuinfo = &cpu_data(cpu);
12462-
cpup->phys_id = cpuinfo->phys_proc_id;
12458+
cpup->phys_id = topology_physical_package_id(cpu);
1246312459
cpup->core_id = cpuinfo->cpu_core_id;
1246412460
if (lpfc_find_hyper(phba, cpu, cpup->phys_id, cpup->core_id))
1246512461
cpup->flag |= LPFC_CPU_MAP_HYPER;

0 commit comments

Comments
 (0)