[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <77a8fdeb-c906-4cd2-ac42-e6a5d3d9e521@bootlin.com>
Date: Tue, 25 Feb 2025 12:22:05 +0100
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: Jim Cromie <jim.cromie@...il.com>, linux-kernel@...r.kernel.org,
jbaron@...mai.com, gregkh@...uxfoundation.org, ukaszb@...omium.org
Cc: intel-gfx-trybot@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
amd-gfx@...ts.freedesktop.org, intel-gvt-dev@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org, daniel.vetter@...ll.ch,
tvrtko.ursulin@...ux.intel.com, jani.nikula@...el.com,
ville.syrjala@...ux.intel.com,
Konstantin Ryabitsev <konstantin@...uxfoundation.org>
Subject: Re: [PATCH 02/63] test-dyndbg: fixup CLASSMAP usage error
Le 25/01/2025 à 07:45, Jim Cromie a écrit :
> A more careful reading of logging output from test_dynamic_debug.ko
> reveals:
>
> lib/test_dynamic_debug.c:103 [test_dynamic_debug]do_cats =pmf "doing categories\n"
> lib/test_dynamic_debug.c:105 [test_dynamic_debug]do_cats =p "LOW msg\n" class:MID
> lib/test_dynamic_debug.c:106 [test_dynamic_debug]do_cats =p "MID msg\n" class:HI
> lib/test_dynamic_debug.c:107 [test_dynamic_debug]do_cats =_ "HI msg\n" class unknown, _id:13
>
> 107 says: HI is unknown, 105,106 have LOW/MID and MID/HI skew.
>
> The enum's 1st val (explicitly initialized) was wrong; it must be
> _base, not _base+1 (a DECLARE_DYNDBG_CLASSMAP param). So the last
> enumeration exceeded the range of mapped class-id's, which triggered
> the "class unknown" report. I coded in an error, intending to verify
> err detection, then forgot, and missed that it was there.
>
> So this patch fixes a bad usage of DECLARE_DYNDBG_CLASSMAP(), showing
> that it is too error-prone. As noted in test-mod comments:
>
> * Using the CLASSMAP api:
> * - classmaps must have corresponding enum
> * - enum symbols must match/correlate with class-name strings in the map.
> * - base must equal enum's 1st value
> * - multiple maps must set their base to share the 0-62 class_id space !!
>
> Signed-off-by: Jim Cromie <jim.cromie@...il.com>
Reviewed-by: Louis Chauvet <louis.chauvet@...tlin.com>
Tested-by: Louis Chauvet <louis.chauvet@...tlin.com>
> ---
> lib/test_dynamic_debug.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c
> index 77c2a669b6af..396144cf351b 100644
> --- a/lib/test_dynamic_debug.c
> +++ b/lib/test_dynamic_debug.c
> @@ -75,7 +75,7 @@ DD_SYS_WRAP(disjoint_bits, p);
> DD_SYS_WRAP(disjoint_bits, T);
>
> /* symbolic input, independent bits */
> -enum cat_disjoint_names { LOW = 11, MID, HI };
> +enum cat_disjoint_names { LOW = 10, MID, HI };
> DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, 10,
> "LOW", "MID", "HI");
> DD_SYS_WRAP(disjoint_names, p);
--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists