linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why is arch/x86/kernel/acpi/sleep.c:temp_stack 10k?
@ 2008-10-01  0:12 Matt Mackall
  2008-10-09  8:56 ` Pavel Machek
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Mackall @ 2008-10-01  0:12 UTC (permalink / raw)
  To: Ingo Molnar, Pavel Machek; +Cc: Linux Kernel Mailing List, linux-acpi

We've got:

#if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
static char temp_stack[10240];
#endif

and:

#ifdef CONFIG_SMP
        stack_start.sp = temp_stack + 4096;
#endif

..which suggests we use at most 4k of the stack?

-- 
Mathematics is the supreme nostalgia of our time.


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

* Re: Why is arch/x86/kernel/acpi/sleep.c:temp_stack 10k?
  2008-10-01  0:12 Why is arch/x86/kernel/acpi/sleep.c:temp_stack 10k? Matt Mackall
@ 2008-10-09  8:56 ` Pavel Machek
  2008-10-09 16:56   ` [PATCH] x86: trim ACPI sleep stack buffer Matt Mackall
  0 siblings, 1 reply; 9+ messages in thread
From: Pavel Machek @ 2008-10-09  8:56 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Ingo Molnar, Linux Kernel Mailing List, linux-acpi


> We've got:
> 
> #if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
> static char temp_stack[10240];
> #endif
> 
> and:
> 
> #ifdef CONFIG_SMP
>         stack_start.sp = temp_stack + 4096;
> #endif
> 
> ..which suggests we use at most 4k of the stack?

I guess someone (probably me) was "playing it safe" -- not exactly
remembering if stack grows down or up. I guess it should be safe to
change it... will do that.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* [PATCH] x86: trim ACPI sleep stack buffer
  2008-10-09  8:56 ` Pavel Machek
@ 2008-10-09 16:56   ` Matt Mackall
  2008-10-09 17:19     ` Len Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Mackall @ 2008-10-09 16:56 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Ingo Molnar, Linux Kernel Mailing List, linux-acpi

On Thu, 2008-10-09 at 10:56 +0200, Pavel Machek wrote:
> > We've got:
> > 
> > #if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
> > static char temp_stack[10240];
> > #endif
> > 
> > and:
> > 
> > #ifdef CONFIG_SMP
> >         stack_start.sp = temp_stack + 4096;
> > #endif
> > 
> > ..which suggests we use at most 4k of the stack?
> 
> I guess someone (probably me) was "playing it safe" -- not exactly
> remembering if stack grows down or up. I guess it should be safe to
> change it... will do that.
> 									Pavel

I've already got a patch, I was just wondering if there was some obscure
architectural reason for it that I wasn't aware of.


x86: trim ACPI sleep stack buffer

x86_64 SMP suspend to RAM uses a 10k temporary stack for saving the
kernel state, but only 4k of it is used. Shrink it to 4k.

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

diff -r 73d55a1b6c10 arch/x86/kernel/acpi/sleep.c
--- a/arch/x86/kernel/acpi/sleep.c	Wed Oct 08 14:48:45 2008 -0500
+++ b/arch/x86/kernel/acpi/sleep.c	Thu Oct 09 11:51:54 2008 -0500
@@ -21,7 +21,7 @@
 static unsigned long acpi_realmode;
 
 #if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
-static char temp_stack[10240];
+static char temp_stack[4096];
 #endif
 
 /**

-- 
Mathematics is the supreme nostalgia of our time.


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

* Re: [PATCH] x86: trim ACPI sleep stack buffer
  2008-10-09 16:56   ` [PATCH] x86: trim ACPI sleep stack buffer Matt Mackall
@ 2008-10-09 17:19     ` Len Brown
  2008-10-09 17:23       ` Moore, Robert
  0 siblings, 1 reply; 9+ messages in thread
From: Len Brown @ 2008-10-09 17:19 UTC (permalink / raw)
  To: Matt Mackall
  Cc: Pavel Machek, Ingo Molnar, Linux Kernel Mailing List, linux-acpi

applied to acpi-test.

thanks Matt,
-Len

On Thu, 9 Oct 2008, Matt Mackall wrote:

> On Thu, 2008-10-09 at 10:56 +0200, Pavel Machek wrote:
> > > We've got:
> > > 
> > > #if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
> > > static char temp_stack[10240];
> > > #endif
> > > 
> > > and:
> > > 
> > > #ifdef CONFIG_SMP
> > >         stack_start.sp = temp_stack + 4096;
> > > #endif
> > > 
> > > ..which suggests we use at most 4k of the stack?
> > 
> > I guess someone (probably me) was "playing it safe" -- not exactly
> > remembering if stack grows down or up. I guess it should be safe to
> > change it... will do that.
> > 									Pavel
> 
> I've already got a patch, I was just wondering if there was some obscure
> architectural reason for it that I wasn't aware of.
> 
> 
> x86: trim ACPI sleep stack buffer
> 
> x86_64 SMP suspend to RAM uses a 10k temporary stack for saving the
> kernel state, but only 4k of it is used. Shrink it to 4k.
> 
> Signed-off-by: Matt Mackall <mpm@selenic.com>
> 
> diff -r 73d55a1b6c10 arch/x86/kernel/acpi/sleep.c
> --- a/arch/x86/kernel/acpi/sleep.c	Wed Oct 08 14:48:45 2008 -0500
> +++ b/arch/x86/kernel/acpi/sleep.c	Thu Oct 09 11:51:54 2008 -0500
> @@ -21,7 +21,7 @@
>  static unsigned long acpi_realmode;
>  
>  #if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
> -static char temp_stack[10240];
> +static char temp_stack[4096];
>  #endif
>  
>  /**
> 
> -- 
> Mathematics is the supreme nostalgia of our time.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* RE: [PATCH] x86: trim ACPI sleep stack buffer
  2008-10-09 17:19     ` Len Brown
@ 2008-10-09 17:23       ` Moore, Robert
  2008-10-09 17:41         ` Matt Mackall
  0 siblings, 1 reply; 9+ messages in thread
From: Moore, Robert @ 2008-10-09 17:23 UTC (permalink / raw)
  To: Len Brown, Matt Mackall
  Cc: Pavel Machek, Ingo Molnar, Linux Kernel Mailing List, linux-acpi

Sounds like you need a

#define DEFAULT_STACK_SIZE 4096

Somewhere.


>-----Original Message-----
>From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
>owner@vger.kernel.org] On Behalf Of Len Brown
>Sent: Thursday, October 09, 2008 10:20 AM
>To: Matt Mackall
>Cc: Pavel Machek; Ingo Molnar; Linux Kernel Mailing List; linux-
>acpi@vger.kernel.org
>Subject: Re: [PATCH] x86: trim ACPI sleep stack buffer
>
>applied to acpi-test.
>
>thanks Matt,
>-Len
>
>On Thu, 9 Oct 2008, Matt Mackall wrote:
>
>> On Thu, 2008-10-09 at 10:56 +0200, Pavel Machek wrote:
>> > > We've got:
>> > >
>> > > #if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
>> > > static char temp_stack[10240];
>> > > #endif
>> > >
>> > > and:
>> > >
>> > > #ifdef CONFIG_SMP
>> > >         stack_start.sp = temp_stack + 4096;
>> > > #endif
>> > >
>> > > ..which suggests we use at most 4k of the stack?
>> >
>> > I guess someone (probably me) was "playing it safe" -- not exactly
>> > remembering if stack grows down or up. I guess it should be safe to
>> > change it... will do that.
>> >
>Pavel
>>
>> I've already got a patch, I was just wondering if there was some obscure
>> architectural reason for it that I wasn't aware of.
>>
>>
>> x86: trim ACPI sleep stack buffer
>>
>> x86_64 SMP suspend to RAM uses a 10k temporary stack for saving the
>> kernel state, but only 4k of it is used. Shrink it to 4k.
>>
>> Signed-off-by: Matt Mackall <mpm@selenic.com>
>>
>> diff -r 73d55a1b6c10 arch/x86/kernel/acpi/sleep.c
>> --- a/arch/x86/kernel/acpi/sleep.c    Wed Oct 08 14:48:45 2008 -0500
>> +++ b/arch/x86/kernel/acpi/sleep.c    Thu Oct 09 11:51:54 2008 -0500
>> @@ -21,7 +21,7 @@
>>  static unsigned long acpi_realmode;
>>
>>  #if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
>> -static char temp_stack[10240];
>> +static char temp_stack[4096];
>>  #endif
>>
>>  /**
>>
>> --
>> Mathematics is the supreme nostalgia of our time.
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH] x86: trim ACPI sleep stack buffer
  2008-10-09 17:23       ` Moore, Robert
@ 2008-10-09 17:41         ` Matt Mackall
  2008-10-09 18:07           ` Pavel Machek
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Mackall @ 2008-10-09 17:41 UTC (permalink / raw)
  To: Moore, Robert
  Cc: Len Brown, Pavel Machek, Ingo Molnar, Linux Kernel Mailing List,
	linux-acpi

On Thu, 2008-10-09 at 10:23 -0700, Moore, Robert wrote:
> Sounds like you need a
> 
> #define DEFAULT_STACK_SIZE 4096
> 
> Somewhere.

Or maybe something like this:


x86: remove magic number from ACPI sleep stack buffer

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

diff -r 375a00b8bf10 arch/x86/kernel/acpi/sleep.c
--- a/arch/x86/kernel/acpi/sleep.c	Thu Oct 09 12:38:55 2008 -0500
+++ b/arch/x86/kernel/acpi/sleep.c	Thu Oct 09 12:40:10 2008 -0500
@@ -97,7 +97,7 @@
 #else /* CONFIG_64BIT */
 	header->trampoline_segment = setup_trampoline() >> 4;
 #ifdef CONFIG_SMP
-	stack_start.sp = temp_stack + 4096;
+	stack_start.sp = temp_stack + sizeof(temp_stack);
 #endif
 	initial_code = (unsigned long)wakeup_long64;
 	saved_magic = 0x123456789abcdef0;


-- 
Mathematics is the supreme nostalgia of our time.


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

* Re: [PATCH] x86: trim ACPI sleep stack buffer
  2008-10-09 17:41         ` Matt Mackall
@ 2008-10-09 18:07           ` Pavel Machek
  2008-10-09 18:35             ` Len Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Pavel Machek @ 2008-10-09 18:07 UTC (permalink / raw)
  To: Matt Mackall
  Cc: Moore, Robert, Len Brown, Ingo Molnar, Linux Kernel Mailing List,
	linux-acpi, Rafael J. Wysocki

On Thu 2008-10-09 12:41:50, Matt Mackall wrote:
> On Thu, 2008-10-09 at 10:23 -0700, Moore, Robert wrote:
> > Sounds like you need a
> > 
> > #define DEFAULT_STACK_SIZE 4096
> > 
> > Somewhere.
> 
> Or maybe something like this:
> 
> 
> x86: remove magic number from ACPI sleep stack buffer
> 
> Signed-off-by: Matt Mackall <mpm@selenic.com>

Acked-by: Pavel Machek <pavel@suse.cz>

> diff -r 375a00b8bf10 arch/x86/kernel/acpi/sleep.c
> --- a/arch/x86/kernel/acpi/sleep.c	Thu Oct 09 12:38:55 2008 -0500
> +++ b/arch/x86/kernel/acpi/sleep.c	Thu Oct 09 12:40:10 2008 -0500
> @@ -97,7 +97,7 @@
>  #else /* CONFIG_64BIT */
>  	header->trampoline_segment = setup_trampoline() >> 4;
>  #ifdef CONFIG_SMP
> -	stack_start.sp = temp_stack + 4096;
> +	stack_start.sp = temp_stack + sizeof(temp_stack);
>  #endif
>  	initial_code = (unsigned long)wakeup_long64;
>  	saved_magic = 0x123456789abcdef0;
> 
> 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCH] x86: trim ACPI sleep stack buffer
  2008-10-09 18:07           ` Pavel Machek
@ 2008-10-09 18:35             ` Len Brown
  2008-10-09 21:25               ` Rafael J. Wysocki
  0 siblings, 1 reply; 9+ messages in thread
From: Len Brown @ 2008-10-09 18:35 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Matt Mackall, Moore, Robert, Ingo Molnar,
	Linux Kernel Mailing List, linux-acpi, Rafael J. Wysocki

applied (before the stack change patch:-) to acpi-test

thanks,
-Len

On Thu, 9 Oct 2008, Pavel Machek wrote:

> On Thu 2008-10-09 12:41:50, Matt Mackall wrote:
> > On Thu, 2008-10-09 at 10:23 -0700, Moore, Robert wrote:
> > > Sounds like you need a
> > > 
> > > #define DEFAULT_STACK_SIZE 4096
> > > 
> > > Somewhere.
> > 
> > Or maybe something like this:
> > 
> > 
> > x86: remove magic number from ACPI sleep stack buffer
> > 
> > Signed-off-by: Matt Mackall <mpm@selenic.com>
> 
> Acked-by: Pavel Machek <pavel@suse.cz>
> 
> > diff -r 375a00b8bf10 arch/x86/kernel/acpi/sleep.c
> > --- a/arch/x86/kernel/acpi/sleep.c	Thu Oct 09 12:38:55 2008 -0500
> > +++ b/arch/x86/kernel/acpi/sleep.c	Thu Oct 09 12:40:10 2008 -0500
> > @@ -97,7 +97,7 @@
> >  #else /* CONFIG_64BIT */
> >  	header->trampoline_segment = setup_trampoline() >> 4;
> >  #ifdef CONFIG_SMP
> > -	stack_start.sp = temp_stack + 4096;
> > +	stack_start.sp = temp_stack + sizeof(temp_stack);
> >  #endif
> >  	initial_code = (unsigned long)wakeup_long64;
> >  	saved_magic = 0x123456789abcdef0;
> > 
> > 
> 
> -- 
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
> 

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

* Re: [PATCH] x86: trim ACPI sleep stack buffer
  2008-10-09 18:35             ` Len Brown
@ 2008-10-09 21:25               ` Rafael J. Wysocki
  0 siblings, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2008-10-09 21:25 UTC (permalink / raw)
  To: Len Brown
  Cc: Pavel Machek, Matt Mackall, Moore, Robert, Ingo Molnar,
	Linux Kernel Mailing List, linux-acpi

On Thursday, 9 of October 2008, Len Brown wrote:
> applied (before the stack change patch:-) to acpi-test

FWIW, I had a look at it, looks good.

Thanks,
Rafael


> On Thu, 9 Oct 2008, Pavel Machek wrote:
> 
> > On Thu 2008-10-09 12:41:50, Matt Mackall wrote:
> > > On Thu, 2008-10-09 at 10:23 -0700, Moore, Robert wrote:
> > > > Sounds like you need a
> > > > 
> > > > #define DEFAULT_STACK_SIZE 4096
> > > > 
> > > > Somewhere.
> > > 
> > > Or maybe something like this:
> > > 
> > > 
> > > x86: remove magic number from ACPI sleep stack buffer
> > > 
> > > Signed-off-by: Matt Mackall <mpm@selenic.com>
> > 
> > Acked-by: Pavel Machek <pavel@suse.cz>
> > 
> > > diff -r 375a00b8bf10 arch/x86/kernel/acpi/sleep.c
> > > --- a/arch/x86/kernel/acpi/sleep.c	Thu Oct 09 12:38:55 2008 -0500
> > > +++ b/arch/x86/kernel/acpi/sleep.c	Thu Oct 09 12:40:10 2008 -0500
> > > @@ -97,7 +97,7 @@
> > >  #else /* CONFIG_64BIT */
> > >  	header->trampoline_segment = setup_trampoline() >> 4;
> > >  #ifdef CONFIG_SMP
> > > -	stack_start.sp = temp_stack + 4096;
> > > +	stack_start.sp = temp_stack + sizeof(temp_stack);
> > >  #endif
> > >  	initial_code = (unsigned long)wakeup_long64;
> > >  	saved_magic = 0x123456789abcdef0;
> > > 
> > > 
> > 
> > -- 
> > (english) http://www.livejournal.com/~pavelmachek
> > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 



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

end of thread, other threads:[~2008-10-09 21:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-01  0:12 Why is arch/x86/kernel/acpi/sleep.c:temp_stack 10k? Matt Mackall
2008-10-09  8:56 ` Pavel Machek
2008-10-09 16:56   ` [PATCH] x86: trim ACPI sleep stack buffer Matt Mackall
2008-10-09 17:19     ` Len Brown
2008-10-09 17:23       ` Moore, Robert
2008-10-09 17:41         ` Matt Mackall
2008-10-09 18:07           ` Pavel Machek
2008-10-09 18:35             ` Len Brown
2008-10-09 21:25               ` Rafael J. Wysocki

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