2007-06-05 20:59:58

by Jeff Dike

[permalink] [raw]
Subject: [PATCH 2/2] UML - Fix kernel stack size on x86_64

[ This is 2.6.22 material ]

Having KERNEL_STACK_ORDER in defconfig overrides the value provided by
Kconfig, breaking UML/x86_64, which wants 2 page stacks.

Signed-off-by: Jeff Dike <[email protected]>
--
arch/um/defconfig | 1 -
1 file changed, 1 deletion(-)

Index: linux-2.6.21-mm/arch/um/defconfig
===================================================================
--- linux-2.6.21-mm.orig/arch/um/defconfig 2007-06-05 12:18:35.000000000 -0400
+++ linux-2.6.21-mm/arch/um/defconfig 2007-06-05 12:19:12.000000000 -0400
@@ -86,7 +86,6 @@ CONFIG_MCONSOLE=y
# CONFIG_MAGIC_SYSRQ is not set
CONFIG_NEST_LEVEL=0
# CONFIG_HIGHMEM is not set
-CONFIG_KERNEL_STACK_ORDER=0
CONFIG_UML_REAL_TIME_CLOCK=y

#


2007-06-06 00:00:29

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 2/2] UML - Fix kernel stack size on x86_64

On Tue, 5 Jun 2007 16:50:55 -0400
Jeff Dike <[email protected]> wrote:

> [ This is 2.6.22 material ]
>
> Having KERNEL_STACK_ORDER in defconfig overrides the value provided by
> Kconfig, breaking UML/x86_64, which wants 2 page stacks.
>
> Signed-off-by: Jeff Dike <[email protected]>
> --
> arch/um/defconfig | 1 -
> 1 file changed, 1 deletion(-)
>
> Index: linux-2.6.21-mm/arch/um/defconfig
> ===================================================================
> --- linux-2.6.21-mm.orig/arch/um/defconfig 2007-06-05 12:18:35.000000000 -0400
> +++ linux-2.6.21-mm/arch/um/defconfig 2007-06-05 12:19:12.000000000 -0400
> @@ -86,7 +86,6 @@ CONFIG_MCONSOLE=y
> # CONFIG_MAGIC_SYSRQ is not set
> CONFIG_NEST_LEVEL=0
> # CONFIG_HIGHMEM is not set
> -CONFIG_KERNEL_STACK_ORDER=0
> CONFIG_UML_REAL_TIME_CLOCK=y
>

That means the Kconfig rules are wrong, surely?

2007-06-06 00:46:36

by Jeff Dike

[permalink] [raw]
Subject: Re: [PATCH 2/2] UML - Fix kernel stack size on x86_64

On Tue, Jun 05, 2007 at 05:00:01PM -0700, Andrew Morton wrote:
> On Tue, 5 Jun 2007 16:50:55 -0400
> Jeff Dike <[email protected]> wrote:
>
> > [ This is 2.6.22 material ]
> >
> > Having KERNEL_STACK_ORDER in defconfig overrides the value provided by
> > Kconfig, breaking UML/x86_64, which wants 2 page stacks.

> That means the Kconfig rules are wrong, surely?

I'm far from a Kconfig expert, but what I have is

config KERNEL_STACK_ORDER
int "Kernel stack size order"
default 1 if 64BIT
default 0 if !64BIT

which seems reasonably clear and simple...

Jeff

--
Work email - jdike at linux dot intel dot com

2007-06-06 01:20:57

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 2/2] UML - Fix kernel stack size on x86_64

On Tue, 5 Jun 2007 20:37:52 -0400 Jeff Dike <[email protected]> wrote:

> On Tue, Jun 05, 2007 at 05:00:01PM -0700, Andrew Morton wrote:
> > On Tue, 5 Jun 2007 16:50:55 -0400
> > Jeff Dike <[email protected]> wrote:
> >
> > > [ This is 2.6.22 material ]
> > >
> > > Having KERNEL_STACK_ORDER in defconfig overrides the value provided by
> > > Kconfig, breaking UML/x86_64, which wants 2 page stacks.
>
> > That means the Kconfig rules are wrong, surely?
>
> I'm far from a Kconfig expert,

Me either. I learn enough for the problem at hand, then instaforget it
again. Kinda like perl.

> but what I have is
>
> config KERNEL_STACK_ORDER
> int "Kernel stack size order"
> default 1 if 64BIT
> default 0 if !64BIT
>
> which seems reasonably clear and simple...
>

hm, OK, there's the problem. This is an offered-to-the-user config option.

If you do

- int "Kernel stack size order"
+ int

then this rule will no longer be offered to the user and `make oldconfig'
(actually anythingconfig) will override whatever happens to be in .config
for KERNEL_STACK_ORDER.

I'm not sure if that's actually what you want, but if the current situation
is that a random CONFIG_KERNEL_STACK_ORDER=0 left over in .config will
break the kernel at runtime then I think something sterner than editing
defconfig is needed?

2007-06-06 15:20:49

by Jeff Dike

[permalink] [raw]
Subject: Re: [PATCH 2/2] UML - Fix kernel stack size on x86_64

On Tue, Jun 05, 2007 at 06:20:24PM -0700, Andrew Morton wrote:
> If you do
>
> - int "Kernel stack size order"
> + int
>
> then this rule will no longer be offered to the user and `make oldconfig'
> (actually anythingconfig) will override whatever happens to be in .config
> for KERNEL_STACK_ORDER.

You're saying that making an option user-visible changes whether
*config overrides .config? That's non-intuitive.

> I'm not sure if that's actually what you want, but if the current situation
> is that a random CONFIG_KERNEL_STACK_ORDER=0 left over in .config will
> break the kernel at runtime then I think something sterner than editing
> defconfig is needed?

That's a good point, but I think I do want it user-visible. If
someone sees someething I suspect to be a stack overflow, I'd like to
be able to tell them to bump KERNEL_STACK_ORDER and see if the problem
goes away.

As for something sterner, it turns out that Kbuild provides some
support for this. So, drop the previous patch in favor of this one:

Force KERNEL_STACK_ORDER to be at least 1 on UML/x86_64.

Signed-off-by: Jeff Dike <[email protected]>
--
arch/um/Kconfig | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.21-mm/arch/um/Kconfig
===================================================================
--- linux-2.6.21-mm.orig/arch/um/Kconfig 2007-06-06 09:28:13.000000000 -0400
+++ linux-2.6.21-mm/arch/um/Kconfig 2007-06-06 11:08:49.000000000 -0400
@@ -278,6 +278,7 @@ config HIGHMEM
config KERNEL_STACK_ORDER
int "Kernel stack size order"
default 1 if 64BIT
+ range 1 10 if 64BIT
default 0 if !64BIT
help
This option determines the size of UML kernel stacks. They will

2007-06-06 18:03:36

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 2/2] UML - Fix kernel stack size on x86_64

On Wed, 6 Jun 2007 11:11:34 -0400 Jeff Dike <[email protected]> wrote:

> On Tue, Jun 05, 2007 at 06:20:24PM -0700, Andrew Morton wrote:
> > If you do
> >
> > - int "Kernel stack size order"
> > + int
> >
> > then this rule will no longer be offered to the user and `make oldconfig'
> > (actually anythingconfig) will override whatever happens to be in .config
> > for KERNEL_STACK_ORDER.
>
> You're saying that making an option user-visible changes whether
> *config overrides .config? That's non-intuitive.

Yeah, I thought so. I discovered it by comparing the behaviour of your
patch against the behaviour of CONFIG_BASE_SMALL, fiddling around and
then saying "wtf".

> > I'm not sure if that's actually what you want, but if the current situation
> > is that a random CONFIG_KERNEL_STACK_ORDER=0 left over in .config will
> > break the kernel at runtime then I think something sterner than editing
> > defconfig is needed?
>
> That's a good point, but I think I do want it user-visible. If
> someone sees someething I suspect to be a stack overflow, I'd like to
> be able to tell them to bump KERNEL_STACK_ORDER and see if the problem
> goes away.
>
> As for something sterner, it turns out that Kbuild provides some
> support for this. So, drop the previous patch in favor of this one:
>
> Force KERNEL_STACK_ORDER to be at least 1 on UML/x86_64.
>
> Signed-off-by: Jeff Dike <[email protected]>
> --
> arch/um/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> Index: linux-2.6.21-mm/arch/um/Kconfig
> ===================================================================
> --- linux-2.6.21-mm.orig/arch/um/Kconfig 2007-06-06 09:28:13.000000000 -0400
> +++ linux-2.6.21-mm/arch/um/Kconfig 2007-06-06 11:08:49.000000000 -0400
> @@ -278,6 +278,7 @@ config HIGHMEM
> config KERNEL_STACK_ORDER
> int "Kernel stack size order"
> default 1 if 64BIT
> + range 1 10 if 64BIT
> default 0 if !64BIT
> help
> This option determines the size of UML kernel stacks. They will

heh, fair enough.