All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Tomlin <atomlin@redhat.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "mcgrof@kernel.org" <mcgrof@kernel.org>,
	"cl@linux.com" <cl@linux.com>, "mbenes@suse.cz" <mbenes@suse.cz>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"jeyu@kernel.org" <jeyu@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>,
	"void@manifault.com" <void@manifault.com>,
	"atomlin@atomlin.com" <atomlin@atomlin.com>,
	"allen.lkml@gmail.com" <allen.lkml@gmail.com>,
	"joe@perches.com" <joe@perches.com>,
	"msuchanek@suse.de" <msuchanek@suse.de>,
	"oleksandr@natalenko.name" <oleksandr@natalenko.name>,
	"jason.wessel@windriver.com" <jason.wessel@windriver.com>,
	"daniel.thompson@linaro.org" <daniel.thompson@linaro.org>,
	"hch@infradead.org" <hch@infradead.org>,
	"pmladek@suse.com" <pmladek@suse.com>
Subject: Re: [PATCH v10 13/14] module: Move kdb module related code out of main kdb code
Date: Tue, 8 Mar 2022 10:51:35 +0000	[thread overview]
Message-ID: <20220308105135.hvs6qqfvrxkpzykx@ava.usersys.com> (raw)
In-Reply-To: <82088b20-6129-aecc-c43c-1c78171717c4@csgroup.eu>

On Tue 2022-03-08 08:36 +0000, Christophe Leroy wrote:
> 
> 
> Le 07/03/2022 à 18:47, Aaron Tomlin a écrit :
> > diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> > index 0852a537dad4..f3a30cd5037f 100644
> > --- a/kernel/debug/kdb/kdb_main.c
> > +++ b/kernel/debug/kdb/kdb_main.c
> > @@ -26,7 +26,6 @@
> >   #include <linux/utsname.h>
> >   #include <linux/vmalloc.h>
> >   #include <linux/atomic.h>
> > -#include <linux/module.h>
> >   #include <linux/moduleparam.h>
> >   #include <linux/mm.h>
> >   #include <linux/init.h>
> No need of linux/module.h here anymore ?

Hi Christophe,

Correct.

> In that case, I see several other files in kernel/debug/kdb/ that 
> include linux/module.h
> 
> Should it be removed in those files as well ?

I did not review the other kernel/debug/kdb/.*c files.
Anyhow, yes it can be removed from each, since it is entirely redundant.

> > diff --git a/kernel/module/kdb.c b/kernel/module/kdb.c
> > new file mode 100644
> > index 000000000000..60baeebea3e0
> > --- /dev/null
> > +++ b/kernel/module/kdb.c
> > @@ -0,0 +1,55 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Module kdb support
> > + *
> > + * Copyright (C) 2010 Jason Wessel
> > + */
> > +
> > +#include <linux/module.h>
> > +#include <linux/kdb.h>
> > +#include "internal.h"
> > +
> > +/*
> > + * kdb_lsmod - This function implements the 'lsmod' command.  Lists
> > + *	currently loaded kernel modules.
> > + *	Mostly taken from userland lsmod.
> > + */
> > +int kdb_lsmod(int argc, const char **argv)
> > +{
> > +	struct module *mod;
> > +
> > +	if (argc != 0)
> > +		return KDB_ARGCOUNT;
> > +
> > +	kdb_printf("Module                  Size  modstruct     Used by\n");
> > +	list_for_each_entry(mod, &modules, list) {
> > +		if (mod->state == MODULE_STATE_UNFORMED)
> > +			continue;
> > +
> > +		kdb_printf("%-20s%8u  0x%px ", mod->name,
> > +			   mod->core_layout.size, (void *)mod);
> > +#ifdef CONFIG_MODULE_UNLOAD
> > +		kdb_printf("%4d ", module_refcount(mod));
> > +#endif
> > +		if (mod->state == MODULE_STATE_GOING)
> > +			kdb_printf(" (Unloading)");
> > +		else if (mod->state == MODULE_STATE_COMING)
> > +			kdb_printf(" (Loading)");
> > +		else
> > +			kdb_printf(" (Live)");
> > +		kdb_printf(" 0x%px", mod->core_layout.base);
> > +
> > +#ifdef CONFIG_MODULE_UNLOAD
> > +		{
> > +			struct module_use *use;
> > +			kdb_printf(" [ ");
> > +			list_for_each_entry(use, &mod->source_list,
> > +					    source_list)
> > +				kdb_printf("%s ", use->target->name);
> > +			kdb_printf("]\n");
> > +		}
> > +#endif
> 
> That's a ugly construct. Could it be a function instead that you call 
> from this loop,

Fair enough and I agree; albeit, as you know, this was simply a migration
to kernel/module/kdb.c. We could indeed address this format/or style
concern later.


> > diff --git a/kernel/module/main.c b/kernel/module/main.c
> > index b8a59b5c3e3a..bcc4f7a82649 100644
> > --- a/kernel/module/main.c
> > +++ b/kernel/module/main.c
> > @@ -108,10 +108,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 */
> 
> It should be removed from kernel/debug/kdb/kdb_private.h as well.

Agreed - this was missed.


Thanks,

-- 
Aaron Tomlin


  reply	other threads:[~2022-03-08 10:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 17:44 [PATCH v10 00/14] module: core code clean up Aaron Tomlin
2022-03-07 17:44 ` [PATCH v10 01/14] module: Move all into module/ Aaron Tomlin
2022-03-07 17:44 ` [PATCH v10 02/14] module: Simple refactor in preparation for split Aaron Tomlin
2022-03-07 17:44 ` [PATCH v10 03/14] module: Make internal.h and decompress.c more compliant Aaron Tomlin
2022-03-07 17:44 ` [PATCH v10 04/14] module: Move livepatch support to a separate file Aaron Tomlin
2022-03-07 17:45 ` [PATCH v10 05/14] module: Move latched RB-tree " Aaron Tomlin
2022-03-07 17:45 ` [PATCH v10 06/14] module: Move strict rwx " Aaron Tomlin
2022-03-07 17:45 ` [PATCH v10 07/14] module: Move extra signature support out of core code Aaron Tomlin
2022-03-07 17:45 ` [PATCH v10 08/14] module: Move kmemleak support to a separate file Aaron Tomlin
2022-03-07 17:45 ` [PATCH v10 09/14] module: Move kallsyms support into " Aaron Tomlin
2022-03-07 17:45 ` [PATCH v10 10/14] module: kallsyms: Fix suspicious rcu usage Aaron Tomlin
2022-03-07 17:45 ` [PATCH v10 11/14] module: Move procfs support into a separate file Aaron Tomlin
2022-03-07 17:47 ` [PATCH v10 12/14] module: Move sysfs " Aaron Tomlin
2022-03-07 17:47 ` [PATCH v10 13/14] module: Move kdb module related code out of main kdb code Aaron Tomlin
2022-03-08  8:36   ` Christophe Leroy
2022-03-08 10:51     ` Aaron Tomlin [this message]
2022-03-08 10:52   ` [PATCH] kdb: Remove redundant module related references Aaron Tomlin
2022-03-09 12:06     ` Daniel Thompson
2022-03-10  9:20       ` Aaron Tomlin
2022-03-10 21:07       ` Luis Chamberlain
2022-03-11 15:47         ` Daniel Thompson
2022-03-11 16:01           ` Aaron Tomlin
2022-03-11 16:19             ` Daniel Thompson
2022-03-07 17:47 ` [PATCH v10 14/14] module: Move version support into a separate file Aaron Tomlin
2022-03-07 21:05 ` [PATCH v10 00/14] module: core code clean up Luis Chamberlain
2022-03-08  6:10   ` Christophe Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220308105135.hvs6qqfvrxkpzykx@ava.usersys.com \
    --to=atomlin@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=allen.lkml@gmail.com \
    --cc=atomlin@atomlin.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=cl@linux.com \
    --cc=daniel.thompson@linaro.org \
    --cc=hch@infradead.org \
    --cc=jason.wessel@windriver.com \
    --cc=jeyu@kernel.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mcgrof@kernel.org \
    --cc=msuchanek@suse.de \
    --cc=oleksandr@natalenko.name \
    --cc=pmladek@suse.com \
    --cc=void@manifault.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.