LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Configure out DMI scanning code
@ 2008-02-11 16:58 Thomas Petazzoni
  2008-02-11 19:01 ` Matt Mackall
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2008-02-11 16:58 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: 3347 bytes --]

Hi,

The enclosed patch allows to remove the DMI scanning code when
CONFIG_EMBEDDED is defined. It's basically the dma_blacklist patch of
Linux-Tiny ported to 2.6.25-rc1, with the required modifications. It
allows to remove ~10k from the kernel code/data size.

On top of this patch, I've tested if removing the big dmi tables in the
code (for example in arch/x86/kernel/reboot.c) would allow to make more
space optimizations. However, it seems that simply defining
dmi_check_system() to an empty static inlined function already allows
gcc to optimize out the dmi tables, because there are not present in
the code. Is that possible, or is my understanding incorrect ?

Of course, your comments on this patch are more than welcome.

Thanks!

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.

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] 4+ messages in thread

* Re: [PATCH] Configure out DMI scanning code
  2008-02-11 16:58 [PATCH] Configure out DMI scanning code Thomas Petazzoni
@ 2008-02-11 19:01 ` Matt Mackall
  2008-02-12  7:33   ` Thomas Petazzoni
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Mackall @ 2008-02-11 19:01 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Andrew Morton, Ingo Molnar, Thomas Gleixner, H. Anvin,
	Linux-tiny, linux-kernel


On Mon, 2008-02-11 at 17:58 +0100, Thomas Petazzoni wrote:
> Hi,
> 
> The enclosed patch allows to remove the DMI scanning code when
> CONFIG_EMBEDDED is defined. It's basically the dma_blacklist patch of
> Linux-Tiny ported to 2.6.25-rc1, with the required modifications. It
> allows to remove ~10k from the kernel code/data size.

Looks ok. Please preserve original authorship (ie me) in some fashion in
your description.

> On top of this patch, I've tested if removing the big dmi tables in the
> code (for example in arch/x86/kernel/reboot.c) would allow to make more
> space optimizations. However, it seems that simply defining
> dmi_check_system() to an empty static inlined function already allows
> gcc to optimize out the dmi tables, because there are not present in
> the code. Is that possible, or is my understanding incorrect ?

That's possible with modern gccs, yes.

-- 
Mathematics is the supreme nostalgia of our time.


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

* Re: [PATCH] Configure out DMI scanning code
  2008-02-11 19:01 ` Matt Mackall
@ 2008-02-12  7:33   ` Thomas Petazzoni
  2008-02-12  7:42     ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2008-02-12  7:33 UTC (permalink / raw)
  To: Matt Mackall
  Cc: Andrew Morton, Ingo Molnar, Thomas Gleixner, H. Anvin,
	Linux-tiny, linux-kernel

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

Hi Matt,

Thanks for your review.

Le Mon, 11 Feb 2008 13:01:18 -0600,
Matt Mackall <mpm@selenic.com> a écrit :

> Looks ok. Please preserve original authorship (ie me) in some fashion
> in your description.

Andrew seems to already have picked up the patch in -mm (I received an
e-mail + x86-configurable-dmi-scanning-code.patch added to -mm tree).
If I resend a new one with proper credits, will Andrew pick it up and
replace the old version by the new version ?

> > On top of this patch, I've tested if removing the big dmi tables in
> > the code (for example in arch/x86/kernel/reboot.c) would allow to
> > make more space optimizations. However, it seems that simply
> > defining dmi_check_system() to an empty static inlined function
> > already allows gcc to optimize out the dmi tables, because there
> > are not present in the code. Is that possible, or is my
> > understanding incorrect ?
> 
> That's possible with modern gccs, yes.

I was compiling with 4.2.3, which I suppose is a modern gcc.

Thanks,

Thomas
-- 
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] 4+ messages in thread

* Re: [PATCH] Configure out DMI scanning code
  2008-02-12  7:33   ` Thomas Petazzoni
@ 2008-02-12  7:42     ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2008-02-12  7:42 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Matt Mackall, Ingo Molnar, Thomas Gleixner, H. Anvin, Linux-tiny,
	linux-kernel

On Tue, 12 Feb 2008 08:33:23 +0100 Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:

> If I resend a new one with proper credits, will Andrew pick it up and
> replace the old version by the new version ?

yup.

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

end of thread, other threads:[~2008-02-12  7:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-11 16:58 [PATCH] Configure out DMI scanning code Thomas Petazzoni
2008-02-11 19:01 ` Matt Mackall
2008-02-12  7:33   ` Thomas Petazzoni
2008-02-12  7:42     ` Andrew Morton

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