Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/process: Clear hardware feedback history for AMD processors

Incorporate a mechanism within the context switching code to reset the
hardware history for AMD processors. Specifically, when a task is switched in,
the class ID is read and the hardware workload classification history of the
CPU firmware is reset. Then, the workload classification for the next running
thread is begun.

[ bp: Massage commit message. ]

Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Co-developed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/20250609200518.3616080-10-superm1@kernel.org

authored by

Perry Yuan and committed by
Borislav Petkov (AMD)
9e8f6bf7 263e66f9

+4
+4
arch/x86/kernel/process_64.c
··· 707 707 /* Load the Intel cache allocation PQR MSR. */ 708 708 resctrl_arch_sched_in(next_p); 709 709 710 + /* Reset hw history on AMD CPUs */ 711 + if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS)) 712 + wrmsrl(MSR_AMD_WORKLOAD_HRST, 0x1); 713 + 710 714 return prev_p; 711 715 } 712 716