Skip to content

Fix dmesg ignore regexes with backslash escapes

Shuicheng Lin igt-dev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 2 repliesIn review
  2. v14 patches 10 repliesApplied

Changes in v2 from the cover letter

- Patch 1: Drop the parentheses instead of using bracket expressions and drop the comment (Kamil)
- Patch 2: Simplify the SIGID patterns, match only the start of the CAT error and add example lines (Kamil)
- Patch 3: Add example dmesg lines to the comment (Kamil)
- Patch 4: No change
- Add Reviewed-by tags (Jonathan, Kamil)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4tests/intel/xe_exec_reset: Fix gt reset fault dmesg ignore regextests/intel/xe_exec_reset.c+3 -30 replies
2/4tests/intel/xe_wedged: Fix wedged dmesg ignore regextests/intel/xe_wedged.c+5 -21 reply
3/4tests/intel/xe_fault_injection: Avoid backslash escapes in dmesg ignore regextests/intel/xe_fault_injection.c+5 -20 replies
4/4runner/resultgen: Decode kmsg escapes in ignored dmesg regexrunner/json_tests_data/dmesg-escapes/0/dmesg.txt runner/json_tests_data/dmesg-escapes/README.txt runner/json_tests_data/dmesg-escapes/reference.json +1 more+38 -180 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchKamil KoniecznyJonathan Cavitt
1/4R-b
2/4R-b
3/4R-b
4/4R-b

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

Read the v2 thread

Cover letter [PATCH v2 0/4] Fix dmesg ignore regexes with backslash escapes

igt_emit_ignore_dmesg_regex() passes the regex to igt_runner through /dev/kmsg, and the kernel escapes '\' as "\x5c" in kmsg records. Since resultgen compiles the ignore regex from the escaped record, any regex using a backslash escape, such as "\(-ECANCELED\)", silently never matches. As a result, the expected errors in xe_exec_reset@gt-reset-fault-injection are reported as dmesg-warn.

Patches 1-3 fix the affected tests by avoiding backslash escapes, so they work with the current igt_runner:
- xe_exec_reset: "\(" never matches, the expected GT reset failure and wedge errors leak.
- xe_wedged: besides the CAT error escapes (and a missing space), the patterns no longer match the SIGID-based messages that newer kernels use for the GT reset failure and wedge.
- xe_fault_injection: "\*ERROR\*" only matches by accident, as it degrades to "ERROR" with optional backslashes around it.

Patch 4 fixes igt_runner itself by decoding the kmsg escapes before compiling the ignore regex, so future regexes can use backslash escapes as written.

Tested on BMG with drm-tip: the expected errors are no longer reported for xe_exec_reset@gt-reset-fault-injection, xe_wedged@{basic-wedged,wedged-at-any-timeout} and xe_fault_injection@inject-fault-probe-function-xe_guc_ct_init, and the new igt_runner also ignores them with the unfixed xe_exec_reset.

v2:
- Patch 1: Drop the parentheses instead of using bracket expressions and drop the comment (Kamil)
- Patch 2: Simplify the SIGID patterns, match only the start of the CAT error and add example lines (Kamil)
- Patch 3: Add example dmesg lines to the comment (Kamil)
- Patch 4: No change
- Add Reviewed-by tags (Jonathan, Kamil)

Shuicheng Lin (4):
tests/intel/xe_exec_reset: Fix gt reset fault dmesg ignore regex tests/intel/xe_wedged: Fix wedged dmesg ignore regex tests/intel/xe_fault_injection: Avoid backslash escapes in dmesg
ignore regex
runner/resultgen: Decode kmsg escapes in ignored dmesg regex

 .../json_tests_data/dmesg-escapes/0/dmesg.txt |  2 +
 .../json_tests_data/dmesg-escapes/README.txt  |  4 ++
 .../dmesg-escapes/reference.json              |  2 +-
 runner/resultgen.c                            | 48 ++++++++++++-------
 tests/intel/xe_exec_reset.c                   |  6 +--
 tests/intel/xe_fault_injection.c              |  7 ++-
 tests/intel/xe_wedged.c                       |  7 ++-
 7 files changed, 51 insertions(+), 25 deletions(-)
Signature · 1 line
2.43.0