All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] PM: x86-64 suspend-resume fix
@ 2009-02-15 21:44 Rafael J. Wysocki
  2009-02-15 21:45 ` [PATCH 1/2] x86_64: acpi/wakeup_64 cleanup Rafael J. Wysocki
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2009-02-15 21:44 UTC (permalink / raw)
  To: Len Brown
  Cc: Jiri Slaby, Cyrill Gorcunov, Pavel Machek, Ingo Molnar, LKML,
	pm list, ACPI Devel Maling List

Hi,

The following two patches clean-up and fix the x86-64 resume code.

1/2 is a cleanup, but it is simple enough to be applied now IMO.

2/2 is a bug fix based on 1/2, which is 2.6.29 material.

Please apply them to the suspend branch and push to Linus for 2.6.29 (Ingo
says he doesn't mind if they go through your tree).

Thanks,
Rafael


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

* [PATCH 1/2] x86_64: acpi/wakeup_64 cleanup
  2009-02-15 21:44 [PATCH 0/2] PM: x86-64 suspend-resume fix Rafael J. Wysocki
  2009-02-15 21:45 ` [PATCH 1/2] x86_64: acpi/wakeup_64 cleanup Rafael J. Wysocki
@ 2009-02-15 21:45 ` Rafael J. Wysocki
  2009-02-15 21:46 ` [PATCH 2/2] x86_64: Fix S3 fail path Rafael J. Wysocki
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2009-02-15 21:45 UTC (permalink / raw)
  To: Len Brown
  Cc: Jiri Slaby, Cyrill Gorcunov, Pavel Machek, Ingo Molnar, LKML,
	pm list, ACPI Devel Maling List

From: Jiri Slaby <jirislaby@gmail.com>

- remove %ds re-set, it's already set in wakeup_long64
- remove double labels and alignment (ENTRY already adds both)
- use meaningful resume point labelname
- skip alignment while jumping from wakeup_long64 to the resume point
- remove .size, .type and unused labels
[v2]
- added ENDPROCs

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/x86/kernel/acpi/wakeup_64.S |   26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

Index: linux-2.6/arch/x86/kernel/acpi/wakeup_64.S
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/wakeup_64.S
+++ linux-2.6/arch/x86/kernel/acpi/wakeup_64.S
@@ -13,7 +13,6 @@
 	 * Hooray, we are in Long 64-bit mode (but still running in low memory)
 	 */
 ENTRY(wakeup_long64)
-wakeup_long64:
 	movq	saved_magic, %rax
 	movq	$0x123456789abcdef0, %rdx
 	cmpq	%rdx, %rax
@@ -34,16 +33,12 @@ wakeup_long64:
 
 	movq	saved_rip, %rax
 	jmp	*%rax
+ENDPROC(wakeup_long64)
 
 bogus_64_magic:
 	jmp	bogus_64_magic
 
-	.align 2
-	.p2align 4,,15
-.globl do_suspend_lowlevel
-	.type	do_suspend_lowlevel,@function
-do_suspend_lowlevel:
-.LFB5:
+ENTRY(do_suspend_lowlevel)
 	subq	$8, %rsp
 	xorl	%eax, %eax
 	call	save_processor_state
@@ -67,7 +62,7 @@ do_suspend_lowlevel:
 	pushfq
 	popq	pt_regs_flags(%rax)
 
-	movq	$.L97, saved_rip(%rip)
+	movq	$resume_point, saved_rip(%rip)
 
 	movq	%rsp, saved_rsp
 	movq	%rbp, saved_rbp
@@ -79,13 +74,9 @@ do_suspend_lowlevel:
 	movl	$3, %edi
 	xorl	%eax, %eax
 	jmp	acpi_enter_sleep_state
-.L97:
-	.p2align 4,,7
-.L99:
-	.align 4
-	movl	$24, %eax
-	movw	%ax, %ds
 
+	.align 4
+resume_point:
 	/* We don't restore %rax, it must be 0 anyway */
 	movq	$saved_context, %rax
 	movq	saved_context_cr4(%rax), %rbx
@@ -117,12 +108,9 @@ do_suspend_lowlevel:
 	xorl	%eax, %eax
 	addq	$8, %rsp
 	jmp	restore_processor_state
-.LFE5:
-.Lfe5:
-	.size	do_suspend_lowlevel, .Lfe5-do_suspend_lowlevel
-	
+ENDPROC(do_suspend_lowlevel)
+
 .data
-ALIGN
 ENTRY(saved_rbp)	.quad	0
 ENTRY(saved_rsi)	.quad	0
 ENTRY(saved_rdi)	.quad	0

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

* [PATCH 1/2] x86_64: acpi/wakeup_64 cleanup
  2009-02-15 21:44 [PATCH 0/2] PM: x86-64 suspend-resume fix Rafael J. Wysocki
@ 2009-02-15 21:45 ` Rafael J. Wysocki
  2009-02-15 21:45 ` Rafael J. Wysocki
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2009-02-15 21:45 UTC (permalink / raw)
  To: Len Brown
  Cc: Jiri Slaby, LKML, ACPI Devel Maling List, Cyrill Gorcunov,
	Ingo Molnar, pm list

From: Jiri Slaby <jirislaby@gmail.com>

- remove %ds re-set, it's already set in wakeup_long64
- remove double labels and alignment (ENTRY already adds both)
- use meaningful resume point labelname
- skip alignment while jumping from wakeup_long64 to the resume point
- remove .size, .type and unused labels
[v2]
- added ENDPROCs

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/x86/kernel/acpi/wakeup_64.S |   26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

Index: linux-2.6/arch/x86/kernel/acpi/wakeup_64.S
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/wakeup_64.S
+++ linux-2.6/arch/x86/kernel/acpi/wakeup_64.S
@@ -13,7 +13,6 @@
 	 * Hooray, we are in Long 64-bit mode (but still running in low memory)
 	 */
 ENTRY(wakeup_long64)
-wakeup_long64:
 	movq	saved_magic, %rax
 	movq	$0x123456789abcdef0, %rdx
 	cmpq	%rdx, %rax
@@ -34,16 +33,12 @@ wakeup_long64:
 
 	movq	saved_rip, %rax
 	jmp	*%rax
+ENDPROC(wakeup_long64)
 
 bogus_64_magic:
 	jmp	bogus_64_magic
 
-	.align 2
-	.p2align 4,,15
-.globl do_suspend_lowlevel
-	.type	do_suspend_lowlevel,@function
-do_suspend_lowlevel:
-.LFB5:
+ENTRY(do_suspend_lowlevel)
 	subq	$8, %rsp
 	xorl	%eax, %eax
 	call	save_processor_state
@@ -67,7 +62,7 @@ do_suspend_lowlevel:
 	pushfq
 	popq	pt_regs_flags(%rax)
 
-	movq	$.L97, saved_rip(%rip)
+	movq	$resume_point, saved_rip(%rip)
 
 	movq	%rsp, saved_rsp
 	movq	%rbp, saved_rbp
@@ -79,13 +74,9 @@ do_suspend_lowlevel:
 	movl	$3, %edi
 	xorl	%eax, %eax
 	jmp	acpi_enter_sleep_state
-.L97:
-	.p2align 4,,7
-.L99:
-	.align 4
-	movl	$24, %eax
-	movw	%ax, %ds
 
+	.align 4
+resume_point:
 	/* We don't restore %rax, it must be 0 anyway */
 	movq	$saved_context, %rax
 	movq	saved_context_cr4(%rax), %rbx
@@ -117,12 +108,9 @@ do_suspend_lowlevel:
 	xorl	%eax, %eax
 	addq	$8, %rsp
 	jmp	restore_processor_state
-.LFE5:
-.Lfe5:
-	.size	do_suspend_lowlevel, .Lfe5-do_suspend_lowlevel
-	
+ENDPROC(do_suspend_lowlevel)
+
 .data
-ALIGN
 ENTRY(saved_rbp)	.quad	0
 ENTRY(saved_rsi)	.quad	0
 ENTRY(saved_rdi)	.quad	0

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

* [PATCH 2/2] x86_64: Fix S3 fail path
  2009-02-15 21:44 [PATCH 0/2] PM: x86-64 suspend-resume fix Rafael J. Wysocki
                   ` (2 preceding siblings ...)
  2009-02-15 21:46 ` [PATCH 2/2] x86_64: Fix S3 fail path Rafael J. Wysocki
@ 2009-02-15 21:46 ` Rafael J. Wysocki
  2009-02-21  4:46 ` [PATCH 0/2] PM: x86-64 suspend-resume fix Len Brown
  2009-02-21  4:46 ` Len Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2009-02-15 21:46 UTC (permalink / raw)
  To: Len Brown
  Cc: Jiri Slaby, Cyrill Gorcunov, Pavel Machek, Ingo Molnar, LKML,
	pm list, ACPI Devel Maling List

From: Jiri Slaby <jirislaby@gmail.com>

As acpi_enter_sleep_state can fail, take this into account in
do_suspend_lowlevel and don't return to the do_suspend_lowlevel's
caller. This would break (currently) fpu status and preempt count.

Technically, this means use `call' instead of `jmp' and `jmp' to
the `resume_point' after the `call' (i.e. if
acpi_enter_sleep_state returns=fails). `resume_point' will handle
the restore of fpu and preempt count gracefully.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/x86/kernel/acpi/wakeup_64.S |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6/arch/x86/kernel/acpi/wakeup_64.S
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/wakeup_64.S
+++ linux-2.6/arch/x86/kernel/acpi/wakeup_64.S
@@ -73,7 +73,9 @@ ENTRY(do_suspend_lowlevel)
 	addq	$8, %rsp
 	movl	$3, %edi
 	xorl	%eax, %eax
-	jmp	acpi_enter_sleep_state
+	call	acpi_enter_sleep_state
+	/* in case something went wrong, restore the machine status and go on */
+	jmp	resume_point
 
 	.align 4
 resume_point:

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

* [PATCH 2/2] x86_64: Fix S3 fail path
  2009-02-15 21:44 [PATCH 0/2] PM: x86-64 suspend-resume fix Rafael J. Wysocki
  2009-02-15 21:45 ` [PATCH 1/2] x86_64: acpi/wakeup_64 cleanup Rafael J. Wysocki
  2009-02-15 21:45 ` Rafael J. Wysocki
@ 2009-02-15 21:46 ` Rafael J. Wysocki
  2009-02-15 21:46 ` Rafael J. Wysocki
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2009-02-15 21:46 UTC (permalink / raw)
  To: Len Brown
  Cc: Jiri Slaby, LKML, ACPI Devel Maling List, Cyrill Gorcunov,
	Ingo Molnar, pm list

From: Jiri Slaby <jirislaby@gmail.com>

As acpi_enter_sleep_state can fail, take this into account in
do_suspend_lowlevel and don't return to the do_suspend_lowlevel's
caller. This would break (currently) fpu status and preempt count.

Technically, this means use `call' instead of `jmp' and `jmp' to
the `resume_point' after the `call' (i.e. if
acpi_enter_sleep_state returns=fails). `resume_point' will handle
the restore of fpu and preempt count gracefully.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/x86/kernel/acpi/wakeup_64.S |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6/arch/x86/kernel/acpi/wakeup_64.S
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/wakeup_64.S
+++ linux-2.6/arch/x86/kernel/acpi/wakeup_64.S
@@ -73,7 +73,9 @@ ENTRY(do_suspend_lowlevel)
 	addq	$8, %rsp
 	movl	$3, %edi
 	xorl	%eax, %eax
-	jmp	acpi_enter_sleep_state
+	call	acpi_enter_sleep_state
+	/* in case something went wrong, restore the machine status and go on */
+	jmp	resume_point
 
 	.align 4
 resume_point:

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

* Re: [PATCH 0/2] PM: x86-64 suspend-resume fix
  2009-02-15 21:44 [PATCH 0/2] PM: x86-64 suspend-resume fix Rafael J. Wysocki
                   ` (3 preceding siblings ...)
  2009-02-15 21:46 ` Rafael J. Wysocki
@ 2009-02-21  4:46 ` Len Brown
  2009-02-21  4:46 ` Len Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Len Brown @ 2009-02-21  4:46 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Jiri Slaby, Cyrill Gorcunov, Pavel Machek, Ingo Molnar, LKML,
	pm list, ACPI Devel Maling List


On Sun, 15 Feb 2009, Rafael J. Wysocki wrote:

> Hi,
> 
> The following two patches clean-up and fix the x86-64 resume code.
> 
> 1/2 is a cleanup, but it is simple enough to be applied now IMO.
> 
> 2/2 is a bug fix based on 1/2, which is 2.6.29 material.
> 
> Please apply them to the suspend branch and push to Linus for 2.6.29 (Ingo
> says he doesn't mind if they go through your tree).

1 & 2 applied to suspend branch.

thanks,
Len Brown, Intel Open Source Technology Center

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

* Re: [PATCH 0/2] PM: x86-64 suspend-resume fix
  2009-02-15 21:44 [PATCH 0/2] PM: x86-64 suspend-resume fix Rafael J. Wysocki
                   ` (4 preceding siblings ...)
  2009-02-21  4:46 ` [PATCH 0/2] PM: x86-64 suspend-resume fix Len Brown
@ 2009-02-21  4:46 ` Len Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Len Brown @ 2009-02-21  4:46 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Jiri Slaby, LKML, ACPI Devel Maling List, Cyrill Gorcunov,
	Ingo Molnar, pm list


On Sun, 15 Feb 2009, Rafael J. Wysocki wrote:

> Hi,
> 
> The following two patches clean-up and fix the x86-64 resume code.
> 
> 1/2 is a cleanup, but it is simple enough to be applied now IMO.
> 
> 2/2 is a bug fix based on 1/2, which is 2.6.29 material.
> 
> Please apply them to the suspend branch and push to Linus for 2.6.29 (Ingo
> says he doesn't mind if they go through your tree).

1 & 2 applied to suspend branch.

thanks,
Len Brown, Intel Open Source Technology Center

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

end of thread, other threads:[~2009-02-21  4:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-15 21:44 [PATCH 0/2] PM: x86-64 suspend-resume fix Rafael J. Wysocki
2009-02-15 21:45 ` [PATCH 1/2] x86_64: acpi/wakeup_64 cleanup Rafael J. Wysocki
2009-02-15 21:45 ` Rafael J. Wysocki
2009-02-15 21:46 ` [PATCH 2/2] x86_64: Fix S3 fail path Rafael J. Wysocki
2009-02-15 21:46 ` Rafael J. Wysocki
2009-02-21  4:46 ` [PATCH 0/2] PM: x86-64 suspend-resume fix Len Brown
2009-02-21  4:46 ` Len Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.