[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250125064619.8305-25-jim.cromie@gmail.com>
Date: Fri, 24 Jan 2025 23:45:38 -0700
From: Jim Cromie <jim.cromie@...il.com>
To: 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,
Jim Cromie <jim.cromie@...il.com>
Subject: [PATCH 24/63] dyndbg: hoist the range-overlap checks
hoist the classmaps range-check up to ddebug_add_module() from
ddebug_module_apply_class*(). THis puts both copies of the task
together, with the other semi-init work.
this allows ddebug_module_apply_class*() to revert back to void
return, but doesn't do that yet.
this is a candidate for squashing back.
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
lib/dynamic_debug.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 8e1e087e07c3..e57c05c9fb0a 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1257,11 +1257,9 @@ static int ddebug_module_apply_class_maps(struct ddebug_table *dt,
struct ddebug_class_map *cm;
int i;
- for_subvec(i, cm, &dt->info, maps) {
- if (ddebug_class_range_overlap(cm, reserved_ids))
- return -EINVAL;
+ for_subvec(i, cm, &dt->info, maps)
ddebug_apply_params(cm, cm->mod_name);
- }
+
vpr_info("module:%s attached %d classmaps\n", dt->mod_name, dt->info.maps.len);
return 0;
}
@@ -1272,11 +1270,9 @@ static int ddebug_module_apply_class_users(struct ddebug_table *dt,
struct ddebug_class_user *cli;
int i;
- for_subvec(i, cli, &dt->info, users) {
- if (ddebug_class_range_overlap(cli->map, reserved_ids))
- return -EINVAL;
+ for_subvec(i, cli, &dt->info, users)
ddebug_apply_params(cli->map, cli->mod_name);
- }
+
vpr_info("module:%s attached %d classmap uses\n", dt->mod_name, dt->info.users.len);
return 0;
}
@@ -1322,6 +1318,13 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname)
dd_mark_vector_subrange(i, dt, cm, di, maps);
dd_mark_vector_subrange(i, dt, cli, di, users);
+ for_subvec(i, cm, &dt->info, maps)
+ if (ddebug_class_range_overlap(cm, &reserved_ids))
+ return -EINVAL;
+ for_subvec(i, cli, &dt->info, users)
+ if (ddebug_class_range_overlap(cli->map, &reserved_ids))
+ return -EINVAL;
+
if (dt->info.maps.len) {
rc = ddebug_module_apply_class_maps(dt, &reserved_ids);
if (rc) {
--
2.48.1
Powered by blists - more mailing lists