Commit 89b0f15f authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

x86/cpu/topology: Get rid of cpuinfo::x86_max_cores



Now that __num_cores_per_package and __num_threads_per_package are
available, cpuinfo::x86_max_cores and the related math all over the place
can be replaced with the ready to consume data.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarMichael Kelley <mhklinux@outlook.com>
Tested-by: default avatarSohil Mehta <sohil.mehta@intel.com>
Link: https://lore.kernel.org/r/20240213210253.176147806@linutronix.de
parent fd43b8ae
Loading
Loading
Loading
Loading
+9 −15
Original line number Diff line number Diff line
@@ -47,17 +47,21 @@ AMD nomenclature for package is 'Node'.

Package-related topology information in the kernel:

  - cpuinfo_x86.x86_max_cores:
  - topology_num_threads_per_package()

    The number of cores in a package. This information is retrieved via CPUID.
    The number of threads in a package.

  - cpuinfo_x86.x86_max_dies:
  - topology_num_cores_per_package()

    The number of dies in a package. This information is retrieved via CPUID.
    The number of cores in a package.

  - topology_max_dies_per_package()

    The maximum number of dies in a package.

  - cpuinfo_x86.topo.die_id:

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

  - cpuinfo_x86.topo.pkg_id:

@@ -96,16 +100,6 @@ are SMT- or CMT-type threads.
AMDs nomenclature for a CMT core is "Compute Unit". The kernel always uses
"core".

Core-related topology information in the kernel:

  - smp_num_siblings:

    The number of threads in a core. The number of threads in a package can be
    calculated by::

	threads_per_package = cpuinfo_x86.x86_max_cores * smp_num_siblings


Threads
=======
A thread is a single scheduling unit. It's the equivalent to a logical Linux
+2 −2
Original line number Diff line number Diff line
@@ -1221,8 +1221,8 @@ void nhmex_uncore_cpu_init(void)
		uncore_nhmex = true;
	else
		nhmex_uncore_mbox.event_descs = wsmex_uncore_mbox_events;
	if (nhmex_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
		nhmex_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
	if (nhmex_uncore_cbox.num_boxes > topology_num_cores_per_package())
		nhmex_uncore_cbox.num_boxes = topology_num_cores_per_package();
	uncore_msr_uncores = nhmex_msr_uncores;
}
/* end of Nehalem-EX uncore support */
+4 −4
Original line number Diff line number Diff line
@@ -364,8 +364,8 @@ static struct intel_uncore_type *snb_msr_uncores[] = {
void snb_uncore_cpu_init(void)
{
	uncore_msr_uncores = snb_msr_uncores;
	if (snb_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
		snb_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
	if (snb_uncore_cbox.num_boxes > topology_num_cores_per_package())
		snb_uncore_cbox.num_boxes = topology_num_cores_per_package();
}

static void skl_uncore_msr_init_box(struct intel_uncore_box *box)
@@ -428,8 +428,8 @@ static struct intel_uncore_type *skl_msr_uncores[] = {
void skl_uncore_cpu_init(void)
{
	uncore_msr_uncores = skl_msr_uncores;
	if (skl_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
		skl_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
	if (skl_uncore_cbox.num_boxes > topology_num_cores_per_package())
		skl_uncore_cbox.num_boxes = topology_num_cores_per_package();
	snb_uncore_arb.ops = &skl_uncore_msr_ops;
}

+8 −8
Original line number Diff line number Diff line
@@ -1172,8 +1172,8 @@ static struct intel_uncore_type *snbep_msr_uncores[] = {

void snbep_uncore_cpu_init(void)
{
	if (snbep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
		snbep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
	if (snbep_uncore_cbox.num_boxes > topology_num_cores_per_package())
		snbep_uncore_cbox.num_boxes = topology_num_cores_per_package();
	uncore_msr_uncores = snbep_msr_uncores;
}

@@ -1845,8 +1845,8 @@ static struct intel_uncore_type *ivbep_msr_uncores[] = {

void ivbep_uncore_cpu_init(void)
{
	if (ivbep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
		ivbep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
	if (ivbep_uncore_cbox.num_boxes > topology_num_cores_per_package())
		ivbep_uncore_cbox.num_boxes = topology_num_cores_per_package();
	uncore_msr_uncores = ivbep_msr_uncores;
}

@@ -2917,8 +2917,8 @@ static bool hswep_has_limit_sbox(unsigned int device)

void hswep_uncore_cpu_init(void)
{
	if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
		hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
	if (hswep_uncore_cbox.num_boxes > topology_num_cores_per_package())
		hswep_uncore_cbox.num_boxes = topology_num_cores_per_package();

	/* Detect 6-8 core systems with only two SBOXes */
	if (hswep_has_limit_sbox(HSWEP_PCU_DID))
@@ -3280,8 +3280,8 @@ static struct event_constraint bdx_uncore_pcu_constraints[] = {

void bdx_uncore_cpu_init(void)
{
	if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
		bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
	if (bdx_uncore_cbox.num_boxes > topology_num_cores_per_package())
		bdx_uncore_cbox.num_boxes = topology_num_cores_per_package();
	uncore_msr_uncores = bdx_msr_uncores;

	/* Detect systems with no SBOXes */
+0 −2
Original line number Diff line number Diff line
@@ -149,8 +149,6 @@ struct cpuinfo_x86 {
	unsigned long		loops_per_jiffy;
	/* protected processor identification number */
	u64			ppin;
	/* cpuid returned max cores value: */
	u16			x86_max_cores;
	u16			x86_clflush_size;
	/* number of cores as seen by the OS: */
	u16			booted_cores;
Loading