LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Configure out DMI scanning code v2 (Linux Tiny)
@ 2008-02-12  9:04 Thomas Petazzoni
  2008-02-12 18:56 ` Matt Mackall
  2008-04-01 19:00 ` Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2008-02-12  9:04 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar, Thomas Gleixner, H. Anvin, Matt Mackall
  Cc: Linux-tiny, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2836 bytes --]

Hi,

Enclosed patch is an updated version, with proper credits to Matt
Mackall and the Linux Tiny project.

Sincerly,

Thomas

---

Turn CONFIG_DMI into a selectable option if EMBEDDED is defined, in
order to be able to remove the DMI table scanning code if it's not
needed, and then reduce the kernel code size.

With CONFIG_DMI (i.e before) :

   text    data     bss     dec     hex filename
1076076  128656   98304 1303036  13e1fc vmlinux

Without CONFIG_DMI (i.e after) :

   text    data     bss     dec     hex filename
1068092  126308   98304 1292704  13b9a0 vmlinux

Result:

   text    data     bss     dec     hex filename
  -7984   -2348       0  -10332   -285c vmlinux

The new option appears in "Processor type and features", only when
CONFIG_EMBEDDED is defined.

This patch is part of the Linux Tiny project, and is based on previous
work done by Matt Mackall <mpm@selenic.com>.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

---
 arch/x86/Kconfig    |   12 +++++++++---
 include/linux/dmi.h |    1 +
 2 files changed, 10 insertions(+), 3 deletions(-)

Index: linux/arch/x86/Kconfig
===================================================================
--- linux.orig/arch/x86/Kconfig	2008-02-11 16:51:50.000000000 +0100
+++ linux/arch/x86/Kconfig	2008-02-11 17:48:15.000000000 +0100
@@ -88,9 +88,6 @@
 config ARCH_MAY_HAVE_PC_FDC
 	def_bool y
 
-config DMI
-	def_bool y
-
 config RWSEM_GENERIC_SPINLOCK
 	def_bool !X86_XADD
 
@@ -433,6 +430,15 @@
 
 # Mark as embedded because too many people got it wrong.
 # The code disables itself when not needed.
+config DMI
+	default y
+	bool "Enable DMI scanning" if EMBEDDED
+	help
+	  Enabled scanning of DMI to identify machine quirks. Say Y
+	  here unless you have verified that your setup is not
+	  affected by entries in the DMI blacklist. Required by PNP
+	  BIOS code.
+
 config GART_IOMMU
 	bool "GART IOMMU support" if EMBEDDED
 	default y
Index: linux/include/linux/dmi.h
===================================================================
--- linux.orig/include/linux/dmi.h	2008-02-11 16:51:30.000000000 +0100
+++ linux/include/linux/dmi.h	2008-02-11 17:40:31.000000000 +0100
@@ -90,6 +90,7 @@
 static inline const char * dmi_get_system_info(int field) { return NULL; }
 static inline const struct dmi_device * dmi_find_device(int type, const char *name,
 	const struct dmi_device *from) { return NULL; }
+static inline void dmi_scan_machine(void) { return; }
 static inline int dmi_get_year(int year) { return 0; }
 static inline int dmi_name_in_vendors(const char *s) { return 0; }
 #define dmi_available 0


-- 
Thomas Petazzoni, Free Electrons
Free Embedded Linux Training Materials
on http://free-electrons.com/training
(More than 1500 pages!)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Configure out DMI scanning code v2 (Linux Tiny)
  2008-02-12  9:04 [PATCH] Configure out DMI scanning code v2 (Linux Tiny) Thomas Petazzoni
@ 2008-02-12 18:56 ` Matt Mackall
  2008-02-12 20:08   ` Andrew Morton
  2008-04-01 19:00 ` Andrew Morton
  1 sibling, 1 reply; 6+ messages in thread
From: Matt Mackall @ 2008-02-12 18:56 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Andrew Morton, Ingo Molnar, Thomas Gleixner, H. Anvin,
	Linux-tiny, linux-kernel


On Tue, 2008-02-12 at 10:04 +0100, Thomas Petazzoni wrote:

> Turn CONFIG_DMI into a selectable option if EMBEDDED is defined, in
> order to be able to remove the DMI table scanning code if it's not
> needed, and then reduce the kernel code size.
> 
> With CONFIG_DMI (i.e before) :
> 
>    text    data     bss     dec     hex filename
> 1076076  128656   98304 1303036  13e1fc vmlinux
> 
> Without CONFIG_DMI (i.e after) :
> 
>    text    data     bss     dec     hex filename
> 1068092  126308   98304 1292704  13b9a0 vmlinux
> 
> Result:
> 
>    text    data     bss     dec     hex filename
>   -7984   -2348       0  -10332   -285c vmlinux
> 
> The new option appears in "Processor type and features", only when
> CONFIG_EMBEDDED is defined.
> 
> This patch is part of the Linux Tiny project, and is based on previous
> work done by Matt Mackall <mpm@selenic.com>.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Thanks for working on this.

Acked-by: Matt Mackall <mpm@selenic.com>

-- 
Mathematics is the supreme nostalgia of our time.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Configure out DMI scanning code v2 (Linux Tiny)
  2008-02-12 18:56 ` Matt Mackall
@ 2008-02-12 20:08   ` Andrew Morton
  2008-02-17 17:59     ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2008-02-12 20:08 UTC (permalink / raw)
  To: Matt Mackall; +Cc: thomas.petazzoni, mingo, tglx, hpa, Linux-tiny, linux-kernel

On Tue, 12 Feb 2008 12:56:45 -0600
Matt Mackall <mpm@selenic.com> wrote:

> 
> On Tue, 2008-02-12 at 10:04 +0100, Thomas Petazzoni wrote:
> 
> > Turn CONFIG_DMI into a selectable option if EMBEDDED is defined, in
> > order to be able to remove the DMI table scanning code if it's not
> > needed, and then reduce the kernel code size.
> > 
> > With CONFIG_DMI (i.e before) :
> > 
> >    text    data     bss     dec     hex filename
> > 1076076  128656   98304 1303036  13e1fc vmlinux
> > 
> > Without CONFIG_DMI (i.e after) :
> > 
> >    text    data     bss     dec     hex filename
> > 1068092  126308   98304 1292704  13b9a0 vmlinux
> > 
> > Result:
> > 
> >    text    data     bss     dec     hex filename
> >   -7984   -2348       0  -10332   -285c vmlinux
> > 
> > The new option appears in "Processor type and features", only when
> > CONFIG_EMBEDDED is defined.

Given this:

> > This patch is part of the Linux Tiny project, and is based on previous
> > work done by Matt Mackall <mpm@selenic.com>.


> Acked-by: Matt Mackall <mpm@selenic.com>

That should have been "Signed-off-by:".  I'll speculatively make that
change.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Configure out DMI scanning code v2 (Linux Tiny)
  2008-02-12 20:08   ` Andrew Morton
@ 2008-02-17 17:59     ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2008-02-17 17:59 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Matt Mackall, thomas.petazzoni, tglx, hpa, Linux-tiny, linux-kernel


* Andrew Morton <akpm@linux-foundation.org> wrote:

> On Tue, 12 Feb 2008 12:56:45 -0600
> Matt Mackall <mpm@selenic.com> wrote:
> 
> > 
> > On Tue, 2008-02-12 at 10:04 +0100, Thomas Petazzoni wrote:
> > 
> > > Turn CONFIG_DMI into a selectable option if EMBEDDED is defined, in
> > > order to be able to remove the DMI table scanning code if it's not
> > > needed, and then reduce the kernel code size.
> > > 
> > > With CONFIG_DMI (i.e before) :
> > > 
> > >    text    data     bss     dec     hex filename
> > > 1076076  128656   98304 1303036  13e1fc vmlinux
> > > 
> > > Without CONFIG_DMI (i.e after) :
> > > 
> > >    text    data     bss     dec     hex filename
> > > 1068092  126308   98304 1292704  13b9a0 vmlinux
> > > 
> > > Result:
> > > 
> > >    text    data     bss     dec     hex filename
> > >   -7984   -2348       0  -10332   -285c vmlinux
> > > 
> > > The new option appears in "Processor type and features", only when
> > > CONFIG_EMBEDDED is defined.
> 
> Given this:
> 
> > > This patch is part of the Linux Tiny project, and is based on previous
> > > work done by Matt Mackall <mpm@selenic.com>.
> 
> 
> > Acked-by: Matt Mackall <mpm@selenic.com>
> 
> That should have been "Signed-off-by:".  I'll speculatively make that 
> change.

for the x86 bits:

Acked-by: Ingo Molnar <mingo@elte.hu>

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Configure out DMI scanning code v2 (Linux Tiny)
  2008-02-12  9:04 [PATCH] Configure out DMI scanning code v2 (Linux Tiny) Thomas Petazzoni
  2008-02-12 18:56 ` Matt Mackall
@ 2008-04-01 19:00 ` Andrew Morton
  2008-04-01 20:09   ` Rob Landley
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2008-04-01 19:00 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: mingo, tglx, hpa, mpm, Linux-tiny, linux-kernel, Reynes Philippe


Question for Ingo...

On Tue, 12 Feb 2008 10:04:18 +0100
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:

> Hi,
> 
> Enclosed patch is an updated version, with proper credits to Matt
> Mackall and the Linux Tiny project.
> 
> Sincerly,
> 
> Thomas
> 
> ---
> 
> Turn CONFIG_DMI into a selectable option if EMBEDDED is defined, in
> order to be able to remove the DMI table scanning code if it's not
> needed, and then reduce the kernel code size.
> 
> With CONFIG_DMI (i.e before) :
> 
>    text    data     bss     dec     hex filename
> 1076076  128656   98304 1303036  13e1fc vmlinux
> 
> Without CONFIG_DMI (i.e after) :
> 
>    text    data     bss     dec     hex filename
> 1068092  126308   98304 1292704  13b9a0 vmlinux
> 
> Result:
> 
>    text    data     bss     dec     hex filename
>   -7984   -2348       0  -10332   -285c vmlinux
> 
> The new option appears in "Processor type and features", only when
> CONFIG_EMBEDDED is defined.
> 
> This patch is part of the Linux Tiny project, and is based on previous
> work done by Matt Mackall <mpm@selenic.com>.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> 
> ---
>  arch/x86/Kconfig    |   12 +++++++++---
>  include/linux/dmi.h |    1 +
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> Index: linux/arch/x86/Kconfig
> ===================================================================
> --- linux.orig/arch/x86/Kconfig	2008-02-11 16:51:50.000000000 +0100
> +++ linux/arch/x86/Kconfig	2008-02-11 17:48:15.000000000 +0100
> @@ -88,9 +88,6 @@
>  config ARCH_MAY_HAVE_PC_FDC
>  	def_bool y
>  
> -config DMI
> -	def_bool y
> -
>  config RWSEM_GENERIC_SPINLOCK
>  	def_bool !X86_XADD
>  
> @@ -433,6 +430,15 @@
>  
>  # Mark as embedded because too many people got it wrong.
>  # The code disables itself when not needed.
> +config DMI
> +	default y
> +	bool "Enable DMI scanning" if EMBEDDED
> +	help
> +	  Enabled scanning of DMI to identify machine quirks. Say Y
> +	  here unless you have verified that your setup is not
> +	  affected by entries in the DMI blacklist. Required by PNP
> +	  BIOS code.
> +

This introduces a build error in drivers/acpi/thermal.c, because that code
does:

#ifdef CONFIF_DMI
<define some tables>
#endif

	...
	dmi_check_system(<those tables>);


Now, the approved fix here is to just remove the ifdefs.  The !CONFIG_DMI
version of dmi_check_system() won't generate any references to the tables
and the build system is then supposed to remove the generated code and data
from vmlinux.

But this doesn't work.

When I add an ifdef around the dmi_check_system() call, I get

   text    data     bss     dec     hex filename
1614279  210524  159992 1984795  1e491b vmlinux

but when I remove the ifdefs around the tables and rely on the compiler
removing the code and data I get

   text    data     bss     dec     hex filename
1614447  210972  159992 1985411  1e4b83 vmlinux

An additional 616 bytes of useless stuff.

Ingo, I think there was some trick to making this work right.  Do you
recall?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Configure out DMI scanning code v2 (Linux Tiny)
  2008-04-01 19:00 ` Andrew Morton
@ 2008-04-01 20:09   ` Rob Landley
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Landley @ 2008-04-01 20:09 UTC (permalink / raw)
  To: linux-tiny
  Cc: Andrew Morton, Thomas Petazzoni, Reynes Philippe, hpa,
	linux-kernel, mingo, tglx

On Tuesday 01 April 2008 14:00:36 Andrew Morton wrote:
>    text    data     bss     dec     hex filename
> 1614279  210524  159992 1984795  1e491b vmlinux
>
> but when I remove the ifdefs around the tables and rely on the compiler
> removing the code and data I get
>
>    text    data     bss     dec     hex filename
> 1614447  210972  159992 1985411  1e4b83 vmlinux
>
> An additional 616 bytes of useless stuff.
>
> Ingo, I think there was some trick to making this work right.  Do you
> recall?

Does bloat-o-meter say what the additional 616 bytes _is_?

scripts/bloat-o-meter vmlinux.old vmlinux.new

P.S.  What busybox did:

    ifneq ($(strip $(CONFIG_DEBUG)),y)
        OPTIMIZATION+=$(call check_cc,
$(CC),-ffunction-sections -fdata-sections,)
        CHECKED_LDFLAGS += $(call check_ld,$(LD),--gc-sections,)
    endif

Tells gcc to put each function and each global into its own ELF section, and 
then told the linker to garbage collect unused sections...

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-01 20:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-12  9:04 [PATCH] Configure out DMI scanning code v2 (Linux Tiny) Thomas Petazzoni
2008-02-12 18:56 ` Matt Mackall
2008-02-12 20:08   ` Andrew Morton
2008-02-17 17:59     ` Ingo Molnar
2008-04-01 19:00 ` Andrew Morton
2008-04-01 20:09   ` Rob Landley

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).