[PATCH i-g-t 0/2] Add post-gpukmod-unbind igt_hook

Peter Senna Tschudin peter.senna at linux.intel.com
Thu Jul 3 19:25:20 UTC 2025


Sorry Lucas and Gustavo for the typo in your email address...

On 7/3/2025 5:03 PM, Peter Senna Tschudin wrote:
> his patch introduces a new IGT hook: IGT_HOOK_POST_GPUKMOD_UNBIND
> (post-gpukmod-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 GPU kernel module. This patch adds support for the latter scenario,
> enabling automated scans immediately after the GPU module is unbound.
> 
> 
> Example test-list:
>  igt at xe_module_load@load
>  igt at core_hotunplug@unbind-rebind
>  igt at xe_module_load@unload
> 
> Usage Example:
>  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-gpukmod-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 at core_hotunplug@unbind-rebind, the unbind operation is explicitly
> managed by igt_runner if the module is already loaded. However, if the
> unbind occurs outside of igt_runner, the hook will not be triggered and
> the scan will not run.
> 
> Cc: Gustavo Sousa <gustavo.sousa at linux.intel.com>
> Cc: Lucas de Marchi <lucas.demarchi at linux.intel.com>
> 
> Peter Senna Tschudin (2):
>   igt_core: igt_hook_get_pointer() for external hooks
>   lib/igt_kmod: Add IGT_HOOK_POST_GPUKMOD_UNBIND
> 
>  lib/igt_core.c | 12 ++++++++++++
>  lib/igt_core.h |  9 +++++++++
>  lib/igt_hook.c |  5 +++++
>  lib/igt_hook.h |  1 +
>  lib/igt_kmod.c |  7 +++++++
>  5 files changed, 34 insertions(+)
> 



More information about the igt-dev mailing list