[RFC PATCH 08/10] dyndbg: drop _ddebug.site member

From: Jim Cromie
Date: Thu Oct 12 2023 - 15:49:35 EST


drop site ptr, and rely upon the maple-tree intervals loaded by
ddebug_condense_sites().

In DEFINE_DYNAMIC_DEBUG_METADATA_CLS(), which creates a pair of
_ddebug & _ddebug_site structs, add '__used' to the latter, because it
is no longer linked from the former, and then also to the former, so
they both have the same number of entries. Replace the BUG_ON with a
pr_warn that shows the size of the mismatch.

TODO: sort out where the extra records are coming from.

Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>
---
include/linux/dynamic_debug.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 5206a2cfdb37..406b30d8eb98 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -27,7 +27,6 @@ struct _ddebug_site {
};

struct _ddebug {
- struct _ddebug_site *site;
const char *format;
unsigned int lineno:18;
#define CLS_BITS 6
@@ -228,13 +227,12 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
._filename = __FILE__

#define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt) \
- static struct _ddebug_site __aligned(8) \
+ static struct _ddebug_site __used __aligned(8) \
__section("__dyndbg_sites") name ##_site = { \
DYNAMIC_DEBUG_SITE_INIT(), \
}; \
- static struct _ddebug __aligned(8) \
+ static struct _ddebug __used __aligned(8) \
__section("__dyndbg") name = { \
- .site = &(name ##_site), \
.format = (fmt), \
.lineno = __LINE__, \
.flags = _DPRINTK_FLAGS_DEFAULT, \
--
2.41.0