Skip to content

Add post-kmod-unbind igt_hook

Peter Senna Tschudin igt-dev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 5 repliesIn review
  2. v32 patches 4 repliesSuperseded
  3. v22 patches 2 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches5 repliesSuperseded

Changes in v4 from the cover letter

- Updated hook unit testing to account for new env var
- Updated cover letter

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3lib/igt_core: Expose igt_hook pointer for other libslib/igt_core.c lib/igt_core.h+14 -00 replies
2/3lib/igt_kmod: Add IGT_HOOK_POST_KMOD_UNBINDlib/igt_hook.c lib/igt_hook.h lib/igt_kmod.c+22 -02 replies
3/3lib/tests: Update hook unit testinglib/tests/igt_hook.c lib/tests/igt_hook_integration.c+6 -41 reply

Reviews trailers per patch

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

PatchGustavo SousaKamil Konieczny
1/3R-b
2/3R-b
3/3R-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 i-g-t 0/3] Add post-kmod-unbind igt_hook

Introduces a new IGT hook: IGT_HOOK_POST_KMOD_UNBIND (post-kmod-unbind), designed to facilitate kmemleak scans in our CI workflows.

As suggested by Lucas de Marchi, a useful strategy for detecting memory leaks is to run kmemleak scans both before binding and after unbinding the kernel module. This patch adds support for the latter scenario, enabling automated scans immediately after the module is unbound.

Example test-list:
igt@xe_module_load@load
igt@core_hotunplug@unbind-rebind
igt@xe_module_load@unload

Example usage:
IGT_PING_HOSTNAME='10.211.176.1' IGT_TEST_ROOT='/home/gta/UPSTREAM/igt-gpu-tools/build/tests/' ./build/runner/igt_runner -o -l verbose -s --per-test-timeout 120 \
--overall-timeout 960 --piglit-style-dmesg --dmesg-warn-level=4 \
--use-watchdog --inactivity-timeout 90 \
--abort-on-monitored-error=ping,taint --disk-usage-limit=10M \

   --facts --hook 'post-kmod-unbind:OUTF=/tmp/kmemleak-post-unbind && \
                   echo $IGT_HOOK_TEST_FULLNAME $IGT_HOOK_TEST $IGT_HOOK_SUBTEST >> $OUTF && \
                   echo scan > /sys/kernel/debug/kmemleak && \
                   cat /sys/kernel/debug/kmemleak >> $OUTF' \

--test-list ~/igt/test-list \
/home/gta/igt/0

Known Limitations: In certain cases, such as when running igt@core_hotunplug@unbind-rebind, the unbind operation is explicitly managed by the igt if the module is already loaded. However, if the unbind occurs outside of igt, the hook will not be triggered and the scan will not run.

v4:
- Updated hook unit testing to account for new env var
- Updated cover letter

v3:
- Wrote Gustavo's name and email address correctly (:facepalm:)
- Renamed the hook to IGT_HOOK_POST_KMOD_UNBIND as the unbind can also happen for snd modules
- Changed the logic for the IGT_HOOK_KMOD_UNBIND_MODULE_NAME env var so that it is only populated when the correct hook is used.

v2:
- change function name to igt_core_get_igt_hook()
- Add env var IGT_HOOK_KMOD_UNBIND_MODULE_NAME
- Fix minor issues

Cc Gustavo Sousa <[email protected]>
Cc Kamil Konieczny <[email protected]>

Peter Senna Tschudin (3):
lib/igt_core: Expose igt_hook pointer for other libs lib/igt_kmod: Add IGT_HOOK_POST_KMOD_UNBIND lib/tests: Update hook unit testing

 lib/igt_core.c                   | 12 ++++++++++++
 lib/igt_core.h                   |  2 ++
 lib/igt_hook.c                   | 11 +++++++++++
 lib/igt_hook.h                   |  3 +++
 lib/igt_kmod.c                   |  8 ++++++++
 lib/tests/igt_hook.c             |  1 +
 lib/tests/igt_hook_integration.c |  9 +++++----
 7 files changed, 42 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0