Skip to content

Commit 9e8f6bf

Browse files
Perry Yuanbp3tk0v
authored andcommitted
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 <[email protected]> Co-developed-by: Mario Limonciello <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Acked-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/[email protected]
1 parent 263e66f commit 9e8f6bf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/x86/kernel/process_64.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
707707
/* Load the Intel cache allocation PQR MSR. */
708708
resctrl_arch_sched_in(next_p);
709709

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+
710714
return prev_p;
711715
}
712716

0 commit comments

Comments
 (0)