x86/intel_rdt: Change file names to accommodate RDT monitor code
Because the "perf cqm" and resctrl code were separately added and indivdually configurable, there seem to be separate context switch code and also things on global .h which are not really needed. Move only the scheduling specific code and definitions to <asm/intel_rdt_sched.h> and the put all the other declarations to a local intel_rdt.h. h/t to Reinette Chatre for pointing out that we should separate the public interfaces used by other parts of the kernel from private objects shared between the various files comprising RDT. No functional change. Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: ravi.v.shankar@intel.com Cc: tony.luck@intel.com Cc: fenghua.yu@intel.com Cc: peterz@infradead.org Cc: eranian@google.com Cc: vikas.shivappa@intel.com Cc: ak@linux.intel.com Cc: davidcc@google.com Cc: reinette.chatre@intel.com Link: http://lkml.kernel.org/r/1501017287-28083-5-git-send-email-vikas.shivappa@linux.intel.com
This commit is contained in:
parent
f01d7d51f5
commit
0583020456
|
@ -11103,7 +11103,7 @@ M: Fenghua Yu <fenghua.yu@intel.com>
|
||||||
L: linux-kernel@vger.kernel.org
|
L: linux-kernel@vger.kernel.org
|
||||||
S: Supported
|
S: Supported
|
||||||
F: arch/x86/kernel/cpu/intel_rdt*
|
F: arch/x86/kernel/cpu/intel_rdt*
|
||||||
F: arch/x86/include/asm/intel_rdt*
|
F: arch/x86/include/asm/intel_rdt_sched.h
|
||||||
F: Documentation/x86/intel_rdt*
|
F: Documentation/x86/intel_rdt*
|
||||||
|
|
||||||
READ-COPY UPDATE (RCU)
|
READ-COPY UPDATE (RCU)
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
#ifndef _ASM_X86_INTEL_RDT_COMMON_H
|
|
||||||
#define _ASM_X86_INTEL_RDT_COMMON_H
|
|
||||||
|
|
||||||
#define MSR_IA32_PQR_ASSOC 0x0c8f
|
|
||||||
|
|
||||||
/**
|
|
||||||
* struct intel_pqr_state - State cache for the PQR MSR
|
|
||||||
* @rmid: The cached Resource Monitoring ID
|
|
||||||
* @closid: The cached Class Of Service ID
|
|
||||||
*
|
|
||||||
* The upper 32 bits of MSR_IA32_PQR_ASSOC contain closid and the
|
|
||||||
* lower 10 bits rmid. The update to MSR_IA32_PQR_ASSOC always
|
|
||||||
* contains both parts, so we need to cache them.
|
|
||||||
*
|
|
||||||
* The cache also helps to avoid pointless updates if the value does
|
|
||||||
* not change.
|
|
||||||
*/
|
|
||||||
struct intel_pqr_state {
|
|
||||||
u32 rmid;
|
|
||||||
u32 closid;
|
|
||||||
};
|
|
||||||
|
|
||||||
DECLARE_PER_CPU(struct intel_pqr_state, pqr_state);
|
|
||||||
|
|
||||||
#endif /* _ASM_X86_INTEL_RDT_COMMON_H */
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
#ifndef _ASM_X86_INTEL_RDT_SCHED_H
|
||||||
|
#define _ASM_X86_INTEL_RDT_SCHED_H
|
||||||
|
|
||||||
|
#ifdef CONFIG_INTEL_RDT
|
||||||
|
|
||||||
|
#include <linux/sched.h>
|
||||||
|
#include <linux/jump_label.h>
|
||||||
|
|
||||||
|
#define IA32_PQR_ASSOC 0x0c8f
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct intel_pqr_state - State cache for the PQR MSR
|
||||||
|
* @rmid: The cached Resource Monitoring ID
|
||||||
|
* @closid: The cached Class Of Service ID
|
||||||
|
*
|
||||||
|
* The upper 32 bits of IA32_PQR_ASSOC contain closid and the
|
||||||
|
* lower 10 bits rmid. The update to IA32_PQR_ASSOC always
|
||||||
|
* contains both parts, so we need to cache them.
|
||||||
|
*
|
||||||
|
* The cache also helps to avoid pointless updates if the value does
|
||||||
|
* not change.
|
||||||
|
*/
|
||||||
|
struct intel_pqr_state {
|
||||||
|
u32 rmid;
|
||||||
|
u32 closid;
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_PER_CPU(struct intel_pqr_state, pqr_state);
|
||||||
|
DECLARE_PER_CPU_READ_MOSTLY(int, cpu_closid);
|
||||||
|
DECLARE_STATIC_KEY_FALSE(rdt_enable_key);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* intel_rdt_sched_in() - Writes the task's CLOSid to IA32_PQR_MSR
|
||||||
|
*
|
||||||
|
* Following considerations are made so that this has minimal impact
|
||||||
|
* on scheduler hot path:
|
||||||
|
* - This will stay as no-op unless we are running on an Intel SKU
|
||||||
|
* which supports resource control and we enable by mounting the
|
||||||
|
* resctrl file system.
|
||||||
|
* - Caches the per cpu CLOSid values and does the MSR write only
|
||||||
|
* when a task with a different CLOSid is scheduled in.
|
||||||
|
*
|
||||||
|
* Must be called with preemption disabled.
|
||||||
|
*/
|
||||||
|
static inline void intel_rdt_sched_in(void)
|
||||||
|
{
|
||||||
|
if (static_branch_likely(&rdt_enable_key)) {
|
||||||
|
struct intel_pqr_state *state = this_cpu_ptr(&pqr_state);
|
||||||
|
int closid;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this task has a closid assigned, use it.
|
||||||
|
* Else use the closid assigned to this cpu.
|
||||||
|
*/
|
||||||
|
closid = current->closid;
|
||||||
|
if (closid == 0)
|
||||||
|
closid = this_cpu_read(cpu_closid);
|
||||||
|
|
||||||
|
if (closid != state->closid) {
|
||||||
|
state->closid = closid;
|
||||||
|
wrmsr(IA32_PQR_ASSOC, state->rmid, closid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static inline void intel_rdt_sched_in(void) {}
|
||||||
|
|
||||||
|
#endif /* CONFIG_INTEL_RDT */
|
||||||
|
|
||||||
|
#endif /* _ASM_X86_INTEL_RDT_SCHED_H */
|
|
@ -30,7 +30,8 @@
|
||||||
#include <linux/cpuhotplug.h>
|
#include <linux/cpuhotplug.h>
|
||||||
|
|
||||||
#include <asm/intel-family.h>
|
#include <asm/intel-family.h>
|
||||||
#include <asm/intel_rdt.h>
|
#include <asm/intel_rdt_sched.h>
|
||||||
|
#include "intel_rdt.h"
|
||||||
|
|
||||||
#define MAX_MBA_BW 100u
|
#define MAX_MBA_BW 100u
|
||||||
#define MBA_IS_LINEAR 0x4
|
#define MBA_IS_LINEAR 0x4
|
||||||
|
@ -455,7 +456,7 @@ static void clear_closid(int cpu)
|
||||||
|
|
||||||
per_cpu(cpu_closid, cpu) = 0;
|
per_cpu(cpu_closid, cpu) = 0;
|
||||||
state->closid = 0;
|
state->closid = 0;
|
||||||
wrmsr(MSR_IA32_PQR_ASSOC, state->rmid, 0);
|
wrmsr(IA32_PQR_ASSOC, state->rmid, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int intel_rdt_online_cpu(unsigned int cpu)
|
static int intel_rdt_online_cpu(unsigned int cpu)
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
#ifndef _ASM_X86_INTEL_RDT_H
|
#ifndef _ASM_X86_INTEL_RDT_H
|
||||||
#define _ASM_X86_INTEL_RDT_H
|
#define _ASM_X86_INTEL_RDT_H
|
||||||
|
|
||||||
#ifdef CONFIG_INTEL_RDT
|
|
||||||
|
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/kernfs.h>
|
#include <linux/kernfs.h>
|
||||||
#include <linux/jump_label.h>
|
#include <linux/jump_label.h>
|
||||||
|
|
||||||
#include <asm/intel_rdt_common.h>
|
|
||||||
|
|
||||||
#define IA32_L3_QOS_CFG 0xc81
|
#define IA32_L3_QOS_CFG 0xc81
|
||||||
#define IA32_L3_CBM_BASE 0xc90
|
#define IA32_L3_CBM_BASE 0xc90
|
||||||
#define IA32_L2_CBM_BASE 0xd10
|
#define IA32_L2_CBM_BASE 0xd10
|
||||||
|
@ -244,43 +240,4 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
|
||||||
int rdtgroup_schemata_show(struct kernfs_open_file *of,
|
int rdtgroup_schemata_show(struct kernfs_open_file *of,
|
||||||
struct seq_file *s, void *v);
|
struct seq_file *s, void *v);
|
||||||
|
|
||||||
/*
|
|
||||||
* intel_rdt_sched_in() - Writes the task's CLOSid to IA32_PQR_MSR
|
|
||||||
*
|
|
||||||
* Following considerations are made so that this has minimal impact
|
|
||||||
* on scheduler hot path:
|
|
||||||
* - This will stay as no-op unless we are running on an Intel SKU
|
|
||||||
* which supports resource control and we enable by mounting the
|
|
||||||
* resctrl file system.
|
|
||||||
* - Caches the per cpu CLOSid values and does the MSR write only
|
|
||||||
* when a task with a different CLOSid is scheduled in.
|
|
||||||
*
|
|
||||||
* Must be called with preemption disabled.
|
|
||||||
*/
|
|
||||||
static inline void intel_rdt_sched_in(void)
|
|
||||||
{
|
|
||||||
if (static_branch_likely(&rdt_enable_key)) {
|
|
||||||
struct intel_pqr_state *state = this_cpu_ptr(&pqr_state);
|
|
||||||
int closid;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If this task has a closid assigned, use it.
|
|
||||||
* Else use the closid assigned to this cpu.
|
|
||||||
*/
|
|
||||||
closid = current->closid;
|
|
||||||
if (closid == 0)
|
|
||||||
closid = this_cpu_read(cpu_closid);
|
|
||||||
|
|
||||||
if (closid != state->closid) {
|
|
||||||
state->closid = closid;
|
|
||||||
wrmsr(MSR_IA32_PQR_ASSOC, state->rmid, closid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static inline void intel_rdt_sched_in(void) {}
|
|
||||||
|
|
||||||
#endif /* CONFIG_INTEL_RDT */
|
|
||||||
#endif /* _ASM_X86_INTEL_RDT_H */
|
#endif /* _ASM_X86_INTEL_RDT_H */
|
|
@ -32,8 +32,8 @@
|
||||||
|
|
||||||
#include <uapi/linux/magic.h>
|
#include <uapi/linux/magic.h>
|
||||||
|
|
||||||
#include <asm/intel_rdt.h>
|
#include <asm/intel_rdt_sched.h>
|
||||||
#include <asm/intel_rdt_common.h>
|
#include "intel_rdt.h"
|
||||||
|
|
||||||
DEFINE_STATIC_KEY_FALSE(rdt_enable_key);
|
DEFINE_STATIC_KEY_FALSE(rdt_enable_key);
|
||||||
struct kernfs_root *rdt_root;
|
struct kernfs_root *rdt_root;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <linux/kernfs.h>
|
#include <linux/kernfs.h>
|
||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <asm/intel_rdt.h>
|
#include "intel_rdt.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whether MBA bandwidth percentage value is correct. The value is
|
* Check whether MBA bandwidth percentage value is correct. The value is
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
#include <asm/debugreg.h>
|
#include <asm/debugreg.h>
|
||||||
#include <asm/switch_to.h>
|
#include <asm/switch_to.h>
|
||||||
#include <asm/vm86.h>
|
#include <asm/vm86.h>
|
||||||
#include <asm/intel_rdt.h>
|
#include <asm/intel_rdt_sched.h>
|
||||||
#include <asm/proto.h>
|
#include <asm/proto.h>
|
||||||
|
|
||||||
void __show_regs(struct pt_regs *regs, int all)
|
void __show_regs(struct pt_regs *regs, int all)
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#include <asm/switch_to.h>
|
#include <asm/switch_to.h>
|
||||||
#include <asm/xen/hypervisor.h>
|
#include <asm/xen/hypervisor.h>
|
||||||
#include <asm/vdso.h>
|
#include <asm/vdso.h>
|
||||||
#include <asm/intel_rdt.h>
|
#include <asm/intel_rdt_sched.h>
|
||||||
#include <asm/unistd.h>
|
#include <asm/unistd.h>
|
||||||
#ifdef CONFIG_IA32_EMULATION
|
#ifdef CONFIG_IA32_EMULATION
|
||||||
/* Not included via unistd.h */
|
/* Not included via unistd.h */
|
||||||
|
|
Loading…
Reference in New Issue