2008-02-12 10:35:53

by Thomas Petazzoni

[permalink] [raw]
Subject: [PATCH] Configure out doublefault exception handler (Linux Tiny)

Hi,

Enclosed patch allows to configure out the doublefault exception
handler. The original patch of Matt Mackall added the option in
init/Kconfig, but because this is a x86-specific thing, I thought
arch/x86/Kconfig would be a better place. Is that correct ?

This patch applies on top on the DMI scanning code patch I've sent
yesterday, because the DOUBLEFAULT config option is right after the DMI
config option. Is that ok, or should I propose a patch on top of a
vanilla 2.6.25-rc1 ?

Thanks for your review and comments,

Thomas

---


This patch adds the ability to disable the doublefault exception
handler, in order to save some kernel space. The doublefault exception
handler was already conditionnaly compiled using CONFIG_DOUBLEFAULT,
but there was no way to change the value of this configuration
option. The option is only visible if CONFIG_EMBEDDED is selected, in
order to not confuse other users.

The kernel space savings are as follows:

text data bss dec hex filename
1076076 128656 98304 1303036 13e1fc vmlinux.before
1075772 119952 94208 1289932 13aecc vmlinux.after
-304 -8704 -4096 -13104 -3330 +/-

This patch is part of the Linux Tiny project, and is based on previous
work by Matt Mackall <[email protected]>.

Signed-off-by: Thomas Petazzoni <[email protected]>

---
arch/x86/Kconfig | 7 +++++++
1 file changed, 7 insertions(+)

Index: linux/arch/x86/Kconfig
===================================================================
--- linux.orig/arch/x86/Kconfig
+++ linux/arch/x86/Kconfig
@@ -439,6 +439,13 @@
affected by entries in the DMI blacklist. Required by PNP
BIOS code.

+config DOUBLEFAULT
+ default y
+ bool "Enable doublefault exception handler" if EMBEDDED
+ help
+ This option allows trapping of rare doublefault exceptions
+ that would otherwise cause a system to silently reboot.
+
config GART_IOMMU
bool "GART IOMMU support" if EMBEDDED
default y


--
Thomas Petazzoni, [email protected], http://thomas.enix.org
Jabber, [email protected]
Toulibre, http://www.toulibre.org - APRIL, http://www.april.org
Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E 1624 F653 CB30 98D3 F7A7


Attachments:
signature.asc (189.00 B)

2008-02-12 13:04:30

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH] Configure out doublefault exception handler (Linux Tiny)

On Tue, Feb 12, 2008 at 11:08:25AM +0100, Thomas Petazzoni wrote:
> Hi,
>
> Enclosed patch allows to configure out the doublefault exception
> handler. The original patch of Matt Mackall added the option in
> init/Kconfig, but because this is a x86-specific thing, I thought
> arch/x86/Kconfig would be a better place. Is that correct ?
>
> This patch applies on top on the DMI scanning code patch I've sent
> yesterday, because the DOUBLEFAULT config option is right after the DMI
> config option. Is that ok, or should I propose a patch on top of a
> vanilla 2.6.25-rc1 ?
>
> Thanks for your review and comments,

We already have this in arch/x86/Kconfig.debug:

config DOUBLEFAULT
default y
bool "Enable doublefault exception handler" if EMBEDDED
depends on X86_32
help
This option allows trapping of rare doublefault exceptions that
would otherwise cause a system to silently reboot. Disabling this
option saves about 4k and might cause you much additional grey
hair.


It may need a small update if this is valid for both 32 and 64 bit.

Sam

2008-02-12 14:01:11

by Thomas Petazzoni

[permalink] [raw]
Subject: Re: [PATCH] Configure out doublefault exception handler (Linux Tiny)

Hi Sam,

Le Tue, 12 Feb 2008 14:04:28 +0100,
Sam Ravnborg <[email protected]> a écrit :

> We already have this in arch/x86/Kconfig.debug:

Oops, my usual "find . -name Kconfig" missed it. Thanks for pointing it
out!

> It may need a small update if this is valid for both 32 and 64 bit.

Doesn't seem so: there's only a doublefault_32.c, no doublefault_64.c.
However, I don't know the details of x86_64.

Thanks,

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


Attachments:
signature.asc (189.00 B)

2008-02-12 16:10:17

by Matt Mackall

[permalink] [raw]
Subject: Re: [PATCH] Configure out doublefault exception handler (Linux Tiny)


On Tue, 2008-02-12 at 15:00 +0100, Thomas Petazzoni wrote:
> Hi Sam,
>
> Le Tue, 12 Feb 2008 14:04:28 +0100,
> Sam Ravnborg <[email protected]> a écrit :
>
> > We already have this in arch/x86/Kconfig.debug:
>
> Oops, my usual "find . -name Kconfig" missed it. Thanks for pointing it
> out!

The fact that you didn't have to add any makefile bits should have been
a hint.

> > It may need a small update if this is valid for both 32 and 64 bit.
>
> Doesn't seem so: there's only a doublefault_32.c, no doublefault_64.c.
> However, I don't know the details of x86_64.

I bet there's some doublefault-handling code hiding somewhere. It's not
the sort of thing it'd make sense to take out of the architecture.

--
Mathematics is the supreme nostalgia of our time.

2008-02-15 12:00:56

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Configure out doublefault exception handler (Linux Tiny)

Matt Mackall <[email protected]> writes:
>
> I bet there's some doublefault-handling code hiding somewhere. It's not
> the sort of thing it'd make sense to take out of the architecture.

The big question is if it makes sense taking out of a kernel at all.
I still think the answer is no.

Or have you considered replacing die() and show_trace() etc. with a single
panic("the tiny gods say this won't happen") yet? That would be roughly
equivalent.

-Andi

2008-02-15 17:03:23

by Matt Mackall

[permalink] [raw]
Subject: Re: [PATCH] Configure out doublefault exception handler (Linux Tiny)


On Fri, 2008-02-15 at 13:00 +0100, Andi Kleen wrote:
> Matt Mackall <[email protected]> writes:
> >
> > I bet there's some doublefault-handling code hiding somewhere. It's not
> > the sort of thing it'd make sense to take out of the architecture.
>
> The big question is if it makes sense taking out of a kernel at all.
> I still think the answer is no.
>
> Or have you considered replacing die() and show_trace() etc. with a single
> panic("the tiny gods say this won't happen") yet? That would be roughly
> equivalent.

It's not a matter of "won't happen" so much as "not a damn thing we can
do when it does". There's very little point in having this sort of code
in a mass-market camera, phone, DVR, TV, etc. (of which there are
already millions running Linux). These devices have no console and
basically zero serviceability beyond firmware upgrades. If taking these
vestigial debugging features out means we can cram in more features that
consumers can actually see and will pay for, that's precisely what's
going to happen.

--
Mathematics is the supreme nostalgia of our time.

2008-02-15 17:29:18

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Configure out doublefault exception handler (Linux Tiny)

> do when it does". There's very little point in having this sort of code
> in a mass-market camera, phone, DVR, TV, etc. (of which there are

Do any of them run with a x86 CPU?

-Andi

2008-02-15 17:53:47

by Matt Mackall

[permalink] [raw]
Subject: Re: [PATCH] Configure out doublefault exception handler (Linux Tiny)


On Fri, 2008-02-15 at 19:04 +0100, Andi Kleen wrote:
> > do when it does". There's very little point in having this sort of code
> > in a mass-market camera, phone, DVR, TV, etc. (of which there are
>
> Do any of them run with a x86 CPU?

Yes. The last PVR I worked on was just such a device, as was the very
first device I put Linux on (1.2 era). There are several families of x86
CPUs targeted at embedded so this shouldn't be a surprise.

--
Mathematics is the supreme nostalgia of our time.

2008-02-17 17:59:43

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] Configure out doublefault exception handler (Linux Tiny)


* Thomas Petazzoni <[email protected]> wrote:

> Enclosed patch allows to configure out the doublefault exception
> handler. The original patch of Matt Mackall added the option in
> init/Kconfig, but because this is a x86-specific thing, I thought
> arch/x86/Kconfig would be a better place. Is that correct ?

we already have it for 32-bit - would you mind to do a patch to extend
this to 64-bit as well?

> This patch applies on top on the DMI scanning code patch I've sent
> yesterday, because the DOUBLEFAULT config option is right after the
> DMI config option. Is that ok, or should I propose a patch on top of a
> vanilla 2.6.25-rc1 ?

please send patches against x86.git:

http://people.redhat.com/mingo/x86.git/README

Ingo