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

From: Peter Jung
Date: Tue Dec 03 2024 - 15:41:15 EST


This does fix the preferred core behavior now and it works now as it should.
Tested with a 9950X on several games, and the scheduler now picks the correct cores, which results into a heavy performance improvement, due not migrating through the second ccd.

Thanks!

Tested-by: Peter Jung <ptr1337@xxxxxxxxxxx>


On 03.12.24 21:11, Mario Limonciello wrote:
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@xxxxxxx>
---
v2:
* Fix c23 compatibility issue reported by LKP
---
arch/x86/kernel/smpboot.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index b5a8f0891135b..6a38cf3feb1a9 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>
@@ -501,6 +503,15 @@ static int x86_die_flags(void)
cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES))
return x86_sched_itmt_flags();
+ if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
+ boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
+ bool prefcore = false;
+
+ amd_detect_prefcore(&prefcore);
+ if (prefcore)
+ return x86_sched_itmt_flags();
+ }
+
return 0;
}

base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37
-- 2.43.0