[PATCH v2 28/59] selftests-dyndbg: add test_mod_submod

Louis Chauvet louis.chauvet at bootlin.com
Mon Mar 24 15:20:04 UTC 2025



Le 20/03/2025 à 19:52, Jim Cromie a écrit :
> This new test-fn runs 3 module/submodule modprobe scenarios, variously
> using both the generic dyndbg=<queries> modprobe arg, and the
> test-module's classmap-params to manipulate the test-mod*'s pr_debugs.
> In all cases, the current flag-settings are counted and tested vs
> expectations.
> 
> The 3rd scenario recapitulates the DRM_USE_DYNAMIC_DEBUG=y failure.
> 
> 1. 2 modprobes (super then sub), with separate dyndbg=class-settings
>     check module specific flag settings
> 
> 2. modprobe submod, supermod is auto-loaded
>     set supermod class-params
>     check expected enablements in super & submod
> 
> 3. modprobe super, with param=setting (like drm.debug=0x1ef)
>     modprobe submod
>     validate submod's class'd pr_debugs get properly enabled
> 
> The test uses multi-queries, with both commas and percents (to avoid
> spaces and quoting).  This is the main reason the test wasn't earlier
> in the patchset, closer to the classmap patches its validating.
> 
> With some tedium, the tests could be refactored to split out early
> tests which avoid multi-cmds, and test only the class-params.
> 
> Signed-off-by: Jim Cromie <jim.cromie at gmail.com>

Reviewed-by: Louis Chauvet <louis.chauvet at bootlin.com>

> ---
> - drop -v used in test_mod_submod(). V=1 does it for whole test
> - ifrmmod at test end (Lukasz)
> ---
>   .../dynamic_debug/dyndbg_selftest.sh          | 69 +++++++++++++++++++
>   1 file changed, 69 insertions(+)
> 
> diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
> index c97c9391d0f4..cfed79b34996 100755
> --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
> +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
> @@ -275,10 +275,79 @@ function test_percent_splitting {
>       ifrmmod test_dynamic_debug
>   }
>   
> +function test_mod_submod {
> +    echo -e "${GREEN}# TEST_MOD_SUBMOD ${NC}"
> +    ifrmmod test_dynamic_debug_submod
> +    ifrmmod test_dynamic_debug
> +    ddcmd =_
> +
> +    # modprobe with class enablements
> +    modprobe test_dynamic_debug \
> +	dyndbg=class,D2_CORE,+pf%class,D2_KMS,+pt%class,D2_ATOMIC,+pm
> +
> +    check_match_ct '\[test_dynamic_debug\]' 23 -r
> +    check_match_ct =pf 1
> +    check_match_ct =pt 1
> +    check_match_ct =pm 1
> +
> +    modprobe test_dynamic_debug_submod
> +    check_match_ct test_dynamic_debug_submod 23 -r
> +    check_match_ct '\[test_dynamic_debug\]' 23 -r
> +    check_match_ct test_dynamic_debug 46 -r
> +
> +    # no enablements propagate here
> +    check_match_ct =pf 1
> +    check_match_ct =pt 1
> +    check_match_ct =pm 1
> +
> +    # change classes again, this time submod too
> +    ddcmd class,D2_CORE,+mf%class,D2_KMS,+lt%class,D2_ATOMIC,+ml "# add some prefixes"
> +    check_match_ct =pmf 1
> +    check_match_ct =plt 1
> +    check_match_ct =pml 1
> +    #  submod changed too
> +    check_match_ct =mf 1
> +    check_match_ct =lt 1
> +    check_match_ct =ml 1
> +
> +    # now work the classmap-params
> +    # fresh start, to clear all above flags (test-fn limits)
> +    ifrmmod test_dynamic_debug_submod
> +    ifrmmod test_dynamic_debug
> +    modprobe test_dynamic_debug_submod # get supermod too
> +
> +    echo 1 > /sys/module/test_dynamic_debug/parameters/p_disjoint_bits
> +    echo 4 > /sys/module/test_dynamic_debug/parameters/p_level_num
> +    # 2 mods * ( V1-3 + D2_CORE )
> +    check_match_ct =p 8
> +    echo 3 > /sys/module/test_dynamic_debug/parameters/p_disjoint_bits
> +    echo 0 > /sys/module/test_dynamic_debug/parameters/p_level_num
> +    # 2 mods * ( D2_CORE, D2_DRIVER )
> +    check_match_ct =p 4
> +    echo 0x16 > /sys/module/test_dynamic_debug/parameters/p_disjoint_bits
> +    echo 0 > /sys/module/test_dynamic_debug/parameters/p_level_num
> +    # 2 mods * ( D2_DRIVER, D2_KMS, D2_ATOMIC )
> +    check_match_ct =p 6
> +
> +    # recap DRM_USE_DYNAMIC_DEBUG regression
> +    ifrmmod test_dynamic_debug_submod
> +    ifrmmod test_dynamic_debug
> +    # set super-mod params
> +    modprobe test_dynamic_debug p_disjoint_bits=0x16 p_level_num=5
> +    check_match_ct =p 7
> +    modprobe test_dynamic_debug_submod
> +    # see them picked up by submod
> +    check_match_ct =p 14
> +    ifrmmod test_dynamic_debug_submod
> +    ifrmmod test_dynamic_debug
> +}
> +
>   tests_list=(
>       basic_tests
> +    # these require test_dynamic_debug*.ko
>       comma_terminator_tests
>       test_percent_splitting
> +    test_mod_submod
>   )
>   
>   # Run tests

-- 
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com




More information about the Intel-gfx-trybot mailing list