mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Vikas Shivappa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org,
	vikas.shivappa@linux.intel.com, tglx@linutronix.de
Subject: [tip:x86/cache] x86/intel_rdt: Change file names to accommodate RDT monitor code
Date: Tue, 1 Aug 2017 13:47:43 -0700	[thread overview]
Message-ID: <tip-0583020456cea9fcf43b84bb13a41eab059ae0a8@git.kernel.org> (raw)
In-Reply-To: <1501017287-28083-5-git-send-email-vikas.shivappa@linux.intel.com>

Commit-ID:  0583020456cea9fcf43b84bb13a41eab059ae0a8
Gitweb:     http://git.kernel.org/tip/0583020456cea9fcf43b84bb13a41eab059ae0a8
Author:     Vikas Shivappa <vikas.shivappa@linux.intel.com>
AuthorDate: Tue, 25 Jul 2017 14:14:23 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 1 Aug 2017 22:41:19 +0200

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

---
 MAINTAINERS                                      |  2 +-
 arch/x86/include/asm/intel_rdt_common.h          | 25 --------
 arch/x86/include/asm/intel_rdt_sched.h           | 72 ++++++++++++++++++++++++
 arch/x86/kernel/cpu/intel_rdt.c                  |  5 +-
 arch/x86/{include/asm => kernel/cpu}/intel_rdt.h | 43 --------------
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c         |  4 +-
 arch/x86/kernel/cpu/intel_rdt_schemata.c         |  2 +-
 arch/x86/kernel/process_32.c                     |  2 +-
 arch/x86/kernel/process_64.c                     |  2 +-
 9 files changed, 81 insertions(+), 76 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index f66488d..cbbc79a8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11103,7 +11103,7 @@ M:	Fenghua Yu <fenghua.yu@intel.com>
 L:	linux-kernel@vger.kernel.org
 S:	Supported
 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*
 
 READ-COPY UPDATE (RCU)
diff --git a/arch/x86/include/asm/intel_rdt_common.h b/arch/x86/include/asm/intel_rdt_common.h
deleted file mode 100644
index c953218..0000000
--- a/arch/x86/include/asm/intel_rdt_common.h
+++ /dev/null
@@ -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 */
diff --git a/arch/x86/include/asm/intel_rdt_sched.h b/arch/x86/include/asm/intel_rdt_sched.h
new file mode 100644
index 0000000..62a70bc
--- /dev/null
+++ b/arch/x86/include/asm/intel_rdt_sched.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 */
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index 989a997..08872e9 100644
--- a/arch/x86/kernel/cpu/intel_rdt.c
+++ b/arch/x86/kernel/cpu/intel_rdt.c
@@ -30,7 +30,8 @@
 #include <linux/cpuhotplug.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 MBA_IS_LINEAR	0x4
@@ -455,7 +456,7 @@ static void clear_closid(int cpu)
 
 	per_cpu(cpu_closid, cpu) = 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)
diff --git a/arch/x86/include/asm/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h
similarity index 85%
rename from arch/x86/include/asm/intel_rdt.h
rename to arch/x86/kernel/cpu/intel_rdt.h
index ae1efc3..0e4852d 100644
--- a/arch/x86/include/asm/intel_rdt.h
+++ b/arch/x86/kernel/cpu/intel_rdt.h
@@ -1,14 +1,10 @@
 #ifndef _ASM_X86_INTEL_RDT_H
 #define _ASM_X86_INTEL_RDT_H
 
-#ifdef CONFIG_INTEL_RDT
-
 #include <linux/sched.h>
 #include <linux/kernfs.h>
 #include <linux/jump_label.h>
 
-#include <asm/intel_rdt_common.h>
-
 #define IA32_L3_QOS_CFG		0xc81
 #define IA32_L3_CBM_BASE	0xc90
 #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,
 			   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 */
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index 9257bd9..fab8811 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -32,8 +32,8 @@
 
 #include <uapi/linux/magic.h>
 
-#include <asm/intel_rdt.h>
-#include <asm/intel_rdt_common.h>
+#include <asm/intel_rdt_sched.h>
+#include "intel_rdt.h"
 
 DEFINE_STATIC_KEY_FALSE(rdt_enable_key);
 struct kernfs_root *rdt_root;
diff --git a/arch/x86/kernel/cpu/intel_rdt_schemata.c b/arch/x86/kernel/cpu/intel_rdt_schemata.c
index 406d7a6..8cef1c8 100644
--- a/arch/x86/kernel/cpu/intel_rdt_schemata.c
+++ b/arch/x86/kernel/cpu/intel_rdt_schemata.c
@@ -26,7 +26,7 @@
 #include <linux/kernfs.h>
 #include <linux/seq_file.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
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index c6d6dc5..2280216 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -56,7 +56,7 @@
 #include <asm/debugreg.h>
 #include <asm/switch_to.h>
 #include <asm/vm86.h>
-#include <asm/intel_rdt.h>
+#include <asm/intel_rdt_sched.h>
 #include <asm/proto.h>
 
 void __show_regs(struct pt_regs *regs, int all)
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index c3169be..77a35c8 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -52,7 +52,7 @@
 #include <asm/switch_to.h>
 #include <asm/xen/hypervisor.h>
 #include <asm/vdso.h>
-#include <asm/intel_rdt.h>
+#include <asm/intel_rdt_sched.h>
 #include <asm/unistd.h>
 #ifdef CONFIG_IA32_EMULATION
 /* Not included via unistd.h */

  reply	other threads:[~2017-08-01 20:48 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25 21:14 [PATCH 00/28 V2] Cqm3 patch series(along with MBM support) Vikas Shivappa
2017-07-25 21:14 ` [PATCH 01/28] x86/perf/cqm: Wipe out perf based cqm Vikas Shivappa
2017-08-01 20:46   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 02/28] x86/intel_rdt/cqm: Documentation for resctrl based RDT Monitoring Vikas Shivappa
2017-08-01 20:46   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 03/28] x86/intel_rdt: Introduce a common compile option for RDT Vikas Shivappa
2017-08-01 20:47   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 04/28] x86/intel_rdt: Change file names to accommodate RDT monitor code Vikas Shivappa
2017-08-01 20:47   ` tip-bot for Vikas Shivappa [this message]
2017-07-25 21:14 ` [PATCH 05/28] x86/intel_rdt: Mark rdt_root and closid_alloc as static Vikas Shivappa
2017-08-01 20:48   ` [tip:x86/cache] " tip-bot for Reinette Chatre
2017-07-25 21:14 ` [PATCH 06/28] x86/intel_rdt: Cleanup namespace to support RDT monitoring Vikas Shivappa
2017-08-01 20:48   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 07/28] x86/intel_rdt: make rdt_resources_all more readable Vikas Shivappa
2017-08-01 20:48   ` [tip:x86/cache] x86/intel_rdt: Make " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 08/28] x86/intel_rdt/cqm: Add RDT monitoring initialization Vikas Shivappa
2017-08-01 20:49   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 09/28] x86/intel_rdt/cqm: Add RMID(Resource monitoring ID) management Vikas Shivappa
2017-08-01 20:14   ` Thomas Gleixner
2017-08-02  7:41     ` Shivappa Vikas
2017-08-01 20:49   ` [tip:x86/cache] x86/intel_rdt/cqm: Add RMID (Resource " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 10/28] x86/intel_rdt: Simplify info and base file lists Vikas Shivappa
2017-08-01 20:34   ` Thomas Gleixner
2017-08-01 20:50   ` [tip:x86/cache] " tip-bot for Tony luck
2017-07-25 21:14 ` [PATCH 11/28] x86/intel_rdt/cqm: Add info files for RDT monitoring Vikas Shivappa
2017-08-01 20:40   ` Thomas Gleixner
2017-08-01 20:50   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 12/28] x86/intel_rdt: Prepare for RDT monitoring mkdir support Vikas Shivappa
2017-08-01 20:50   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 13/28] x86/intel_rdt/cqm: Add mkdir support for RDT monitoring Vikas Shivappa
2017-08-01 20:51   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 14/28] x86/intel_rdt: Change closid type from int to u32 Vikas Shivappa
2017-08-01 20:51   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 15/28] x86/intel_rdt/cqm: Add tasks file support Vikas Shivappa
2017-08-01 20:52   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 16/28] x86/intel_rdt: Prepare to add RDT monitor cpus " Vikas Shivappa
2017-08-01 19:49   ` Thomas Gleixner
2017-08-01 21:35     ` Shivappa Vikas
2017-08-01 20:52   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 17/28] x86/intel_rdt/cqm: Add " Vikas Shivappa
2017-08-01 20:52   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 18/28] x86/intel_rdt: Prepare for RDT monitor data support Vikas Shivappa
2017-08-01 20:53   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 19/28] x86/intel_rdt/cqm: Add mon_data Vikas Shivappa
2017-08-01 20:53   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 20/28] x86/intel_rdt: Separate the ctrl bits from rmdir Vikas Shivappa
2017-08-01 20:54   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 21/28] x86/intel_rdt/cqm: Add rmdir support Vikas Shivappa
2017-08-01 20:54   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 22/28] x86/intel_rdt/cqm: Add mount,umount support Vikas Shivappa
2017-08-01 20:54   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 23/28] x86/intel_rdt: Introduce rdt_enable_key for scheduling Vikas Shivappa
2017-08-01 20:55   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 24/28] x86/intel_rdt/cqm: Add sched_in support Vikas Shivappa
2017-08-01 20:55   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 25/28] x86/intel_rdt/cqm: Add hotcpu support Vikas Shivappa
2017-08-01 20:55   ` [tip:x86/cache] x86/intel_rdt/cqm: Add CPU hotplug support tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 26/28] x86/intel_rdt/mbm: Basic counting of MBM events (total and local) Vikas Shivappa
2017-08-01 20:56   ` [tip:x86/cache] " tip-bot for Tony Luck
2017-07-25 21:14 ` [PATCH 27/28] x86/intel_rdt/mbm: Add mbm counter initialization Vikas Shivappa
2017-08-01 20:56   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 21:14 ` [PATCH 28/28] x86/intel_rdt/mbm: Handle counter overflow Vikas Shivappa
2017-08-01 20:57   ` [tip:x86/cache] " tip-bot for Vikas Shivappa
2017-07-25 22:39 ` [PATCH] x86/intel_rdt: Show bitmask of shareable resource with other executing units Luck, Tony
2017-08-01 20:57   ` [tip:x86/cache] " tip-bot for Fenghua Yu
2017-07-25 22:42 ` [RFC PATCH] Add "-f" and "-F" flags to watch a "/sys? style file (single number) Luck, Tony
2017-08-01 20:51 ` [PATCH 00/28 V2] Cqm3 patch series(along with MBM support) Thomas Gleixner
2017-08-01 21:39   ` Shivappa Vikas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-0583020456cea9fcf43b84bb13a41eab059ae0a8@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vikas.shivappa@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome