Skip to content

Commit

Permalink
x86/resctrl: Use rdt_last_cmd_puts() where possible
Browse files Browse the repository at this point in the history
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: 723f1a0 ("x86/resctrl: Fixup the user-visible strings")
Fixes: e0bdfe8 ("x86/intel_rdt: Support creation/removal of pseudo-locked region")
Fixes: 9ab9aa1 ("x86/intel_rdt: Ensure requested schemata respects mode")
Fixes: d48d7a5 ("x86/intel_rdt: Introduce resource group's mode resctrl file")
Fixes: dfe9674 ("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
  • Loading branch information
Reinette Chatre authored and Borislav Petkov committed Nov 27, 2018
1 parent 1f8251d commit 4568248
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions arch/x86/kernel/cpu/resctrl/ctrlmondata.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ int parse_cbm(struct rdt_parse_data *data, struct rdt_resource *r,
*/
if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP &&
rdtgroup_pseudo_locked_in_hierarchy(d)) {
rdt_last_cmd_printf("Pseudo-locked region in hierarchy\n");
rdt_last_cmd_puts("Pseudo-locked region in hierarchy\n");
return -EINVAL;
}

Expand All @@ -225,7 +225,7 @@ int parse_cbm(struct rdt_parse_data *data, struct rdt_resource *r,
if ((rdtgrp->mode == RDT_MODE_EXCLUSIVE ||
rdtgrp->mode == RDT_MODE_SHAREABLE) &&
rdtgroup_cbm_overlaps_pseudo_locked(d, cbm_val)) {
rdt_last_cmd_printf("CBM overlaps with pseudo-locked region\n");
rdt_last_cmd_puts("CBM overlaps with pseudo-locked region\n");
return -EINVAL;
}

Expand All @@ -234,14 +234,14 @@ int parse_cbm(struct rdt_parse_data *data, struct rdt_resource *r,
* either is exclusive.
*/
if (rdtgroup_cbm_overlaps(r, d, cbm_val, rdtgrp->closid, true)) {
rdt_last_cmd_printf("Overlaps with exclusive group\n");
rdt_last_cmd_puts("Overlaps with exclusive group\n");
return -EINVAL;
}

if (rdtgroup_cbm_overlaps(r, d, cbm_val, rdtgrp->closid, false)) {
if (rdtgrp->mode == RDT_MODE_EXCLUSIVE ||
rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
rdt_last_cmd_printf("0verlaps with other group\n");
rdt_last_cmd_puts("Overlaps with other group\n");
return -EINVAL;
}
}
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/kernel/cpu/resctrl/rdtgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of,
goto out;

if (mode == RDT_MODE_PSEUDO_LOCKED) {
rdt_last_cmd_printf("Cannot change pseudo-locked group\n");
rdt_last_cmd_puts("Cannot change pseudo-locked group\n");
ret = -EINVAL;
goto out;
}
Expand Down Expand Up @@ -1235,7 +1235,7 @@ static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of,
goto out;
rdtgrp->mode = RDT_MODE_PSEUDO_LOCKSETUP;
} else {
rdt_last_cmd_printf("Unknown orunsupported mode\n");
rdt_last_cmd_puts("Unknown or unsupported mode\n");
ret = -EINVAL;
}

Expand Down

0 comments on commit 4568248

Please sign in to comment.