diff mbox series

[v5,12/13] module: Move kdb_modules list out of core code

Message ID 20220209171118.3269581-2-atomlin@redhat.com (mailing list archive)
State Superseded
Headers show
Series module: core code clean up | expand

Commit Message

Aaron Tomlin Feb. 9, 2022, 5:11 p.m. UTC
No functional change.

This patch migrates kdb_modules list to core kdb code
since the list of added/or loaded modules is no longer
private.

Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
---
 kernel/debug/kdb/kdb_main.c | 5 +++++
 kernel/module/internal.h    | 1 +
 kernel/module/main.c        | 4 ----
 3 files changed, 6 insertions(+), 4 deletions(-)

Comments

Christophe Leroy Feb. 10, 2022, 2:05 p.m. UTC | #1
Le 09/02/2022 à 18:11, Aaron Tomlin a écrit :
> No functional change.
> 
> This patch migrates kdb_modules list to core kdb code
> since the list of added/or loaded modules is no longer
> private.
> 
> Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
> ---
>   kernel/debug/kdb/kdb_main.c | 5 +++++
>   kernel/module/internal.h    | 1 +
>   kernel/module/main.c        | 4 ----
>   3 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> index 0852a537dad4..f101f5f078f4 100644
> --- a/kernel/debug/kdb/kdb_main.c
> +++ b/kernel/debug/kdb/kdb_main.c
> @@ -59,6 +59,11 @@ EXPORT_SYMBOL(kdb_grepping_flag);
>   int kdb_grep_leading;
>   int kdb_grep_trailing;
>   
> +#ifdef CONFIG_MODULES
> +extern struct list_head modules;

Should go in module.h

> +struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */

Should be static and should be removed from kernel/debug/kdb/kdb_private.h

> +#endif /* CONFIG_MODULES */
> +
>   /*
>    * Kernel debugger state flags
>    */
> diff --git a/kernel/module/internal.h b/kernel/module/internal.h
> index 52d30bf6d6b0..c49b4900b30b 100644
> --- a/kernel/module/internal.h
> +++ b/kernel/module/internal.h
> @@ -225,6 +225,7 @@ static int mod_sysfs_setup(struct module *mod,
>   {
>   	return 0;
>   }
> +

This should go in previous patch if needed (patch 11 sysfs)


>   static inline void mod_sysfs_fini(struct module *mod) { }
>   static inline void module_remove_modinfo_attrs(struct module *mod, int end) { }
>   static inline void del_usage_links(struct module *mod) { }
> diff --git a/kernel/module/main.c b/kernel/module/main.c
> index c2255954b7df..519c5335f7a6 100644
> --- a/kernel/module/main.c
> +++ b/kernel/module/main.c
> @@ -105,10 +105,6 @@ static void mod_update_bounds(struct module *mod)
>   		__mod_update_bounds(mod->init_layout.base, mod->init_layout.size);
>   }
>   
> -#ifdef CONFIG_KGDB_KDB
> -struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */
> -#endif /* CONFIG_KGDB_KDB */
> -
>   static void module_assert_mutex_or_preempt(void)
>   {
>   #ifdef CONFIG_LOCKDEP
Aaron Tomlin Feb. 13, 2022, 2:14 p.m. UTC | #2
On Thu 2022-02-10 14:05 +0000, Christophe Leroy wrote:
> > diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> > index 0852a537dad4..f101f5f078f4 100644
> > --- a/kernel/debug/kdb/kdb_main.c
> > +++ b/kernel/debug/kdb/kdb_main.c
> > @@ -59,6 +59,11 @@ EXPORT_SYMBOL(kdb_grepping_flag);
> >   int kdb_grep_leading;
> >   int kdb_grep_trailing;
> >
> > +#ifdef CONFIG_MODULES
> > +extern struct list_head modules;
>
> Should go in module.h

I disagree. Let's keep it restricted somewhat. The list of loaded/or added
modules is not widely used.

> > +struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */
>
> Should be static and should be removed from kernel/debug/kdb/kdb_private.h

Agreed. It is only used in kernel/debug/kdb/kdb_main.c.

> > diff --git a/kernel/module/internal.h b/kernel/module/internal.h
> > index 52d30bf6d6b0..c49b4900b30b 100644
> > --- a/kernel/module/internal.h
> > +++ b/kernel/module/internal.h
> > @@ -225,6 +225,7 @@ static int mod_sysfs_setup(struct module *mod,
> >   {
> >       return 0;
> >   }
> > +
>
> This should go in previous patch if needed (patch 11 sysfs)

Agreed.


Kind regards,
diff mbox series

Patch

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 0852a537dad4..f101f5f078f4 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -59,6 +59,11 @@  EXPORT_SYMBOL(kdb_grepping_flag);
 int kdb_grep_leading;
 int kdb_grep_trailing;
 
+#ifdef CONFIG_MODULES
+extern struct list_head modules;
+struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */
+#endif /* CONFIG_MODULES */
+
 /*
  * Kernel debugger state flags
  */
diff --git a/kernel/module/internal.h b/kernel/module/internal.h
index 52d30bf6d6b0..c49b4900b30b 100644
--- a/kernel/module/internal.h
+++ b/kernel/module/internal.h
@@ -225,6 +225,7 @@  static int mod_sysfs_setup(struct module *mod,
 {
 	return 0;
 }
+
 static inline void mod_sysfs_fini(struct module *mod) { }
 static inline void module_remove_modinfo_attrs(struct module *mod, int end) { }
 static inline void del_usage_links(struct module *mod) { }
diff --git a/kernel/module/main.c b/kernel/module/main.c
index c2255954b7df..519c5335f7a6 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -105,10 +105,6 @@  static void mod_update_bounds(struct module *mod)
 		__mod_update_bounds(mod->init_layout.base, mod->init_layout.size);
 }
 
-#ifdef CONFIG_KGDB_KDB
-struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */
-#endif /* CONFIG_KGDB_KDB */
-
 static void module_assert_mutex_or_preempt(void)
 {
 #ifdef CONFIG_LOCKDEP