[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJfuBxzxwoyXbDrgQzb=BZJ8ZQ5hHo32Zr1uo6Od=7+q13+GXQ@mail.gmail.com>
Date: Wed, 10 Jun 2020 12:32:42 -0600
From: jim.cromie@...il.com
To: Stanimir Varbanov <stanimir.varbanov@...aro.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Joe Perches <joe@...ches.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jason Baron <jbaron@...mai.com>,
Randy Dunlap <rdunlap@...radead.org>
Subject: WIP generic module->debug_flags and dynamic_debug
so Ive got a WIP / broken / partial approach to giving all modules a
u32 flagset,
and enabling pr_debug based upon it. I leave out the "pr_debug_typed(
bitpos )" for now. For Stanimir, bits 1,2,3 could be high, middle,
low.
ATM its broken on my lack of container_of() skills.
Im trying to use it to get a struct module* using its name value thats
been copied
into a ddebug_table member.
Im relying on
cdf6d006968 dynamic_debug: don't duplicate modname in ddebug_add_module
to have the same value in both structs
but Im clearly missing a few things
besides the likely future trouble with .rodata builtin modules
(after compile prob solved)
It seems container_of wants me to use struct ddebug_table instead,
but I dont want a *ddebug_table.
Ive blindly guessed at adding & and * to 1st param, w/o understanding.
can anyone diagnose my problem ?
[jimc@...do build-virtme]$ git diff
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index a5d76f8f6b40..2bfd1aa083b3 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -20,6 +20,7 @@ struct _ddebug {
const char *function;
const char *filename;
const char *format;
+ u32 reqd_flags; /*misleading name todo, probly should hold
just a single type-bit */
unsigned int lineno:18;
/*
* The flags field controls the behaviour at the callsite.
diff --git a/include/linux/module.h b/include/linux/module.h
index 1ad393e62bef..06eeef438fd3 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -429,6 +429,7 @@ struct module {
struct mod_arch_specific arch;
unsigned long taints; /* same bits as kernel:taint_flags */
+ u32 debugflags;
#ifdef CONFIG_GENERIC_BUG
/* Support for BUG */
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 63ae6f77a0e4..965ee96630b5 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -202,6 +202,20 @@ static int ddebug_change(const struct ddebug_query *query,
if ((~dp->flags & filter->mask) != filter->mask)
continue;
+ /* screen on module->debugflags */
+ if (query->module) {
+ /* dt->modname is known == module->name */
+ struct module *m =
+ container_of((&(dt->mod_name)),
+ struct module, name);
+ if (m->debugflags &&
+ ((m->debugflags & dp->reqd_flags)
+ != dp->reqd_flags))
+ continue;
+ vpr_info("%s module-debugflags: 0x%x\n",
+ dt->mod_name, dp->reqd_flags);
+ }
+
nfound++;
newflags = (dp->flags & mods->mask) | mods->flags;
(END)
Powered by blists - more mailing lists