Skip to content

selftests/resctrl: CAT test improvements & generalized test framework

Ilpo Järvinen linux-kselftest lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest29 patches 4 repliesIn review
  2. v329 patches 19 repliesSuperseded
  3. v226 patches 35 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v124 patches47 repliesSuperseded

Changes in v4 from the cover letter

- Reworded a few error prints
- Changelog improvements
- fprintf()'s error handling changed ksft_perror() -> ksft_print_msg()
- Keep using ksft_*() instead of fprintf() in get_bit_mask()
- Check against div-by-zero
- Adjust one return type

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/29selftests/resctrl: Convert perror() to ksft_perror() or ksft_print_msg()tools/testing/selftests/resctrl/cache.c tools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/cmt_test.c +6 more+77 -701 reply
2/29selftests/resctrl: Return -1 instead of errno on errortools/testing/selftests/resctrl/cache.c tools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/cmt_test.c +4 more+14 -140 replies
3/29selftests/resctrl: Don't use ctrlc_handler() outside signal handlingtools/testing/selftests/resctrl/cache.c+0 -10 replies
4/29selftests/resctrl: Change function comments to say < 0 on errortools/testing/selftests/resctrl/cache.c tools/testing/selftests/resctrl/resctrlfs.c+6 -60 replies
5/29selftests/resctrl: Split fill_buf to allow tests finer-grained controltools/testing/selftests/resctrl/fill_buf.c+15 -60 replies
6/29selftests/resctrl: Refactor fill_buf functionstools/testing/selftests/resctrl/fill_buf.c tools/testing/selftests/resctrl/resctrl.h+18 -430 replies
7/29selftests/resctrl: Refactor get_cbm_mask() and rename to get_full_cbm()tools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/cmt_test.c tools/testing/selftests/resctrl/resctrl.h +1 more+41 -241 reply
8/29selftests/resctrl: Mark get_cache_size() cache_type consttools/testing/selftests/resctrl/resctrl.h tools/testing/selftests/resctrl/resctrlfs.c+2 -20 replies
9/29selftests/resctrl: Create cache_portion_size() helpertools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/cmt_test.c tools/testing/selftests/resctrl/resctrl.h+33 -90 replies
10/29selftests/resctrl: Exclude shareable bits from schemata in CAT testtools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/resctrl.h tools/testing/selftests/resctrl/resctrlfs.c+99 -40 replies
11/29selftests/resctrl: Split measure_cache_vals()tools/testing/selftests/resctrl/cache.c tools/testing/selftests/resctrl/resctrl.h tools/testing/selftests/resctrl/resctrl_val.c+41 -270 replies
12/29selftests/resctrl: Split show_cache_info() to test specific and generic partstools/testing/selftests/resctrl/cache.c tools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/cmt_test.c +1 more+66 -440 replies
13/29selftests/resctrl: Remove unnecessary __u64 -> unsigned long conversiontools/testing/selftests/resctrl/cache.c tools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/resctrl.h+13 -190 replies
14/29selftests/resctrl: Remove nested calls in perf event handlingtools/testing/selftests/resctrl/cache.c+14 -500 replies
15/29selftests/resctrl: Consolidate naming of perf event related thingstools/testing/selftests/resctrl/cache.c+21 -210 replies
16/29selftests/resctrl: Improve perf inittools/testing/selftests/resctrl/cache.c+6 -100 replies
17/29selftests/resctrl: Convert perf related globals to localstools/testing/selftests/resctrl/cache.c+40 -320 replies
18/29selftests/resctrl: Move cat_val() to cat_test.c and rename to cat_test()tools/testing/selftests/resctrl/cache.c tools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/resctrl.h+90 -870 replies
19/29selftests/resctrl: Open perf fd before start & add error handlingtools/testing/selftests/resctrl/cache.c tools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/resctrl.h+23 -110 replies
20/29selftests/resctrl: Replace file write with volatile variabletools/testing/selftests/resctrl/fill_buf.c tools/testing/selftests/resctrl/resctrl.h tools/testing/selftests/resctrl/resctrl_tests.c+16 -210 replies
21/29selftests/resctrl: Read in less obvious order to defeat prefetch optimizationstools/testing/selftests/resctrl/fill_buf.c+30 -80 replies
22/29selftests/resctrl: Rewrite Cache Allocation Technology (CAT) testtools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/fill_buf.c tools/testing/selftests/resctrl/resctrl.h +1 more+139 -1990 replies
23/29selftests/resctrl: Restore the CPU affinity after CAT testtools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/resctrl.h tools/testing/selftests/resctrl/resctrl_val.c +1 more+42 -90 replies
24/29selftests/resctrl: Create struct for input parameterstools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/cmt_test.c tools/testing/selftests/resctrl/mba_test.c +4 more+95 -710 replies
25/29selftests/resctrl: Introduce generalized test frameworktools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/cmt_test.c tools/testing/selftests/resctrl/mba_test.c +4 more+148 -1210 replies
26/29selftests/resctrl: Pass write_schemata() resource instead of test nametools/testing/selftests/resctrl/cat_test.c tools/testing/selftests/resctrl/cmt_test.c tools/testing/selftests/resctrl/mba_test.c +4 more+38 -380 replies
27/29selftests/resctrl: Add helper to convert L2/3 to integertools/testing/selftests/resctrl/resctrlfs.c+20 -80 replies
28/29selftests/resctrl: Rename resource ID to domain IDtools/testing/selftests/resctrl/resctrl.h tools/testing/selftests/resctrl/resctrl_val.c tools/testing/selftests/resctrl/resctrlfs.c+25 -250 replies
29/29selftests/resctrl: Get domain id from cache idtools/testing/selftests/resctrl/resctrl.h tools/testing/selftests/resctrl/resctrl_val.c tools/testing/selftests/resctrl/resctrlfs.c+21 -120 replies

Reviews trailers per patch

All 29 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchReinette Chatre
SeriesR-b
1/29R-b
2/29R-b
3/29R-b
4/29R-b
5/29R-b
6/29R-b
7/29R-b
8/29R-b
9/29R-b
10/29R-b
11/29R-b
12/29R-b
13/29R-b
14/29R-b
15/29R-b
16/29R-b
17/29R-b
18/29R-b
19/29R-b
20/29R-b
21/29R-b
22/29R-b
23/29R-b
24/29R-b
25/29R-b
26/29R-b
27/29R-b
28/29R-b
29/29R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 00/29] selftests/resctrl: CAT test improvements & generalized test framework

Hi all,

Here's v4 series to improve resctrl selftests with generalized test framework and rewritten CAT test.

The series contains following improvements:

- Excludes shareable bits from CAT test allocation to avoid interference
- Replaces file "sink" with a volatile variable
- Alters read pattern to defeat HW prefetcher optimizations
- Rewrites CAT test to make the CAT test reliable and truly measure if CAT is working or not
- Introduces generalized test framework making easier to add new tests
- Lots of other cleanups & refactoring

This series has been tested across a large number of systems from different generations.

v4:
- Reworded a few error prints
- Changelog improvements
- fprintf()'s error handling changed ksft_perror() -> ksft_print_msg()
- Keep using ksft_*() instead of fprintf() in get_bit_mask()
- Check against div-by-zero
- Adjust one return type

v3:
- New patches to handle return errno, perror() and return value comments
- Tweak changelogs
- Moved error printout removal to other patch
- Zero bit CBM returns error
- Tweak comments
- Make get_shareable_mask() static
- Return directly without storing result into ret variable first
- llc -> LLC
- Altered changelog and removed "the whole time" wording because llc occu results are still unsigned long
- Altered changelog's wording to not say "a volatile pointer"
- Make min_diff_percent and MIN_DIFF_PERCENT_PER_BIT unsigned long
- Add patch to restore CPU affinity after CAT test
- Move uparams clear into init function
- Add CPU vendor ID bitmask comment
- Use test_resource_feature_check(test) in CMT
- "feature" -> "resource" in function comment

v2:
- Postpone adding L2 CAT test as more investigations are necessary
- Add patch to remove ctrlc_handler() from wrong place
- Improvements to changelogs
- Function comments improvements & comment cleanups
- Move some parts of the changes into more logical patch
- If checks: buf == NULL -> !buf
- Variable naming:
- p -> buf
- cbm_mask_path -> cbm_path
- Function naming:
- get_cbm_mask() -> get_full_cbm()
- cache_size() -> cache_portion_size()
- Use PATH_MAX
- Improved cache_portion_size() parameter names
- int count -> unsigned int
- Pass filename to measurement taking functions instead of resctrl_val_param
- !lines ? : reversal
- Removed bogus static from function local variable
- Open perf fd only once, reset & enable in the innermost test loop
- Add perf fd ioctl() error handling
- Add patch to change compiler optimization prevention "sink" from file to volatile variable
- Remove cpu_no and resource (the latter was added in v1) members from resctrl_val_param (pass uparams and test where those are needed)
- Removed ARRAY_SIZE() macro
- Add patch to rename "resource_id" to "domain_id"

Ilpo Järvinen (29):
selftests/resctrl: Convert perror() to ksft_perror() or
ksft_print_msg()
selftests/resctrl: Return -1 instead of errno on error selftests/resctrl: Don't use ctrlc_handler() outside signal handling selftests/resctrl: Change function comments to say < 0 on error selftests/resctrl: Split fill_buf to allow tests finer-grained control selftests/resctrl: Refactor fill_buf functions selftests/resctrl: Refactor get_cbm_mask() and rename to

    get_full_cbm()
  selftests/resctrl: Mark get_cache_size() cache_type const
  selftests/resctrl: Create cache_portion_size() helper
  selftests/resctrl: Exclude shareable bits from schemata in CAT test
  selftests/resctrl: Split measure_cache_vals()
  selftests/resctrl: Split show_cache_info() to test specific and
    generic parts
  selftests/resctrl: Remove unnecessary __u64 -> unsigned long
    conversion
  selftests/resctrl: Remove nested calls in perf event handling
  selftests/resctrl: Consolidate naming of perf event related things
  selftests/resctrl: Improve perf init
  selftests/resctrl: Convert perf related globals to locals
  selftests/resctrl: Move cat_val() to cat_test.c and rename to
    cat_test()

selftests/resctrl: Open perf fd before start & add error handling selftests/resctrl: Replace file write with volatile variable selftests/resctrl: Read in less obvious order to defeat prefetch
optimizations
selftests/resctrl: Rewrite Cache Allocation Technology (CAT) test selftests/resctrl: Restore the CPU affinity after CAT test selftests/resctrl: Create struct for input parameters selftests/resctrl: Introduce generalized test framework selftests/resctrl: Pass write_schemata() resource instead of test name selftests/resctrl: Add helper to convert L2/3 to integer selftests/resctrl: Rename resource ID to domain ID selftests/resctrl: Get domain id from cache id

 tools/testing/selftests/resctrl/cache.c       | 287 +++++----------
 tools/testing/selftests/resctrl/cat_test.c    | 337 +++++++++++-------
 tools/testing/selftests/resctrl/cmt_test.c    |  80 +++--
 tools/testing/selftests/resctrl/fill_buf.c    | 132 ++++---
 tools/testing/selftests/resctrl/mba_test.c    |  30 +-
 tools/testing/selftests/resctrl/mbm_test.c    |  32 +-
 tools/testing/selftests/resctrl/resctrl.h     | 135 +++++--
 .../testing/selftests/resctrl/resctrl_tests.c | 197 ++++------
 tools/testing/selftests/resctrl/resctrl_val.c | 138 +++----
 tools/testing/selftests/resctrl/resctrlfs.c   | 321 +++++++++++------
 10 files changed, 945 insertions(+), 744 deletions(-)
Signature · 1 line
2.30.2