Skip to contentSkip to conversation

Why is arch/x86/kernel/acpi/sleep.c:temp_stack 10k?

PATCH In review Matt Mackall 5 participants 9 messages Oct 1, 2008 – Oct 9, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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?

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#1 lore raw
Quoted 7 lines

We've got:

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

Quoted 7 lines

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

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#2 lore raw

PATCH 1/1 x86: trim ACPI sleep stack buffer

Quoted 12 lines · Pavel Machek
Quoted 12 lines

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

Quoted 6 lines
Quoted 1 line

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

arch/x86/kernel/acpi/sleep.c +1 -1
diff -r 73d55a1b6c10 arch/x86/kernel/acpi/sleep.c
@@ -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
 
 /**
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
reviewer
#3 lore raw

Re: [PATCH] x86: trim ACPI sleep stack buffer

applied to acpi-test.

thanks Matt,
-Len

Quoted 52 lines · Matt Mackall
Quoted 12 lines · Pavel Machek
Quoted 12 lines

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

Quoted 6 lines
Quoted 1 line

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

diff -r 73d55a1b6c10 arch/x86/kernel/acpi/sleep.c

arch/x86/kernel/acpi/sleep.c +1 -1
@@ -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
 
 /**
Signature · 7 lines
-- 
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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

RE: [PATCH] x86: trim ACPI sleep stack buffer

Sounds like you need a

#define DEFAULT_STACK_SIZE 4096

Somewhere.

Quoted 73 lines

-----Original Message-----
From: [email protected] [mailto:linux-acpi- [email protected]] 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- [email protected]
Subject: Re: [PATCH] x86: trim ACPI sleep stack buffer

applied to acpi-test.

thanks Matt,
-Len

Quoted 13 lines · Matt Mackall
Quoted 12 lines · Pavel Machek
Quoted 12 lines

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

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

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

Quoted 28 lines

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.

diff -r 73d55a1b6c10 arch/x86/kernel/acpi/sleep.c

arch/x86/kernel/acpi/sleep.c Thu Oct 09 11:51:54 2008 -0500 renamed from arch/x86/kernel/acpi/sleep.c Wed Oct 08 14:48:45 2008 -0500 +1 -2
@@ -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.

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

RE: [PATCH] x86: trim ACPI sleep stack buffer

Quoted 5 lines · Robert

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

arch/x86/kernel/acpi/sleep.c +1 -1
diff -r 375a00b8bf10 arch/x86/kernel/acpi/sleep.c
@@ -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;
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
Acked-by
#6 lore raw

Re: [PATCH] x86: trim ACPI sleep stack buffer

Quoted 5 lines · Matt Mackall
Quoted 4 lines · Robert

Sounds like you need a

#define DEFAULT_STACK_SIZE 4096

Quoted 8 lines
Quoted 1 line

Somewhere.

Or maybe something like this:

x86: remove magic number from ACPI sleep stack buffer

Quoted 14 lines

diff -r 375a00b8bf10 arch/x86/kernel/acpi/sleep.c

arch/x86/kernel/acpi/sleep.c +1 -1
@@ -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;
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
reviewer
#7 lore raw

Re: [PATCH] x86: trim ACPI sleep stack buffer

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

thanks,
-Len

Quoted 36 lines · Pavel Machek
Quoted 5 lines · Matt Mackall
Quoted 4 lines · Robert

Sounds like you need a

#define DEFAULT_STACK_SIZE 4096

Quoted 8 lines
Quoted 1 line

Somewhere.

Or maybe something like this:

x86: remove magic number from ACPI sleep stack buffer

Quoted 14 lines

diff -r 375a00b8bf10 arch/x86/kernel/acpi/sleep.c

arch/x86/kernel/acpi/sleep.c +1 -1
@@ -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;
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#8 lore raw

Re: [PATCH] x86: trim ACPI sleep stack buffer

Quoted 1 line · Len Brown

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

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

Thanks,
Rafael

Quoted 44 lines · Pavel Machek
Quoted 18 lines · Matt Mackall
Quoted 5 lines · Robert
Quoted 4 lines

Sounds like you need a

#define DEFAULT_STACK_SIZE 4096

Quoted 8 lines
Quoted 1 line

Somewhere.

Or maybe something like this:

x86: remove magic number from ACPI sleep stack buffer

Quoted 19 lines
Quoted 14 lines

diff -r 375a00b8bf10 arch/x86/kernel/acpi/sleep.c

arch/x86/kernel/acpi/sleep.c +1 -1
@@ -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;
Signature · 2 lines
(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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html