Message ID | 855201dc0204a1428a79d415c97df2b6e11c95c3.1677612539.git.jbaron@akamai.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | dyndbg: let's use the module notifier callback | expand |
On Tue, Feb 28, 2023 at 02:34:21PM -0500, Jason Baron wrote:
> __ddebug_add_module() doesn't use the 'base' arg. Remove it.
It would be good if the commit log explains why the base became unused.
What commit removed its use? As of what kernel?
Luis
On Tue, Feb 28, 2023 at 1:38 PM Luis Chamberlain <mcgrof@kernel.org> wrote: > > On Tue, Feb 28, 2023 at 02:34:21PM -0500, Jason Baron wrote: > > __ddebug_add_module() doesn't use the 'base' arg. Remove it. > > It would be good if the commit log explains why the base became unused. > What commit removed its use? As of what kernel? > > Luis the base arg became obsolete with this. I had the same patch on-deck, but Jason did it 1st. commit b7b4eebdba7b6aea6b34dc29691b71c39d1dbd6a Author: Jim Cromie <jim.cromie@gmail.com> Date: Sun Sep 4 15:40:48 2022 -0600 dyndbg: gather __dyndbg[] state into struct _ddebug_info This new struct composes the linker provided (vector,len) section, and provides a place to add other __dyndbg[] state-data later: descs - the vector of descriptors in __dyndbg section. num_descs - length of the data/section. Use it, in several different ways, as follows: In lib/dynamic_debug.c: ddebug_add_module(): Alter params-list, replacing 2 args (array,index) with a struct _ddebug_info * containing them both, with room for expansion. This helps future-proof the function prototype against the looming addition of class-map info into the dyndbg-state, by providing a place to add more member fields later. NB: later add static struct _ddebug_info builtins_state declaration, not needed yet. ddebug_add_module() is called in 2 contexts: In dynamic_debug_init(), declare, init a struct _ddebug_info di auto-var to use as a cursor. Then iterate over the prdbg blocks of the builtin modules, and update the di cursor before calling _add_module for each. Its called from kernel/module/main.c:load_info() for each loaded module: In internal.h, alter struct load_info, replacing the dyndbg array,len fields with an embedded _ddebug_info containing them both; and populate its members in find_module_sections(). The 2 calling contexts differ in that _init deals with contiguous subranges of __dyndbgs[] section, packed together, while loadable modules are added one at a time. So rename ddebug_add_module() into outer/__inner fns, call __inner from _init, and provide the offset into the builtin __dyndbgs[] where the module's prdbgs reside. The cursor provides start, len of the subrange for each. The offset will be used later to pack the results of builtin __dyndbg_sites[] de-duplication, and is 0 and unneeded for loadable modules,
> __ddebug_add_module() doesn't use the 'base' arg. Remove it. > > Cc: Jim Cromie <jim.cromie@gmail.com> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Tested-by: Jim Cromie <jim.cromie@gmail.com> > Signed-off-by: Jason Baron <jbaron@akamai.com> > --- Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
On Thu, Mar 09, 2023 at 07:31:21PM +0100, Vincenzo Palazzo wrote: > > __ddebug_add_module() doesn't use the 'base' arg. Remove it. > > > > Cc: Jim Cromie <jim.cromie@gmail.com> > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > Tested-by: Jim Cromie <jim.cromie@gmail.com> > > Signed-off-by: Jason Baron <jbaron@akamai.com> > > --- > > Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> Tag applied, thanks. Luis
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 009f2ead09c1..8136e5236b7b 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1223,8 +1223,7 @@ static void ddebug_attach_module_classes(struct ddebug_table *dt, * Allocate a new ddebug_table for the given module * and add it to the global list. */ -static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, - const char *modname) +static int __ddebug_add_module(struct _ddebug_info *di, const char *modname) { struct ddebug_table *dt; @@ -1265,7 +1264,7 @@ static int __ddebug_add_module(struct _ddebug_info *di, unsigned int base, int ddebug_add_module(struct _ddebug_info *di, const char *modname) { - return __ddebug_add_module(di, 0, modname); + return __ddebug_add_module(di, modname); } /* helper for ddebug_dyndbg_(boot|module)_param_cb */ @@ -1408,7 +1407,7 @@ static int __init dynamic_debug_init(void) mod_ct++; di.num_descs = mod_sites; di.descs = iter_mod_start; - ret = __ddebug_add_module(&di, i - mod_sites, modname); + ret = __ddebug_add_module(&di, modname); if (ret) goto out_err; @@ -1419,7 +1418,7 @@ static int __init dynamic_debug_init(void) } di.num_descs = mod_sites; di.descs = iter_mod_start; - ret = __ddebug_add_module(&di, i - mod_sites, modname); + ret = __ddebug_add_module(&di, modname); if (ret) goto out_err;