[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1487360328-6768-4-git-send-email-vikas.shivappa@linux.intel.com>
Date: Fri, 17 Feb 2017 11:38:46 -0800
From: Vikas Shivappa <vikas.shivappa@...ux.intel.com>
To: vikas.shivappa@...el.com
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, hpa@...or.com,
tglx@...utronix.de, mingo@...nel.org, peterz@...radead.org,
ravi.v.shankar@...el.com, tony.luck@...el.com,
fenghua.yu@...el.com, andi.kleen@...el.com,
vikas.shivappa@...ux.intel.com
Subject: [PATCH 3/5] x86/intel_rdt: Fail early on a resource with incorrect domains
When a schemata file is changed, user enters control values for all
domains and all resources in the below format (Consider L3 and L2
resources):
L3:<cache_id0>=<cbm>;<cache_id1>=<cbm>;...
L2:<cache_id0>=<cbm>;<cache_id1>=<cbm>;...
Return error as soon as we detect a resource not entering all domain
values in schemata rather than waiting till we parse all resources
because the entire change is atomic. Also this avoids looping all
enabled resources again.
Signed-off-by: Vikas Shivappa <vikas.shivappa@...ux.intel.com>
---
arch/x86/kernel/cpu/intel_rdt_schemata.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel_rdt_schemata.c b/arch/x86/kernel/cpu/intel_rdt_schemata.c
index 64b43b1..527d042 100644
--- a/arch/x86/kernel/cpu/intel_rdt_schemata.c
+++ b/arch/x86/kernel/cpu/intel_rdt_schemata.c
@@ -94,6 +94,10 @@ static int parse_line(char *line, struct rdt_resource *r)
return -EINVAL;
}
+ /* Incorrect number of domains in the line */
+ if (r->num_tmp_cbms != r->num_domains)
+ return -EINVAL;
+
/* Any garbage at the end of the line? */
if (line && line[0])
return -EINVAL;
@@ -212,14 +216,6 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
}
}
- /* Did the parser find all the masks we need? */
- for_each_enabled_rdt_resource(r) {
- if (r->num_tmp_cbms != r->num_domains) {
- ret = -EINVAL;
- goto out;
- }
- }
-
for_each_enabled_rdt_resource(r) {
ret = update_domains(r, closid);
if (ret)
--
1.9.1
Powered by blists - more mailing lists