|
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7, v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3, v6.13-rc2, v6.13-rc1, v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5 |
|
| #
f77b9672 |
| 24-Oct-2024 |
Reinette Chatre <[email protected]> |
selftests/resctrl: Use cache size to determine "fill_buf" buffer size
By default the MBM and MBA tests use the "fill_buf" benchmark to read from a buffer with the goal to measure the memory bandwidt
selftests/resctrl: Use cache size to determine "fill_buf" buffer size
By default the MBM and MBA tests use the "fill_buf" benchmark to read from a buffer with the goal to measure the memory bandwidth generated by this buffer access.
Care should be taken when sizing the buffer used by the "fill_buf" benchmark. If the buffer is small enough to fit in the cache then it cannot be expected that the benchmark will generate much memory bandwidth. For example, on a system with 320MB L3 cache the existing hardcoded default of 250MB is insufficient.
Use the measured cache size to determine a buffer size that can be expected to trigger memory access while keeping the existing default as minimum, now renamed to MINIMUM_SPAN, that has been appropriate for testing so far.
Signed-off-by: Reinette Chatre <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
3cb3f0b8 |
| 24-Oct-2024 |
Reinette Chatre <[email protected]> |
selftests/resctrl: Ensure measurements skip initialization of default benchmark
The CMT, MBA, and MBM tests rely on the resctrl_val() wrapper to start and run a benchmark while providing test specif
selftests/resctrl: Ensure measurements skip initialization of default benchmark
The CMT, MBA, and MBM tests rely on the resctrl_val() wrapper to start and run a benchmark while providing test specific flows via callbacks to do test specific configuration and measurements.
At a high level, the resctrl_val() flow is: a) Start by fork()ing a child process that installs a signal handler for SIGUSR1 that, on receipt of SIGUSR1, will start running a benchmark. b) Assign the child process created in (a) to the resctrl control and monitoring group that dictates the memory and cache allocations with which the process can run and will contain all resctrl monitoring data of that process. c) Once parent and child are considered "ready" (determined via a message over a pipe) the parent signals the child (via SIGUSR1) to start the benchmark, waits one second for the benchmark to run, and then starts collecting monitoring data for the tests, potentially also changing allocation configuration depending on the various test callbacks.
A problem with the above flow is the "black box" view of the benchmark that is combined with an arbitrarily chosen "wait one second" before measurements start. No matter what the benchmark does, it is given one second to initialize before measurements start.
The default benchmark "fill_buf" consists of two parts, first it prepares a buffer (allocate, initialize, then flush), then it reads from the buffer (in unpredictable ways) until terminated. Depending on the system and the size of the buffer, the first "prepare" part may not be complete by the time the one second delay expires. Test measurements may thus start before the work needing to be measured runs.
Split the default benchmark into its "prepare" and "runtime" parts and simplify the resctrl_val() wrapper while doing so. This same split cannot be done for the user provided benchmark (without a user interface change), so the current behavior is maintained for user provided benchmark.
Assign the test itself to the control and monitoring group and run the "prepare" part of the benchmark in this context, ensuring it runs with required cache and memory bandwidth allocations. With the benchmark preparation complete it is only needed to fork() the "runtime" part of the benchmark (or entire user provided benchmark).
Keep the "wait one second" delay before measurements start. For the default "fill_buf" benchmark this time now covers only the "runtime" portion that needs to be measured. For the user provided benchmark this delay maintains current behavior.
Signed-off-by: Reinette Chatre <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
e958c21e |
| 24-Oct-2024 |
Reinette Chatre <[email protected]> |
selftests/resctrl: Make benchmark parameter passing robust
The benchmark used during the CMT, MBM, and MBA tests can be provided by the user via (-b) parameter, if not provided the default "fill_buf
selftests/resctrl: Make benchmark parameter passing robust
The benchmark used during the CMT, MBM, and MBA tests can be provided by the user via (-b) parameter, if not provided the default "fill_buf" benchmark is used. The user is additionally able to override any of the "fill_buf" default parameters when running the tests with "-b fill_buf <fill_buf parameters>".
The "fill_buf" parameters are managed as an array of strings. Using an array of strings is complex because it requires transformations to/from strings at every producer and consumer. This is made worse for the individual tests where the default benchmark parameters values may not be appropriate and additional data wrangling is required. For example, the CMT test duplicates the entire array of strings in order to replace one of the parameters.
More issues appear when combining the usage of an array of strings with the use case of user overriding default parameters by specifying "-b fill_buf <parameters>". This use case is fragile with opportunities to trigger a SIGSEGV because of opportunities for NULL pointers to exist in the array of strings. For example, by running below (thus by specifying "fill_buf" should be used but all parameters are NULL): $ sudo resctrl_tests -t mbm -b fill_buf
Replace the "array of strings" parameters used for "fill_buf" with new struct fill_buf_param that contains the "fill_buf" parameters that can be used directly without transformations to/from strings. Two instances of struct fill_buf_param may exist at any point in time: * If the user provides new parameters to "fill_buf", the user parameter structure (struct user_params) will point to a fully initialized and immutable struct fill_buf_param containing the user provided parameters. * If "fill_buf" is the benchmark that should be used by a test, then the test parameter structure (struct resctrl_val_param) will point to a fully initialized struct fill_buf_param. The latter may contain (a) the user provided parameters verbatim, (b) user provided parameters adjusted to be appropriate for the test, or (c) the default parameters for "fill_buf" that is appropriate for the test if the user did not provide "fill_buf" parameters nor an alternate benchmark.
The existing behavior of CMT test is to use test defined value for the buffer size even if the user provides another value via command line. This behavior is maintained since the test requires that the buffer size matches the size of the cache allocated, and the amount of cache allocated can instead be changed by the user with the "-n" command line parameter.
Signed-off-by: Reinette Chatre <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
13842417 |
| 24-Oct-2024 |
Reinette Chatre <[email protected]> |
selftests/resctrl: Only support measured read operation
The CMT, MBM, and MBA tests rely on a benchmark to generate memory traffic. By default this is the "fill_buf" benchmark that can be replaced v
selftests/resctrl: Only support measured read operation
The CMT, MBM, and MBA tests rely on a benchmark to generate memory traffic. By default this is the "fill_buf" benchmark that can be replaced via the "-b" command line argument.
The original intent of the "-b" command line parameter was to replace the default "fill_buf" benchmark, but the implementation also exposes an alternative use case where the "fill_buf" parameters itself can be modified. One of the parameters to "fill_buf" is the "operation" that can be either "read" or "write" and indicates whether the "fill_buf" should use "read" or "write" operations on the allocated buffer.
While replacing "fill_buf" default parameters is technically possible, replacing the default "read" parameter with "write" is not supported because the MBA and MBM tests only measure "read" operations. The "read" operation is also most appropriate for the CMT test that aims to use the benchmark to allocate into the cache.
Avoid any potential inconsistencies between test and measurement by removing code for unsupported "write" operations to the buffer. Ignore any attempt from user space to enable this unsupported test configuration, instead always use read operations.
Keep the initialization of the, now unused, "fill_buf" parameters to reserve these parameter positions since it has been exposed as an API. Future parameter additions cannot use these parameter positions.
Signed-off-by: Reinette Chatre <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
f3069136 |
| 24-Oct-2024 |
Reinette Chatre <[email protected]> |
selftests/resctrl: Remove "once" parameter required to be false
The CMT, MBM, and MBA tests rely on a benchmark that runs while the test makes changes to needed configuration (for example memory ban
selftests/resctrl: Remove "once" parameter required to be false
The CMT, MBM, and MBA tests rely on a benchmark that runs while the test makes changes to needed configuration (for example memory bandwidth allocation) and takes needed measurements. By default the "fill_buf" benchmark is used and by default (via its "once = false" setting) "fill_buf" is configured to run until terminated after the test completes.
An unintended consequence of enabling the user to override the benchmark also enables the user to change parameters to the "fill_buf" benchmark. This enables the user to set "fill_buf" to only cycle through the buffer once (by setting "once = true") and thus breaking the CMT, MBA, and MBM tests that expect workload/interference to be reflected by their measurements.
Prevent user space from changing the "once" parameter and ensure that it is always false for the CMT, MBA, and MBM tests.
Suggested-by: Ilpo Järvinen <[email protected]> Signed-off-by: Reinette Chatre <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
caf02626 |
| 24-Oct-2024 |
Reinette Chatre <[email protected]> |
selftests/resctrl: Fix memory overflow due to unhandled wraparound
alloc_buffer() allocates and initializes (with random data) a buffer of requested size. The initialization starts from the beginnin
selftests/resctrl: Fix memory overflow due to unhandled wraparound
alloc_buffer() allocates and initializes (with random data) a buffer of requested size. The initialization starts from the beginning of the allocated buffer and incrementally assigns sizeof(uint64_t) random data to each cache line. The initialization uses the size of the buffer to control the initialization flow, decrementing the amount of buffer needing to be initialized after each iteration.
The size of the buffer is stored in an unsigned (size_t) variable s64 and the test "s64 > 0" is used to decide if initialization is complete. The problem is that decrementing the buffer size may wrap around if the buffer size is not divisible by "CL_SIZE / sizeof(uint64_t)" resulting in the "s64 > 0" test being true and memory beyond the buffer "initialized".
Use a signed value for the buffer size to support all buffer sizes.
Fixes: a2561b12fe39 ("selftests/resctrl: Add built in benchmark") Signed-off-by: Reinette Chatre <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
|
Revision tags: v6.12-rc4, v6.12-rc3, v6.12-rc2, v6.12-rc1, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5, v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10, v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4, v6.10-rc3, v6.10-rc2, v6.10-rc1, v6.9, v6.9-rc7, v6.9-rc6, v6.9-rc5, v6.9-rc4, v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8, v6.8-rc7, v6.8-rc6, v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2, v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6 |
|
| #
205de6dd |
| 15-Dec-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Rewrite Cache Allocation Technology (CAT) test
CAT test spawns two processes into two different control groups with exclusive schemata. Both the processes alloc a buffer from memo
selftests/resctrl: Rewrite Cache Allocation Technology (CAT) test
CAT test spawns two processes into two different control groups with exclusive schemata. Both the processes alloc a buffer from memory matching their allocated LLC block size and flush the entire buffer out of caches. Since the processes are reading through the buffer only once during the measurement and initially all the buffer was flushed, the test isn't testing CAT.
Rewrite the CAT test to allocate a buffer sized to half of LLC. Then perform a sequence of tests with different LLC alloc sizes starting from half of the CBM bits down to 1-bit CBM. Flush the buffer before each test and read the buffer twice. Observe the LLC misses on the second read through the buffer. As the allocated LLC block gets smaller and smaller, the LLC misses will become larger and larger giving a strong signal on CAT working properly.
The new CAT test is using only a single process because it relies on measured effect against another run of itself rather than another process adding noise. The rest of the system is set to use the CBM bits not used by the CAT test to keep the test isolated.
Replace count_bits() with count_contiguous_bits() to get the first bit position in order to be able to calculate masks based on it.
This change has been tested with a number of systems from different generations.
Suggested-by: Reinette Chatre <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
bcdb2e9d |
| 15-Dec-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Read in less obvious order to defeat prefetch optimizations
When reading memory in order, HW prefetching optimizations will interfere with measuring how caches and memory are bein
selftests/resctrl: Read in less obvious order to defeat prefetch optimizations
When reading memory in order, HW prefetching optimizations will interfere with measuring how caches and memory are being accessed. This adds noise into the results.
Change the fill_buf reading loop to not use an obvious in-order access using multiply by a prime and modulo.
Using a prime multiplier with modulo ensures the entire buffer is eventually read. 23 is small enough that the reads are spread out but wrapping does not occur very frequently (wrapping too often can trigger L2 hits more frequently which causes noise to the test because getting the data from LLC is not required).
It was discovered that not all primes work equally well and some can cause wildly unstable results (e.g., in an earlier version of this patch, the reads were done in reversed order and 59 was used as the prime resulting in unacceptably high and unstable results in MBA and MBM test on some architectures).
Link: https://lore.kernel.org/linux-kselftest/TYAPR01MB6330025B5E6537F94DA49ACB8B499@TYAPR01MB6330.jpnprd01.prod.outlook.com/ Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
90a009db |
| 15-Dec-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Replace file write with volatile variable
The fill_buf code prevents compiler optimizating the entire read loop away by writing the final value of the variable into a file. While
selftests/resctrl: Replace file write with volatile variable
The fill_buf code prevents compiler optimizating the entire read loop away by writing the final value of the variable into a file. While it achieves the goal, writing into a file requires significant amount of work within the innermost test loop and also error handling.
A simpler approach is to take advantage of volatile. Writing through a pointer to a volatile variable is enough to prevent compiler from optimizing the write away, and therefore compiler cannot remove the read loop either.
Add a volatile 'value_sink' into resctrl_tests.c and make fill_buf to write into it. As a result, the error handling in fill_buf.c can be simplified.
Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
24be0559 |
| 15-Dec-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Refactor fill_buf functions
There are unnecessary nested calls in fill_buf.c: - run_fill_buf() calls fill_cache() - alloc_buffer() calls malloc_and_init_memory()
Simplify the
selftests/resctrl: Refactor fill_buf functions
There are unnecessary nested calls in fill_buf.c: - run_fill_buf() calls fill_cache() - alloc_buffer() calls malloc_and_init_memory()
Simplify the code flow and remove those unnecessary call levels by moving the called code inside the calling function and remove the duplicated error print.
Resolve the difference in run_fill_buf() and fill_cache() parameter name into 'buf_size' which is more descriptive than 'span'. Also, while moving the allocation related code, rename 'p' into 'buf' to be consistent in naming the variables.
Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
f8f66969 |
| 15-Dec-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Split fill_buf to allow tests finer-grained control
MBM, MBA and CMT test cases call run_fill_buf() that in turn calls fill_cache() to alloc and loop indefinitely around the buffe
selftests/resctrl: Split fill_buf to allow tests finer-grained control
MBM, MBA and CMT test cases call run_fill_buf() that in turn calls fill_cache() to alloc and loop indefinitely around the buffer. This binds buffer allocation and running the benchmark into a single bundle so that a selftest cannot allocate a buffer once and reuse it. CAT test doesn't want to loop around the buffer continuously and after rewrite it needs the ability to allocate the buffer separately.
Split buffer allocation out of fill_cache() into alloc_buffer(). This change is part of preparation for the new CAT test that allocates a buffer and does multiple passes over the same buffer (but not in an infinite loop).
Co-developed-by: Fenghua Yu <[email protected]> Signed-off-by: Fenghua Yu <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
cc8ff7f5 |
| 15-Dec-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Convert perror() to ksft_perror() or ksft_print_msg()
The resctrl selftest code contains a number of perror() calls. Some of them come with hash character and some don't. The ksel
selftests/resctrl: Convert perror() to ksft_perror() or ksft_print_msg()
The resctrl selftest code contains a number of perror() calls. Some of them come with hash character and some don't. The kselftest framework provides ksft_perror() that is compatible with test output formatting so it should be used instead of adding custom hash signs.
Some perror() calls are too far away from anything that sets error. For those call sites, ksft_print_msg() must be used instead.
Convert perror() to ksft_perror() or ksft_print_msg().
Other related changes: - Remove hash signs - Remove trailing stops & newlines from ksft_perror() - Add terminating newlines for converted ksft_print_msg() - Use consistent capitalization - Small fixes/tweaks to typos & grammar of the messages - Extract error printing out of PARENT_EXIT() to be able to differentiate
Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
|
Revision tags: v6.7-rc5, v6.7-rc4, v6.7-rc3, v6.7-rc2, v6.7-rc1, v6.6, v6.6-rc7, v6.6-rc6, v6.6-rc5, v6.6-rc4, v6.6-rc3, v6.6-rc2, v6.6-rc1, v6.5, v6.5-rc7, v6.5-rc6, v6.5-rc5, v6.5-rc4, v6.5-rc3 |
|
| #
7f3c980c |
| 17-Jul-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Don't pass test name to fill_buf
Test name is passed to fill_buf functions so that they can loop around buffer only once. This is required for CAT test case.
To loop around buffe
selftests/resctrl: Don't pass test name to fill_buf
Test name is passed to fill_buf functions so that they can loop around buffer only once. This is required for CAT test case.
To loop around buffer only once, caller doesn't need to let fill_buf know which test case it is. Instead, pass a boolean argument 'once' which makes fill_buf more generic.
As run_benchmark() no longer needs to pass the test name to run_fill_buf(), a few test running functions can be simplified to not write the test name into the default benchmark_cmd. The has_ben argument can also be removed now from those test running functions.
Co-developed-by: Fenghua Yu <[email protected]> Signed-off-by: Fenghua Yu <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Tested-by: Babu Moger <[email protected]> Tested-by: Shaopeng Tan (Fujitsu) <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
f4123975 |
| 17-Jul-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Improve parameter consistency in fill_buf
fill_buf's arguments can be improved in multiple ways:
- Multiple functions in fill_buf have start_ptr as one of their argument wh
selftests/resctrl: Improve parameter consistency in fill_buf
fill_buf's arguments can be improved in multiple ways:
- Multiple functions in fill_buf have start_ptr as one of their argument which is a bit long and the extra "start" is pretty obvious when it comes to pointers.
- Some of the functions take end_ptr and others size_t to indicate the end of the buffer.
- Some arguments meaning buffer size are called just 's'
- mem_flush() takes void * but immediately converts it to char *
Cleanup the parameters to make things simpler and more consistent:
- Rename start_ptr to simply buf as it's shorter.
- Replace end_ptr and s parameters with buf_size and only calculate end_ptr in the functions that truly use it.
- Make mem_flush() parameters to follow the same convention as the other functions in fill_buf.
- convert mem_flush() char * to unsigned char *.
While at it, fix also a typo in a comment.
Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Tested-by: Babu Moger <[email protected]> Tested-by: Shaopeng Tan (Fujitsu) <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
5e3e4f1a |
| 17-Jul-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Remove unnecessary startptr global from fill_buf
fill_buf stores buffer pointer into global variable startptr that is only used in fill_cache().
Remove startptr as global variabl
selftests/resctrl: Remove unnecessary startptr global from fill_buf
fill_buf stores buffer pointer into global variable startptr that is only used in fill_cache().
Remove startptr as global variable, the local variable in fill_cache() is enough to keep the pointer.
Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Tested-by: Babu Moger <[email protected]> Tested-by: Shaopeng Tan (Fujitsu) <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
326baed2 |
| 17-Jul-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Remove "malloc_and_init_memory" param from run_fill_buf()
run_fill_buf()'s malloc_and_init_memory parameter is always 1. There's also duplicated memory init code for malloc_and_in
selftests/resctrl: Remove "malloc_and_init_memory" param from run_fill_buf()
run_fill_buf()'s malloc_and_init_memory parameter is always 1. There's also duplicated memory init code for malloc_and_init_memory == 0 case in fill_buf() which is unused.
Remove the malloc_and_init_memory parameter and the duplicated mem init code.
While at it, fix also a typo in run_fill_buf() prototype's argument.
Co-developed-by: Fenghua Yu <[email protected]> Signed-off-by: Fenghua Yu <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Tested-by: Babu Moger <[email protected]> Tested-by: Shaopeng Tan (Fujitsu) <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
67a86643 |
| 17-Jul-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Convert span to size_t
Span is defined either as unsigned long or int.
Consistently use size_t everywhere for span as it refers to size of the memory block.
Co-developed-by: Fen
selftests/resctrl: Convert span to size_t
Span is defined either as unsigned long or int.
Consistently use size_t everywhere for span as it refers to size of the memory block.
Co-developed-by: Fenghua Yu <[email protected]> Signed-off-by: Fenghua Yu <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]> Tested-by: Babu Moger <[email protected]> Tested-by: Shaopeng Tan (Fujitsu) <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
2d320b10 |
| 17-Jul-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Don't leak buffer in fill_cache()
The error path in fill_cache() does return before the allocated buffer is freed leaking the buffer.
The leak was introduced when fill_cache_read
selftests/resctrl: Don't leak buffer in fill_cache()
The error path in fill_cache() does return before the allocated buffer is freed leaking the buffer.
The leak was introduced when fill_cache_read() started to return errors in commit c7b607fa9325 ("selftests/resctrl: Fix null pointer dereference on open failed"), before that both fill functions always returned 0.
Move free() earlier to prevent the mem leak.
Fixes: c7b607fa9325 ("selftests/resctrl: Fix null pointer dereference on open failed") Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Tested-by: Babu Moger <[email protected]> Tested-by: Shaopeng Tan (Fujitsu) <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
|
Revision tags: v6.5-rc2, v6.5-rc1, v6.4, v6.4-rc7, v6.4-rc6, v6.4-rc5, v6.4-rc4, v6.4-rc3, v6.4-rc2, v6.4-rc1, v6.3, v6.3-rc7 |
|
| #
73c55fa5 |
| 13-Apr-2023 |
Shaopeng Tan <[email protected]> |
selftests/resctrl: Commonize the signal handler register/unregister for all tests
After creating a child process with fork() in CAT test, if a signal such as SIGINT is received, the parent process w
selftests/resctrl: Commonize the signal handler register/unregister for all tests
After creating a child process with fork() in CAT test, if a signal such as SIGINT is received, the parent process will be terminated immediately, and therefore the child process will not be killed and also resctrlfs is not unmounted.
There is a signal handler registered in CMT/MBM/MBA tests, which kills child process, unmount resctrlfs, cleanups result files, etc., if a signal such as SIGINT is received.
Commonize the signal handler registered for CMT/MBM/MBA tests and reuse it in CAT.
To reuse the signal handler to kill child process use global bm_pid instead of local bm_pid.
Also, since the MBA/MBA/CMT/CAT are run in order, unregister the signal handler at the end of each test so that the signal handler cannot be inherited by other tests.
Reviewed-by: Ilpo Jarvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Signed-off-by: Shaopeng Tan <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
|
Revision tags: v6.3-rc6, v6.3-rc5, v6.3-rc4, v6.3-rc3, v6.3-rc2, v6.3-rc1, v6.2 |
|
| #
5d869d7b |
| 15-Feb-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Replace obsolete memalign() with posix_memalign()
memalign() is obsolete according to its manpage.
Replace memalign() with posix_memalign() and remove malloc.h include that was t
selftests/resctrl: Replace obsolete memalign() with posix_memalign()
memalign() is obsolete according to its manpage.
Replace memalign() with posix_memalign() and remove malloc.h include that was there for memalign().
As a pointer is passed into posix_memalign(), initialize *p to NULL to silence a warning about the function's return value being used as uninitialized (which is not valid anyway because the error is properly checked before p is returned).
Suggested-by: Reinette Chatre <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
| #
22a8be28 |
| 15-Feb-2023 |
Ilpo Järvinen <[email protected]> |
selftests/resctrl: Return NULL if malloc_and_init_memory() did not alloc mem
malloc_and_init_memory() in fill_buf isn't checking if memalign() successfully allocated memory or not before accessing t
selftests/resctrl: Return NULL if malloc_and_init_memory() did not alloc mem
malloc_and_init_memory() in fill_buf isn't checking if memalign() successfully allocated memory or not before accessing the memory.
Check the return value of memalign() and return NULL if allocating aligned memory fails.
Fixes: a2561b12fe39 ("selftests/resctrl: Add built in benchmark") Co-developed-by: Fenghua Yu <[email protected]> Signed-off-by: Fenghua Yu <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
|
Revision tags: v6.2-rc8, v6.2-rc7, v6.2-rc6, v6.2-rc5, v6.2-rc4, v6.2-rc3, v6.2-rc2, v6.2-rc1, v6.1, v6.1-rc8, v6.1-rc7, v6.1-rc6, v6.1-rc5, v6.1-rc4, v6.1-rc3, v6.1-rc2, v6.1-rc1, v6.0, v6.0-rc7, v6.0-rc6, v6.0-rc5, v6.0-rc4, v6.0-rc3, v6.0-rc2, v6.0-rc1, v5.19, v5.19-rc8, v5.19-rc7, v5.19-rc6, v5.19-rc5, v5.19-rc4, v5.19-rc3, v5.19-rc2, v5.19-rc1, v5.18, v5.18-rc7, v5.18-rc6, v5.18-rc5 |
|
| #
c7b607fa |
| 26-Apr-2022 |
Colin Ian King <[email protected]> |
selftests/resctrl: Fix null pointer dereference on open failed
Currently if opening /dev/null fails to open then file pointer fp is null and further access to fp via fprintf will cause a null pointe
selftests/resctrl: Fix null pointer dereference on open failed
Currently if opening /dev/null fails to open then file pointer fp is null and further access to fp via fprintf will cause a null pointer dereference. Fix this by returning a negative error value when a null fp is detected.
Detected using cppcheck static analysis: tools/testing/selftests/resctrl/fill_buf.c:124:6: note: Assuming that condition '!fp' is not redundant if (!fp) ^ tools/testing/selftests/resctrl/fill_buf.c:126:10: note: Null pointer dereference fprintf(fp, "Sum: %d ", ret);
Fixes: a2561b12fe39 ("selftests/resctrl: Add built in benchmark") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
|
Revision tags: v5.18-rc4, v5.18-rc3, v5.18-rc2, v5.18-rc1, v5.17, v5.17-rc8, v5.17-rc7, v5.17-rc6, v5.17-rc5, v5.17-rc4, v5.17-rc3, v5.17-rc2, v5.17-rc1, v5.16, v5.16-rc8, v5.16-rc7, v5.16-rc6, v5.16-rc5, v5.16-rc4, v5.16-rc3, v5.16-rc2, v5.16-rc1, v5.15, v5.15-rc7, v5.15-rc6, v5.15-rc5, v5.15-rc4, v5.15-rc3, v5.15-rc2, v5.15-rc1, v5.14, v5.14-rc7, v5.14-rc6, v5.14-rc5, v5.14-rc4, v5.14-rc3, v5.14-rc2, v5.14-rc1, v5.13, v5.13-rc7, v5.13-rc6, v5.13-rc5, v5.13-rc4, v5.13-rc3, v5.13-rc2, v5.13-rc1, v5.12, v5.12-rc8, v5.12-rc7, v5.12-rc6, v5.12-rc5, v5.12-rc4 |
|
| #
24286736 |
| 17-Mar-2021 |
Fenghua Yu <[email protected]> |
selftests/resctrl: Clean up resctrl features check
Checking resctrl features call strcmp() to compare feature strings (e.g. "mba", "cat" etc). The checkings are error prone and don't have good codin
selftests/resctrl: Clean up resctrl features check
Checking resctrl features call strcmp() to compare feature strings (e.g. "mba", "cat" etc). The checkings are error prone and don't have good coding style. Define the constant strings in macros and call strncmp() to solve the potential issues.
Suggested-by: Shuah Khan <[email protected]> Tested-by: Babu Moger <[email protected]> Signed-off-by: Fenghua Yu <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
|
Revision tags: v5.12-rc3, v5.12-rc2, v5.12-rc1, v5.12-rc1-dontuse, v5.11, v5.11-rc7, v5.11-rc6, v5.11-rc5, v5.11-rc4, v5.11-rc3, v5.11-rc2, v5.11-rc1, v5.10, v5.10-rc7, v5.10-rc6, v5.10-rc5, v5.10-rc4, v5.10-rc3, v5.10-rc2, v5.10-rc1, v5.9, v5.9-rc8, v5.9-rc7, v5.9-rc6, v5.9-rc5, v5.9-rc4, v5.9-rc3, v5.9-rc2, v5.9-rc1, v5.8, v5.8-rc7, v5.8-rc6, v5.8-rc5, v5.8-rc4, v5.8-rc3, v5.8-rc2, v5.8-rc1, v5.7, v5.7-rc7, v5.7-rc6, v5.7-rc5, v5.7-rc4, v5.7-rc3, v5.7-rc2, v5.7-rc1, v5.6, v5.6-rc7, v5.6-rc6, v5.6-rc5, v5.6-rc4, v5.6-rc3, v5.6-rc2 |
|
| #
14f4283a |
| 12-Feb-2020 |
Colin Ian King <[email protected]> |
selftests/resctrl: fix spelling mistake "Errror" -> "Error"
There are two spelling mistakes in error messages. Fix these.
Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Shu
selftests/resctrl: fix spelling mistake "Errror" -> "Error"
There are two spelling mistakes in error messages. Fix these.
Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|
|
Revision tags: v5.6-rc1, v5.5, v5.5-rc7 |
|
| #
790bf585 |
| 16-Jan-2020 |
Fenghua Yu <[email protected]> |
selftests/resctrl: Add Cache Allocation Technology (CAT) selftest
Cache Allocation Technology (CAT) selftest allocates a portion of last level cache and starts a benchmark to read each cache line in
selftests/resctrl: Add Cache Allocation Technology (CAT) selftest
Cache Allocation Technology (CAT) selftest allocates a portion of last level cache and starts a benchmark to read each cache line in this portion of cache. Measure the cache misses in perf and the misses should be equal to the number of cache lines in this portion of cache.
We don't use CQM to calculate cache usage because some CAT enabled platforms don't have CQM.
Co-developed-by: Sai Praneeth Prakhya <[email protected]> Signed-off-by: Sai Praneeth Prakhya <[email protected]> Co-developed-by: Babu Moger <[email protected]> Signed-off-by: Babu Moger <[email protected]> Signed-off-by: Fenghua Yu <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
show more ...
|