aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinette Chatre <reinette.chatre@intel.com>2018-11-27 14:19:36 -0500
committerBorislav Petkov <bp@suse.de>2018-11-27 14:39:02 -0500
commit456824896de2b68df40b3ea5777ef49dc6cc8fda (patch)
treefcaf4924e0583bb4657b505b63415e9c0d4840d8
parent1f8251d3bfadf42357cf6c3eebb5cda6cd3987b5 (diff)
x86/resctrl: Use rdt_last_cmd_puts() where possible
The last_cmd_status sequence buffer contains user-visible messages (accessed via /sys/fs/resctrl/info/last_cmd_status) that detail any errors encountered while interacting with the resctrl filesystem. rdt_last_cmd_printf() and rdt_last_cmd_puts() are the two calls available to respectively print a string with format specifiers or a simple one (which contains no format specifiers) to the last_cmd_status buffer. A few occurrences exist where rdt_last_cmd_printf() is used to print a simple string. Doing so does not result in incorrect result or incorrect behavior, but rdt_last_cmd_puts() is the function intended to be used in these cases, as it is faster and it doesn't need to do the vsnprintf() formatting. Fix these occurrences to use rdt_last_cmd_puts() instead. While doing so, fix two typos that were recently introduced into two of these simple strings. [ bp: massage commit message and correct typos. ] Fixes: 723f1a0dd8e2 ("x86/resctrl: Fixup the user-visible strings") Fixes: e0bdfe8e36f3 ("x86/intel_rdt: Support creation/removal of pseudo-locked region") Fixes: 9ab9aa15c309 ("x86/intel_rdt: Ensure requested schemata respects mode") Fixes: d48d7a57f718 ("x86/intel_rdt: Introduce resource group's mode resctrl file") Fixes: dfe9674b04ff ("x86/intel_rdt: Enable entering of pseudo-locksetup mode") Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tony Luck <tony.luck@intel.com> Cc: babu.moger@amd.com Cc: jithu.joseph@intel.com Cc: x86-ml <x86@kernel.org> Link: https://lkml.kernel.org/r/f48e46a016d6a5c79f13de8faeca382052189e2e.1543346009.git.reinette.chatre@intel.com
-rw-r--r--arch/x86/kernel/cpu/resctrl/ctrlmondata.c8
-rw-r--r--arch/x86/kernel/cpu/resctrl/rdtgroup.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
index 43ee3cee6494..03ee13235a45 100644
--- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
+++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
@@ -215,7 +215,7 @@ int parse_cbm(struct rdt_parse_data *data, struct rdt_resource *r,
215 */ 215 */
216 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP && 216 if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP &&
217 rdtgroup_pseudo_locked_in_hierarchy(d)) { 217 rdtgroup_pseudo_locked_in_hierarchy(d)) {
218 rdt_last_cmd_printf("Pseudo-locked region in hierarchy\n"); 218 rdt_last_cmd_puts("Pseudo-locked region in hierarchy\n");
219 return -EINVAL; 219 return -EINVAL;
220 } 220 }
221 221
@@ -225,7 +225,7 @@ int parse_cbm(struct rdt_parse_data *data, struct rdt_resource *r,
225 if ((rdtgrp->mode == RDT_MODE_EXCLUSIVE || 225 if ((rdtgrp->mode == RDT_MODE_EXCLUSIVE ||
226 rdtgrp->mode == RDT_MODE_SHAREABLE) && 226 rdtgrp->mode == RDT_MODE_SHAREABLE) &&
227 rdtgroup_cbm_overlaps_pseudo_locked(d, cbm_val)) { 227 rdtgroup_cbm_overlaps_pseudo_locked(d, cbm_val)) {
228 rdt_last_cmd_printf("CBM overlaps with pseudo-locked region\n"); 228 rdt_last_cmd_puts("CBM overlaps with pseudo-locked region\n");
229 return -EINVAL; 229 return -EINVAL;
230 } 230 }
231 231
@@ -234,14 +234,14 @@ int parse_cbm(struct rdt_parse_data *data, struct rdt_resource *r,
234 * either is exclusive. 234 * either is exclusive.
235 */ 235 */
236 if (rdtgroup_cbm_overlaps(r, d, cbm_val, rdtgrp->closid, true)) { 236 if (rdtgroup_cbm_overlaps(r, d, cbm_val, rdtgrp->closid, true)) {
237 rdt_last_cmd_printf("Overlaps with exclusive group\n"); 237 rdt_last_cmd_puts("Overlaps with exclusive group\n");
238 return -EINVAL; 238 return -EINVAL;
239 } 239 }
240 240
241 if (rdtgroup_cbm_overlaps(r, d, cbm_val, rdtgrp->closid, false)) { 241 if (rdtgroup_cbm_overlaps(r, d, cbm_val, rdtgrp->closid, false)) {
242 if (rdtgrp->mode == RDT_MODE_EXCLUSIVE || 242 if (rdtgrp->mode == RDT_MODE_EXCLUSIVE ||
243 rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { 243 rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
244 rdt_last_cmd_printf("0verlaps with other group\n"); 244 rdt_last_cmd_puts("Overlaps with other group\n");
245 return -EINVAL; 245 return -EINVAL;
246 } 246 }
247 } 247 }
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 61b102dd51a5..017505017bdb 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -1206,7 +1206,7 @@ static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of,
1206 goto out; 1206 goto out;
1207 1207
1208 if (mode == RDT_MODE_PSEUDO_LOCKED) { 1208 if (mode == RDT_MODE_PSEUDO_LOCKED) {
1209 rdt_last_cmd_printf("Cannot change pseudo-locked group\n"); 1209 rdt_last_cmd_puts("Cannot change pseudo-locked group\n");
1210 ret = -EINVAL; 1210 ret = -EINVAL;
1211 goto out; 1211 goto out;
1212 } 1212 }
@@ -1235,7 +1235,7 @@ static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of,
1235 goto out; 1235 goto out;
1236 rdtgrp->mode = RDT_MODE_PSEUDO_LOCKSETUP; 1236 rdtgrp->mode = RDT_MODE_PSEUDO_LOCKSETUP;
1237 } else { 1237 } else {
1238 rdt_last_cmd_printf("Unknown orunsupported mode\n"); 1238 rdt_last_cmd_puts("Unknown or unsupported mode\n");
1239 ret = -EINVAL; 1239 ret = -EINVAL;
1240 } 1240 }
1241 1241