From: Vikas Shivappa <vikas.shivappa@linux.intel.com>
To: vikas.shivappa@intel.com
Cc: linux-kernel@vger.kernel.org, x86@kernel.org, hpa@zytor.com,
tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org,
ravi.v.shankar@intel.com, tony.luck@intel.com,
fenghua.yu@intel.com, andi.kleen@intel.com,
vikas.shivappa@linux.intel.com
Subject: [PATCH 2/5] x86/intel_rdt: Improvements to parsing schemata
Date: Fri, 17 Feb 2017 11:38:45 -0800 [thread overview]
Message-ID: <1487360328-6768-3-git-send-email-vikas.shivappa@linux.intel.com> (raw)
In-Reply-To: <1487360328-6768-1-git-send-email-vikas.shivappa@linux.intel.com>
The schemata file requires all RDT (Resource director technology)
resources be entered in the same order they are shown in the root
schemata file.
Hence remove the looping through all resources while parsing each
schemata and get the next enabled resource after processing a resource.
Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
---
arch/x86/kernel/cpu/intel_rdt_schemata.c | 40 ++++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 10 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel_rdt_schemata.c b/arch/x86/kernel/cpu/intel_rdt_schemata.c
index 14ba504..64b43b1 100644
--- a/arch/x86/kernel/cpu/intel_rdt_schemata.c
+++ b/arch/x86/kernel/cpu/intel_rdt_schemata.c
@@ -138,6 +138,27 @@ static int update_domains(struct rdt_resource *r, int closid)
return 0;
}
+/*
+ * Parameter r must be NULL or pointing to
+ * a valid rdt_resource_all entry.
+ * returns next enabled RDT resource.
+ */
+static inline struct rdt_resource*
+get_next_enabled_rdt_resource(struct rdt_resource *r)
+{
+ struct rdt_resource *it = r;
+
+ if (!it)
+ it = rdt_resources_all;
+ else
+ it++;
+ for (; it < rdt_resources_all + RDT_NUM_RESOURCES; it++)
+ if (it->enabled)
+ return it;
+
+ return NULL;
+}
+
ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
char *buf, size_t nbytes, loff_t off)
{
@@ -171,22 +192,21 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
r->num_tmp_cbms = 0;
}
+ r = NULL;
while ((tok = strsep(&buf, "\n")) != NULL) {
resname = strsep(&tok, ":");
if (!tok) {
ret = -EINVAL;
goto out;
}
- for_each_enabled_rdt_resource(r) {
- if (!strcmp(resname, r->name) &&
- closid < r->num_closid) {
- ret = parse_line(tok, r);
- if (ret)
- goto out;
- break;
- }
- }
- if (!r->name) {
+
+ r = get_next_enabled_rdt_resource(r);
+
+ if (r && !strcmp(resname, r->name)) {
+ ret = parse_line(tok, r);
+ if (ret)
+ goto out;
+ } else {
ret = -EINVAL;
goto out;
}
--
1.9.1
next prev parent reply other threads:[~2017-02-17 19:44 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 19:38 [PATCH 0/5] x86/intel_rdt: Improvements/Fixes to RDT framework Vikas Shivappa
2017-02-17 19:38 ` [PATCH 1/5] x86/intel_rdt: Update control registers only when user really modifies it Vikas Shivappa
2017-03-01 13:31 ` Thomas Gleixner
2017-03-10 0:00 ` Shivappa Vikas
2017-02-17 19:38 ` Vikas Shivappa [this message]
2017-03-01 14:03 ` [PATCH 2/5] x86/intel_rdt: Improvements to parsing schemata Thomas Gleixner
2017-03-10 0:03 ` Shivappa Vikas
2017-03-10 10:53 ` Thomas Gleixner
2017-03-10 18:25 ` Shivappa Vikas
2017-03-10 18:58 ` Thomas Gleixner
2017-03-10 22:05 ` Luck, Tony
2017-03-11 7:47 ` Thomas Gleixner
2017-03-24 17:51 ` [PATCH] x86/intel_rdt: Implement "update" mode when writing schemata file Luck, Tony
2017-03-24 23:18 ` Fenghua Yu
2017-03-30 18:33 ` Shivappa Vikas
2017-03-31 8:24 ` Thomas Gleixner
2017-03-31 17:40 ` Shivappa Vikas
2017-03-31 17:49 ` Thomas Gleixner
2017-03-31 18:45 ` Shivappa Vikas
2017-02-17 19:38 ` [PATCH 3/5] x86/intel_rdt: Fail early on a resource with incorrect domains Vikas Shivappa
2017-03-01 14:05 ` Thomas Gleixner
2017-02-17 19:38 ` [PATCH 4/5] x86/intel_rdt: Reset the cbm MSR during rmdir Vikas Shivappa
2017-03-01 14:11 ` Thomas Gleixner
2017-03-10 1:45 ` Shivappa Vikas
2017-02-17 19:38 ` [PATCH 5/5] x86/intel_rdt: hotcpu updates for RDT Vikas Shivappa
2017-03-01 14:24 ` Thomas Gleixner
2017-03-30 19:03 ` 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=1487360328-6768-3-git-send-email-vikas.shivappa@linux.intel.com \
--to=vikas.shivappa@linux.intel.com \
--cc=andi.kleen@intel.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.v.shankar@intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=vikas.shivappa@intel.com \
--cc=x86@kernel.org \
/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