[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220904214134.408619-46-jim.cromie@gmail.com>
Date: Sun, 4 Sep 2022 15:41:22 -0600
From: Jim Cromie <jim.cromie@...il.com>
To: jbaron@...mai.com, gregkh@...uxfoundation.org,
dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
intel-gvt-dev@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc: daniel.vetter@...ll.ch, seanpaul@...omium.org, robdclark@...il.com,
linux@...musvillemoes.dk, joe@...ches.com,
Jim Cromie <jim.cromie@...il.com>
Subject: [PATCH v6 45/57] dyndbg: de-duplicate sites
In __ddebug_add_module(), detect repeated site records (by function
name changes), and push changes onto the stack/vector passed in
from dynamic_debug_init().
For ddebug_add_module(), this transparently de-duplicates the local
sites vector (passed in recently added stack-base, and offset 0).
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
lib/dynamic_debug.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 1b57e43e9c31..41c23ec979f4 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1347,7 +1347,7 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base,
struct ddebug_table *dt;
int i;
- v3pr_info("add-module: %s.%d sites\n", modname, di->num_descs);
+ v3pr_info("add-module: %s.%d sites, start: %d\n", modname, di->num_descs, base);
if (!di->num_descs) {
v3pr_info(" skip %s\n", modname);
return 0;
@@ -1376,11 +1376,19 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base,
ddebug_attach_module_classes(dt, di->classes, di->num_classes);
for (i = 0; i < di->num_descs; i++) {
- di->descs[i]._index = base + i;
- v3pr_info(" %d %d %s.%s.%d\n", i, base, modname,
- di->descs[i].site->_function, di->descs[i].lineno);
- }
+ if (di->descs[i].site->_function != packed_sites[(*packed_base)]._function)
+ memcpy((void *) &packed_sites[++(*packed_base)],
+ (void *) di->descs[i].site, sizeof(struct _ddebug_site));
+ else
+ di->descs[i].site = &packed_sites[(*packed_base)];
+
+ di->descs[i]._index = i + base;
+ di->descs[i]._map = *packed_base;
+
+ v3pr_info(" %d %d %s.%s.%d - %d\n", i, *packed_base, modname,
+ di->descs[i].site->_function, di->descs[i].lineno, *packed_base);
+ }
mutex_lock(&ddebug_lock);
list_add_tail(&dt->link, &ddebug_tables);
mutex_unlock(&ddebug_lock);
@@ -1539,7 +1547,7 @@ static int __init dynamic_debug_init(void)
iter = iter_mod_start = __start___dyndbg;
site = site_mod_start = __start___dyndbg_sites;
modname = iter->site->_modname;
- i = mod_sites = mod_ct = 0;
+ i = mod_sites = mod_ct = site_base = 0;
for (; iter < __stop___dyndbg; iter++, site++, i++, mod_sites++) {
--
2.37.2
Powered by blists - more mailing lists