[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1692880423.git.maciej.wieczor-retman@intel.com>
Date: Thu, 24 Aug 2023 14:41:23 +0200
From: "Wieczor-Retman, Maciej" <maciej.wieczor-retman@...el.com>
To: linux-kernel@...r.kernel.org, reinette.chatre@...el.com,
fenghua.yu@...el.com
Cc: ilpo.jarvinen@...ux.intel.com
Subject: [PATCH 0/3] selftests/resctrl: Bug fix and optimizations
Write_schemata() uses fprintf() to write a bitmask into a schemata file
inside resctrl FS. It checks fprintf() return value but it doesn't check
fclose() return value. Error codes from fprintf() such as write errors,
are flushed back to the user only after fclose() is executed which means
any invalid bitmask can be written into the schemata file.
Save fclose() return value so it can be returned at the end of the
function.
Add a perror() call after fprintf() so if any error occurs the error
message is more verbose
Kselftest.h declares many variadic functions that can print some
formatted message while also executing selftest logic. These
declarations don't have any compiler mechanism to verify if passed
arguments are valid in comparison with format specifiers used in
printf() calls.
Add a __printf() macro similiar to other tools in the kernel.
Add __printf() attributes to function definitions inside kselftest.h that
use printing
The resctrlfs.c file defines functions that interact with the resctrl FS
while resctrl_val.c file defines functions that perform measurements on
the cache. Run_benchmark() fits logically into the second file before
resctrl_val() function that uses it.
Move run_benchmark() from resctrlfs.c to resctrl_val.c just before
resctrl_val() function definition.
Series is based on kselftest next branch
Wieczor-Retman, Maciej (3):
selftests/resctrl: Fix schemata write error check
selftests/resctrl: Move run_benchmark() to a more fitting file
selftests: Add printf attribute to ksefltest prints
tools/testing/selftests/kselftest.h | 18 +++---
tools/testing/selftests/resctrl/resctrl_val.c | 52 ++++++++++++++++
tools/testing/selftests/resctrl/resctrlfs.c | 60 ++-----------------
3 files changed, 68 insertions(+), 62 deletions(-)
base-commit: 13eb52f6293dbda02890698d92f3d9913d8d5aeb
--
2.42.0
Powered by blists - more mailing lists