linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Theodore Tso <tytso@mit.edu>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	zippel@linux-m68k.org, linux-kbuild@vger.kernel.org,
	Sam Ravnborg <sam@ravnborg.org>, Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH 0/3] removing unwanted module configs
Date: Thu, 30 Apr 2009 09:17:29 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.0904300908110.20374@gandalf.stny.rr.com> (raw)
In-Reply-To: <20090430071830.GC16737@elte.hu>


On Thu, 30 Apr 2009, Ingo Molnar wrote:

> 
> * Steven Rostedt <rostedt@goodmis.org> wrote:
> 
> > As it has been brought up last Kernel Summit, we want to make it easier
> > for those that report bugs to build their own kernels, and maybe even
> > bisect with git.  Some of these people are not programmers and do not
> > understand the complexity of the configuration options. But to compile
> > a distribution configured kernel on their boxes can take hours.
> > 
> > This patch series comes to the rescue. I wrote the first instance of
> > streamline config when I bought a new box in 2005 and got frustrated
> > with finding all the necessary configurations to boot it. It is a
> > small (yet powerful) perl script.
> > 
> > Here's what it does:
> > 
> >  * Reads the modules that are load by using lsmod.
> >  * Reads all Makefiles to map modules to CONFIG_* options
> >  * Reads the Kconfig files to find dependencies and selects
> >  * Figures out what CONFIGS are needed to compile the loaded modules
> >  * Reads the .config and prints out a version with all module configurations
> >     that not needed, disabled.
> > 
> > The next two patches add options to make.
> > 
> >  localmodconfig - this will run streamline_config.pl on the .config file
> > 	and replace it at the end.
> > 
> >  localyesconfig - this will do the same as localmodconfig but will also
> > 	sed -i s/=m/=y/  to turn all modules to core. It will also run
> > 	the 'make oldcondfig' to fix it up and let the user handle
> > 	andything that was changed by converting a module to core.
> > 
> > Anyway, this is now in git and as a series of patches here. My git 
> > tree is based off of the latest Linus git tree.
> > 
> > Have fun!
> 
> Very nice and useful!
> 
> I have given it a try - it works to a certain degree, but does not 
> seem to work fully. If i boot a Fedora distro kernel with this 
> module setup:
> 
> aldebaran:~/linux/linux> lsmod
> Module                  Size  Used by
> sunrpc                253904  1 
> ipv6                  349568  50 
> cpufreq_ondemand       73248  0 
> acpi_cpufreq           75408  0 
> freq_table             70400  2 cpufreq_ondemand,acpi_cpufreq
> dm_multipath           82256  0 
> i2c_i801               75932  0 
> i2c_core               87192  1 i2c_i801
> serio_raw              71556  0 
> pcspkr                 68352  0 
> pata_jmicron           69504  0 
> iTCO_wdt               78208  0 
> shpchp                 99160  0 
> iTCO_vendor_support    68868  1 iTCO_wdt
> igb                   144412  0 
> dca                    71976  1 igb
> pata_acpi              70528  0 
> ata_generic            71428  0 
> 
> note the 'igb' driver that is essential to be picked up. 'make 
> localyesconfig' complains:
> 
>   module igb did not have configs CONFIG_IGB

Did the original .config have it set. It will not enable any modules that 
are not already set.

> 
> But:
> 
>   # CONFIG_IGB is not set
> 
> It did pick up other essential drivers - such as ext3. Why did it 
> miss IGB? Here are all the missed drivers:
> 
> aldebaran:~/linux/linux> make localyesconfig
> module ata_generic did not have configs CONFIG_ATA_GENERIC
> module iTCO_vendor_support did not have configs CONFIG_ITCO_WDT
> module shpchp did not have configs CONFIG_HOTPLUG_PCI_SHPC
> module acpi_cpufreq did not have configs CONFIG_IA64_ACPI_CPUFREQ CONFIG_X86_ACPI_CPUFREQ
> module pata_jmicron did not have configs CONFIG_PATA_JMICRON
> module i2c_i801 did not have configs CONFIG_I2C_I801
> module serio_raw did not have configs CONFIG_SERIO_RAW
> module iTCO_wdt did not have configs CONFIG_ITCO_WDT
> module freq_table did not have configs CONFIG_CPU_FREQ_TABLE
> module igb did not have configs CONFIG_IGB
> module ipv6 did not have configs CONFIG_IPV6
> module dca did not have configs CONFIG_DCA
> module sunrpc did not have configs CONFIG_SUNRPC
> module pata_acpi did not have configs CONFIG_PATA_ACPI
> module dm_multipath did not have configs CONFIG_DM_MULTIPATH
> module cpufreq_ondemand did not have configs 
> CONFIG_CPU_FREQ_GOV_ONDEMAND
> module i2c_core did not have configs CONFIG_I2C
> module pcspkr did not have configs CONFIG_INPUT_PCSPKR

Hmm, I just added the "localyesconfig" and have not played with it much. I 
need to change the integrity check of the script to test for modules that 
are already compiled in (CONFIG_FOO=y). Right now it expects the modules 
to be modules :-/


> 
> Of those drivers, igb is the only truly boot-critical one - the box 
> wont be very useful if it has no network support.
> 
> Another comment: 'make localyesconfig' does not seem to be 
> self-invariant. I.e. it does not handle the case well when we 
> already have booted a localyesconfig kernel and do 'make 
> localyesconfig' again. It will find no modules and will merrily 
> create an almost empty .config.

It should not touch CONFIG_FOO=y. It should only disable the modules that 
are already set but not needed.

I will update the script to not warn about modules that are compiled in.

> 
> This could be addressed the following way: i think the script should 
> implicitly turn on CONFIG_IKCONFIG=y, and should also check for the 
> presence of /proc/config.gz and use it as a starting point. This 
> makes the whole concept nicely self-invariant.

I really want to stay away from enabling anything in the .config scripts. 
I can probably do it for the trivial cases. But there are cases where more 
than one config will enable a module, or it takes several types of 
dependencies to enable it. The script can not know which is the best set 
of dependencies to enable, and I would not want to enable all of them.

But if you have a simple linier script, or no "or" cases. If we have

CONFIG_A depends on CONFIG_X && CONFIG_Y and CONFIG_X and CONFIG_Y do not 
have any depends or needs to be selected, I could enable all of them if 
that is the only way to enable a module. But this would come later.

Right now the goal is to remove modules that are in .config but are not 
used. If CONFIG_IGB above was set (CONFIG_IGB=m) and the script disabled 
it, then that would be a bug.

I will fix the warnings when the module is compiled in.

Thanks!

-- Steve


  reply	other threads:[~2009-04-30 13:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30  3:08 [PATCH 0/3] removing unwanted module configs Steven Rostedt
2009-04-30  3:08 ` [PATCH 1/3] kconfig: add streamline_config.pl to scripts Steven Rostedt
2009-04-30  3:08 ` [PATCH 2/3] kconfig: make localmodconfig to run streamline_config.pl Steven Rostedt
2009-04-30  3:08 ` [PATCH 3/3] kconfig: add make localyesconfig option Steven Rostedt
2009-04-30  7:18 ` [PATCH 0/3] removing unwanted module configs Ingo Molnar
2009-04-30 13:17   ` Steven Rostedt [this message]
2009-04-30 13:26     ` Ingo Molnar
2009-04-30 13:42       ` Steven Rostedt
2009-04-30 13:47         ` Steven Rostedt
2009-04-30 14:43           ` Ingo Molnar
2009-04-30 14:42         ` Ingo Molnar

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=alpine.DEB.2.00.0904300908110.20374@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=acme@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=sam@ravnborg.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=zippel@linux-m68k.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).