[PATCH] x86/cpu: Enable SD_ASYM_PACKING for PKG domain on systems with AMD preferred cores

Mario Limonciello posted 1 patch 1 year, 2 months ago
There is a newer version of this series
arch/x86/kernel/smpboot.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
[PATCH] x86/cpu: Enable SD_ASYM_PACKING for PKG domain on systems with AMD preferred cores
Posted by Mario Limonciello 1 year, 2 months ago
From: Mario Limonciello <mario.limonciello@amd.com>

For the scheduler to use and prefer AMD preferred core rankings set
SD_ASYM_PACKING for x86_die_flags().

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 arch/x86/kernel/smpboot.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index b5a8f0891135b..419e7ae096395 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -62,6 +62,8 @@
 #include <linux/mc146818rtc.h>
 #include <linux/acpi.h>
 
+#include <acpi/cppc_acpi.h>
+
 #include <asm/acpi.h>
 #include <asm/cacheinfo.h>
 #include <asm/desc.h>
@@ -497,10 +499,19 @@ static int x86_cluster_flags(void)
 
 static int x86_die_flags(void)
 {
-	if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU) ||
-	    cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES))
+	if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU))
 		return x86_sched_itmt_flags();
 
+	switch (boot_cpu_data.x86_vendor) {
+	case X86_VENDOR_AMD:
+	case X86_VENDOR_HYGON:
+		bool prefcore = false;
+
+		amd_detect_prefcore(&prefcore);
+		if (prefcore || cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES))
+			return x86_sched_itmt_flags();
+	};
+
 	return 0;
 }
 

base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37
-- 
2.43.0
Re: [PATCH] x86/cpu: Enable SD_ASYM_PACKING for PKG domain on systems with AMD preferred cores
Posted by kernel test robot 1 year, 2 months ago
Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 40384c840ea1944d7c5a392e8975ed088ecf0b37]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/x86-cpu-Enable-SD_ASYM_PACKING-for-PKG-domain-on-systems-with-AMD-preferred-cores/20241202-124012
base:   40384c840ea1944d7c5a392e8975ed088ecf0b37
patch link:    https://lore.kernel.org/r/20241202043724.3929062-1-superm1%40kernel.org
patch subject: [PATCH] x86/cpu: Enable SD_ASYM_PACKING for PKG domain on systems with AMD preferred cores
config: x86_64-randconfig-r061-20241202 (https://download.01.org/0day-ci/archive/20241202/202412022352.jwqoAZXs-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412022352.jwqoAZXs-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> arch/x86/kernel/smpboot.c:513:2-3: Unneeded semicolon

vim +513 arch/x86/kernel/smpboot.c

   499	
   500	static int x86_die_flags(void)
   501	{
   502		if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU))
   503			return x86_sched_itmt_flags();
   504	
   505		switch (boot_cpu_data.x86_vendor) {
   506		case X86_VENDOR_AMD:
   507		case X86_VENDOR_HYGON:
   508			bool prefcore = false;
   509	
   510			amd_detect_prefcore(&prefcore);
   511			if (prefcore || cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES))
   512				return x86_sched_itmt_flags();
 > 513		};
   514	
   515		return 0;
   516	}
   517	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] x86/cpu: Enable SD_ASYM_PACKING for PKG domain on systems with AMD preferred cores
Posted by kernel test robot 1 year, 2 months ago
Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 40384c840ea1944d7c5a392e8975ed088ecf0b37]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/x86-cpu-Enable-SD_ASYM_PACKING-for-PKG-domain-on-systems-with-AMD-preferred-cores/20241202-124012
base:   40384c840ea1944d7c5a392e8975ed088ecf0b37
patch link:    https://lore.kernel.org/r/20241202043724.3929062-1-superm1%40kernel.org
patch subject: [PATCH] x86/cpu: Enable SD_ASYM_PACKING for PKG domain on systems with AMD preferred cores
config: i386-buildonly-randconfig-005-20241202 (https://download.01.org/0day-ci/archive/20241202/202412021625.Q3QQhOi8-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241202/202412021625.Q3QQhOi8-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412021625.Q3QQhOi8-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/x86/kernel/smpboot.c:50:
   In file included from include/linux/memblock.h:12:
   In file included from include/linux/mm.h:2223:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> arch/x86/kernel/smpboot.c:508:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
     508 |                 bool prefcore = false;
         |                 ^
   2 warnings generated.


vim +508 arch/x86/kernel/smpboot.c

   499	
   500	static int x86_die_flags(void)
   501	{
   502		if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU))
   503			return x86_sched_itmt_flags();
   504	
   505		switch (boot_cpu_data.x86_vendor) {
   506		case X86_VENDOR_AMD:
   507		case X86_VENDOR_HYGON:
 > 508			bool prefcore = false;
   509	
   510			amd_detect_prefcore(&prefcore);
   511			if (prefcore || cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES))
   512				return x86_sched_itmt_flags();
   513		};
   514	
   515		return 0;
   516	}
   517	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki