[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241104175407.19546-10-mario.limonciello@amd.com>
Date: Mon, 4 Nov 2024 11:54:04 -0600
From: Mario Limonciello <mario.limonciello@....com>
To: Borislav Petkov <bp@...en8.de>, Hans de Goede <hdegoede@...hat.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
CC: <x86@...nel.org>, "Gautham R . Shenoy" <gautham.shenoy@....com>, "Mario
Limonciello" <mario.limonciello@....com>, Perry Yuan <perry.yuan@....com>,
<linux-kernel@...r.kernel.org>, <linux-doc@...r.kernel.org>,
<linux-pm@...r.kernel.org>, <platform-driver-x86@...r.kernel.org>, "Shyam
Sundar S K" <Shyam-sundar.S-k@....com>
Subject: [PATCH v6 09/12] x86/process: Clear hardware feedback history for AMD processors
From: Perry Yuan <perry.yuan@....com>
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 was read and reset the hardware workload
classification history of CPU firmware and then it start to trigger
workload classification for the next running thread.
Signed-off-by: Perry Yuan <perry.yuan@....com>
Co-developed-by: Mario Limonciello <mario.limonciello@....com>
Signed-off-by: Mario Limonciello <mario.limonciello@....com>
---
v6:
* Drop all static key stuff and just call in __switch_to when
cpu feature enabled (Boris)
---
arch/x86/kernel/process_32.c | 4 ++++
arch/x86/kernel/process_64.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 0917c7f25720b..0bb6391b9089b 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -213,6 +213,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
/* Load the Intel cache allocation PQR MSR. */
resctrl_sched_in(next_p);
+ /* Reset hw history on AMD CPUs */
+ if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS))
+ wrmsrl(AMD_WORKLOAD_HRST, 0x1);
+
return prev_p;
}
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 226472332a70d..371e0e8f987fa 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -709,6 +709,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
/* Load the Intel cache allocation PQR MSR. */
resctrl_sched_in(next_p);
+ /* Reset hw history on AMD CPUs */
+ if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS))
+ wrmsrl(AMD_WORKLOAD_HRST, 0x1);
+
return prev_p;
}
--
2.43.0
Powered by blists - more mailing lists