Commit 74fcdae1 authored by Fenghua Yu's avatar Fenghua Yu Committed by Thomas Gleixner

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: default avatarFenghua 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.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 0efc89be
...@@ -192,6 +192,8 @@ int rdtgroup_schemata_show(struct kernfs_open_file *of, ...@@ -192,6 +192,8 @@ int rdtgroup_schemata_show(struct kernfs_open_file *of,
* resctrl file system. * resctrl file system.
* - Caches the per cpu CLOSid values and does the MSR write only * - Caches the per cpu CLOSid values and does the MSR write only
* when a task with a different CLOSid is scheduled in. * when a task with a different CLOSid is scheduled in.
*
* Must be called with preemption disabled.
*/ */
static inline void intel_rdt_sched_in(void) static inline void intel_rdt_sched_in(void)
{ {
......
...@@ -326,8 +326,10 @@ static void move_myself(struct callback_head *head) ...@@ -326,8 +326,10 @@ static void move_myself(struct callback_head *head)
kfree(rdtgrp); kfree(rdtgrp);
} }
preempt_disable();
/* update PQR_ASSOC MSR to make resource group go into effect */ /* update PQR_ASSOC MSR to make resource group go into effect */
intel_rdt_sched_in(); intel_rdt_sched_in();
preempt_enable();
kfree(callback); kfree(callback);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment