All of lore.kernel.org
 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, tglx@linutronix.de,
	vikas.shivappa@linux.intel.com, hpa@zytor.com,
	linux-kernel@vger.kernel.org
Subject: [tip:x86/cpu] x86/intel_rdt: Make information files resource specific
Date: Fri, 14 Apr 2017 07:20:18 -0700	[thread overview]
Message-ID: <tip-6a507a6ad8a6955a7d57255377edcef576823749@git.kernel.org> (raw)
In-Reply-To: <1491611637-20417-6-git-send-email-vikas.shivappa@linux.intel.com>

Commit-ID:  6a507a6ad8a6955a7d57255377edcef576823749
Gitweb:     http://git.kernel.org/tip/6a507a6ad8a6955a7d57255377edcef576823749
Author:     Vikas Shivappa <vikas.shivappa@linux.intel.com>
AuthorDate: Fri, 7 Apr 2017 17:33:54 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 14 Apr 2017 16:10:08 +0200

x86/intel_rdt: Make information files resource specific

Cache allocation and memory bandwidth allocation require different
information files in the resctrl/info directory, but the current
implementation does not allow to have files per resource.

Add the necessary fields to the resource struct and assign the files
dynamically depending on the resource type.

Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
Cc: ravi.v.shankar@intel.com
Cc: tony.luck@intel.com
Cc: fenghua.yu@intel.com
Cc: vikas.shivappa@intel.com
Link: http://lkml.kernel.org/r/1491611637-20417-6-git-send-email-vikas.shivappa@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/include/asm/intel_rdt.h         |  6 ++++++
 arch/x86/kernel/cpu/intel_rdt.c          |  1 +
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 18 ++++++++++++++----
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/intel_rdt.h b/arch/x86/include/asm/intel_rdt.h
index 0620fc9..b0f0a60 100644
--- a/arch/x86/include/asm/intel_rdt.h
+++ b/arch/x86/include/asm/intel_rdt.h
@@ -150,6 +150,8 @@ struct rdt_membw {
  * @data_width:		Character width of data when displaying
  * @domains:		All domains for this resource
  * @cache:		Cache allocation related data
+ * @info_files:		resctrl info files for the resource
+ * @nr_info_files:	Number of info files
  */
 struct rdt_resource {
 	bool			enabled;
@@ -167,8 +169,12 @@ struct rdt_resource {
 		struct rdt_cache	cache;
 		struct rdt_membw	membw;
 	};
+	struct rftype		*info_files;
+	int			nr_info_files;
 };
 
+void rdt_get_cache_infofile(struct rdt_resource *r);
+
 extern struct mutex rdtgroup_mutex;
 
 extern struct rdt_resource rdt_resources_all[];
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index ae1aec1..b387e04 100644
--- a/arch/x86/kernel/cpu/intel_rdt.c
+++ b/arch/x86/kernel/cpu/intel_rdt.c
@@ -221,6 +221,7 @@ static void rdt_get_cache_config(int idx, struct rdt_resource *r)
 	r->cache.cbm_len = eax.split.cbm_len + 1;
 	r->default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1;
 	r->data_width = (r->cache.cbm_len + 3) / 4;
+	rdt_get_cache_infofile(r);
 	r->capable = true;
 	r->enabled = true;
 }
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index 3ec230b..65d957b 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -540,7 +540,7 @@ static int rdt_min_cbm_bits_show(struct kernfs_open_file *of,
 }
 
 /* rdtgroup information files for one cache resource. */
-static struct rftype res_info_files[] = {
+static struct rftype res_cache_info_files[] = {
 	{
 		.name		= "num_closids",
 		.mode		= 0444,
@@ -561,11 +561,18 @@ static struct rftype res_info_files[] = {
 	},
 };
 
+void rdt_get_cache_infofile(struct rdt_resource *r)
+{
+	r->info_files = res_cache_info_files;
+	r->nr_info_files = ARRAY_SIZE(res_cache_info_files);
+}
+
 static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
 {
 	struct kernfs_node *kn_subdir;
+	struct rftype *res_info_files;
 	struct rdt_resource *r;
-	int ret;
+	int ret, len;
 
 	/* create the directory */
 	kn_info = kernfs_create_dir(parent_kn, "info", parent_kn->mode, NULL);
@@ -584,8 +591,11 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
 		ret = rdtgroup_kn_set_ugid(kn_subdir);
 		if (ret)
 			goto out_destroy;
-		ret = rdtgroup_add_files(kn_subdir, res_info_files,
-					 ARRAY_SIZE(res_info_files));
+
+		res_info_files = r->info_files;
+		len = r->nr_info_files;
+
+		ret = rdtgroup_add_files(kn_subdir, res_info_files, len);
 		if (ret)
 			goto out_destroy;
 		kernfs_activate(kn_subdir);

  reply	other threads:[~2017-04-14 14:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08  0:33 [PATCH 0/8 V4] x86/intel_rdt: Intel Memory bandwidth allocation Vikas Shivappa
2017-04-08  0:33 ` [PATCH 1/8] Documentation, x86: " Vikas Shivappa
2017-04-14 14:17   ` [tip:x86/cpu] " tip-bot for Vikas Shivappa
2017-04-08  0:33 ` [PATCH 2/8] x86/intel_rdt/mba: Generalize the naming to get ready for MBA Vikas Shivappa
2017-04-14 14:17   ` [tip:x86/cpu] x86/intel_rdt: Cleanup namespace to support multiple resource types tip-bot for Vikas Shivappa
2017-04-08  0:33 ` [PATCH 3/8] x86/intel_rdt/mba: Memory b/w allocation feature detect Vikas Shivappa
2017-04-14 14:19   ` [tip:x86/cpu] x86/intel_rdt/mba: Memory bandwith " tip-bot for Vikas Shivappa
2017-04-08  0:33 ` [PATCH 4/8] x86/intel_rct/mba: Add MBA structures and initialize MBA Vikas Shivappa
2017-04-14 14:19   ` [tip:x86/cpu] x86/intel_rdt/mba: Add primary support for Memory Bandwidth Allocation (MBA) tip-bot for Vikas Shivappa
2017-04-08  0:33 ` [PATCH 5/8] x86/intel_rdt: Prep to add info files for MBA Vikas Shivappa
2017-04-14 14:20   ` tip-bot for Vikas Shivappa [this message]
2017-04-08  0:33 ` [PATCH 6/8] x86/intel_rdt/mba: Add info directory " Vikas Shivappa
2017-04-14 14:20   ` [tip:x86/cpu] x86/intel_rdt/mba: Add info directory files for Memory Bandwidth Allocation tip-bot for Vikas Shivappa
2017-04-08  0:33 ` [PATCH 7/8] x86/intel_rdt: Prep to add schemata file for MBA Vikas Shivappa
2017-04-14 14:21   ` [tip:x86/cpu] x86/intel_rdt: Make schemata file parsers resource specific tip-bot for Vikas Shivappa
2017-04-08  0:33 ` [PATCH 8/8] x86/intel_rdt/mba: Add schemata file support for MBA Vikas Shivappa
2017-04-14 14:21   ` [tip:x86/cpu] " tip-bot for Vikas Shivappa
2017-04-12 22:59 ` [PATCH 0/8 V4] x86/intel_rdt: Intel Memory bandwidth allocation Shivappa Vikas
2017-04-12 23:33   ` Thomas Gleixner
2017-04-14 14:29     ` Thomas Gleixner
2017-04-14 17:52       ` Shivappa Vikas
2017-04-15  0:20         ` 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-6a507a6ad8a6955a7d57255377edcef576823749@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.