diff options
author | Fenghua Yu <fenghua.yu@intel.com> | 2016-12-01 15:55:14 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-12-01 19:13:02 -0500 |
commit | 74fcdae1a7fdf30de5413ccc1eca271415d01124 (patch) | |
tree | a742dd6c925c16c6fda8d3c34393b4ec19db8db7 | |
parent | 0efc89be9471b152599d2db7eb47de8e0d71c59f (diff) |
x86/intel_rdt: Call intel_rdt_sched_in() with preemption disabled
intel_rdt_sched_in() must be called with preemption disabled because the
function accesses percpu variables (pqr_state and closid).
If a task moves itself via move_myself() preemption is enabled, which
violates the calling convention and can result in incorrect closid
selection when the task gets preempted or migrated.
Add the required protection and a comment about the calling convention.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Cc: "Ravi V Shankar" <ravi.v.shankar@intel.com>
Cc: "Tony Luck" <tony.luck@intel.com>
Cc: "Marcelo Tosatti" <mtosatti@redhat.com>
Cc: "Sai Prakhya" <sai.praneeth.prakhya@intel.com>
Cc: "Vikas Shivappa" <vikas.shivappa@linux.intel.com>
Cc: "H. Peter Anvin" <h.peter.anvin@intel.com>
Link: http://lkml.kernel.org/r/1480625714-54246-1-git-send-email-fenghua.yu@intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/include/asm/intel_rdt.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/include/asm/intel_rdt.h b/arch/x86/include/asm/intel_rdt.h index 6e90e87eadfe..95ce5c85b009 100644 --- a/arch/x86/include/asm/intel_rdt.h +++ b/arch/x86/include/asm/intel_rdt.h | |||
@@ -192,6 +192,8 @@ int rdtgroup_schemata_show(struct kernfs_open_file *of, | |||
192 | * resctrl file system. | 192 | * resctrl file system. |
193 | * - Caches the per cpu CLOSid values and does the MSR write only | 193 | * - Caches the per cpu CLOSid values and does the MSR write only |
194 | * when a task with a different CLOSid is scheduled in. | 194 | * when a task with a different CLOSid is scheduled in. |
195 | * | ||
196 | * Must be called with preemption disabled. | ||
195 | */ | 197 | */ |
196 | static inline void intel_rdt_sched_in(void) | 198 | static inline void intel_rdt_sched_in(void) |
197 | { | 199 | { |
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index fb8e03e2b70d..1afd3f393501 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | |||
@@ -326,8 +326,10 @@ static void move_myself(struct callback_head *head) | |||
326 | kfree(rdtgrp); | 326 | kfree(rdtgrp); |
327 | } | 327 | } |
328 | 328 | ||
329 | preempt_disable(); | ||
329 | /* update PQR_ASSOC MSR to make resource group go into effect */ | 330 | /* update PQR_ASSOC MSR to make resource group go into effect */ |
330 | intel_rdt_sched_in(); | 331 | intel_rdt_sched_in(); |
332 | preempt_enable(); | ||
331 | 333 | ||
332 | kfree(callback); | 334 | kfree(callback); |
333 | } | 335 | } |