linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@myrealbox.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: luto@myrealbox.com, Andi Kleen <andi@firstfloor.org>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	public-kernel-testers-u79uwXL29TY76Z2rM5mHXA@lo.gmane.org,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	pm list <linux-pm@lists.linux-foundation.org>,
	Pavel Machek <pavel@ucw.cz>
Subject: Re: [RFT] x86 acpi: normalize segment descriptor register on resume
Date: Sat, 12 Jul 2008 16:31:00 -0400	[thread overview]
Message-ID: <48791484.4010408@myrealbox.com> (raw)
In-Reply-To: <200807122051.25634.rjw@sisk.pl>

Rafael J. Wysocki wrote:
> On Saturday, 12 of July 2008, Andy Lutomirski wrote:
>> My Lenovo X61s fails to resume if I suspend it from within X, on both 
>> 2.6.26-rc9 and recent wireless-testing.  2.6.26-rc8 is fine, as is 
>> wireless-testing with 4b4f7280 reverted.  My in-progress bisect between 
>> -rc8 and -rc9 is also consistent with this being the problem.
>>
>> The symptom is that, when I push the power button to resume, the hard 
>> drive light turns on, the fan turns on, then the hard drive light turns 
>> off, the sleep light stays on, and the fan keeps running.  Sometimes the 
>> battery light will blink off very briefly (1/4 sec, maybe) every few 
>> seconds.  The system is locked hard at this point.
>>
>> I'm using Ubuntu Hardy userspace.
> 
> Well, that's bad.
> 
> There is the bugzilla entry at http://bugzilla.kernel.org/show_bug.cgi?id=11064
> for this bug and you've just confirmed my suspicion that this particular
> commit is to blame.
> 
> Can you please see if the appended patch changes anything?

I suspended and resumed OK.  Then I rebooted and tried again, and it failed.

--Andy

> 
> Thanks,
> Rafael
> 
> ---
> From: H. Peter Anvin <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
> Date: Mon, 30 Jun 2008 23:48:35 -0700
> Subject: [PATCH] x86 acpi: on wakeup, ljmp directly after writing CR0.PE
> 
> Impact: possible resume failures on AMD Elan, others?
> 
> Intel documents that writing cr0 should be immediately followed by a
> ljmp, and that "failures are readily seen" if the processor enters SMM
> at this point.  We believe this has been observed on the AMD Elan, so
> stick strictly to the script and do an ljmp immediately after a change
> to CR0.PE in all circumstances.
> 
> Signed-off-by: H. Peter Anvin <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
> ---
>  arch/x86/kernel/acpi/realmode/wakeup.S |   11 ++++-------
>  arch/x86/kernel/acpi/realmode/wakeup.h |    6 ++----
>  arch/x86/kernel/acpi/sleep.c           |    4 +++-
>  3 files changed, 9 insertions(+), 12 deletions(-)
> 
> Index: linux-next/arch/x86/kernel/acpi/realmode/wakeup.S
> ===================================================================
> --- linux-next.orig/arch/x86/kernel/acpi/realmode/wakeup.S
> +++ linux-next/arch/x86/kernel/acpi/realmode/wakeup.S
> @@ -25,10 +25,8 @@ pmode_gdt:	.quad	0
>  realmode_flags:	.long	0
>  real_magic:	.long	0
>  trampoline_segment:	.word 0
> -_pad1:		.byte	0
> -wakeup_jmp:	.byte	0xea	/* ljmpw */
> -wakeup_jmp_off:	.word	3f
> -wakeup_jmp_seg:	.word	0
> +wakeup_seg_ptr:	.word	3f-2	/* the segment in the ljmpw */
> +_pad:		.long	0
>  wakeup_gdt:	.quad	0, 0, 0
>  signature:	.long	0x51ee1111
>  
> @@ -49,8 +47,7 @@ _start:
>  	movl	%cr0, %eax
>  	orb	$X86_CR0_PE, %al
>  	movl	%eax, %cr0
> -	jmp	1f
> -1:	ljmpw	$8, $2f
> +	ljmpw	$8, $2f
>  2:
>  	movw	%cx, %ds
>  	movw	%cx, %es
> @@ -60,7 +57,7 @@ _start:
>  
>  	andb	$~X86_CR0_PE, %al
>  	movl	%eax, %cr0
> -	jmp	wakeup_jmp
> +	ljmpw	$0, $3f
>  3:
>  	/* Set up segments */
>  	movw	%cs, %ax
> Index: linux-next/arch/x86/kernel/acpi/realmode/wakeup.h
> ===================================================================
> --- linux-next.orig/arch/x86/kernel/acpi/realmode/wakeup.h
> +++ linux-next/arch/x86/kernel/acpi/realmode/wakeup.h
> @@ -24,10 +24,8 @@ struct wakeup_header {
>  	u32 realmode_flags;
>  	u32 real_magic;
>  	u16 trampoline_segment;	/* segment with trampoline code, 64-bit only */
> -	u8  _pad1;
> -	u8  wakeup_jmp;
> -	u16 wakeup_jmp_off;
> -	u16 wakeup_jmp_seg;
> +	u16 wakeup_seg_ptr;
> +	u32 _pad;
>  	u64 wakeup_gdt[3];
>  	u32 signature;		/* To check we have correct structure */
>  } __attribute__((__packed__));
> Index: linux-next/arch/x86/kernel/acpi/sleep.c
> ===================================================================
> --- linux-next.orig/arch/x86/kernel/acpi/sleep.c
> +++ linux-next/arch/x86/kernel/acpi/sleep.c
> @@ -34,6 +34,7 @@ static char temp_stack[10240];
>  int acpi_save_state_mem(void)
>  {
>  	struct wakeup_header *header;
> +	u16 *wakeup_seg;
>  
>  	if (!acpi_realmode) {
>  		printk(KERN_ERR "Could not allocate memory during boot, "
> @@ -43,6 +44,7 @@ int acpi_save_state_mem(void)
>  	memcpy((void *)acpi_realmode, &wakeup_code_start, WAKEUP_SIZE);
>  
>  	header = (struct wakeup_header *)(acpi_realmode + HEADER_OFFSET);
> +	wakeup_seg = (u16 *)(acpi_realmode + header->wakeup_seg_ptr);
>  	if (header->signature != 0x51ee1111) {
>  		printk(KERN_ERR "wakeup header does not match\n");
>  		return -EINVAL;
> @@ -50,7 +52,7 @@ int acpi_save_state_mem(void)
>  
>  	header->video_mode = saved_video_mode;
>  
> -	header->wakeup_jmp_seg = acpi_wakeup_address >> 4;
> +	*wakeup_seg = acpi_wakeup_address >> 4;
>  	/* GDT[0]: GDT self-pointer */
>  	header->wakeup_gdt[0] =
>  		(u64)(sizeof(header->wakeup_gdt) - 1) +


  reply	other threads:[~2008-07-12 20:31 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-30 23:48 [RFT] x86 acpi: normalize segment descriptor register on resume Rafael J. Wysocki
     [not found] ` <200807010148.02135.rjw-KKrjLPT3xs0@public.gmane.org>
2008-07-01  0:05   ` H. Peter Anvin
2008-07-01  6:31   ` Ingo Molnar
     [not found]     ` <20080701063133.GC16642-X9Un+BFzKDI@public.gmane.org>
2008-07-01  6:54       ` H. Peter Anvin
2008-07-01  9:19         ` Pavel Machek
2008-07-01 20:39         ` Rafael J. Wysocki
2008-07-01 20:42           ` Andi Kleen
2008-07-01 20:50             ` Rafael J. Wysocki
2008-07-01 20:52               ` Andi Kleen
     [not found]             ` <486A96C1.2020106-Vw/NltI1exuRpAAqCnN02g@public.gmane.org>
2008-07-12  6:29               ` Andy Lutomirski
2008-07-12 12:08                 ` Andi Kleen
     [not found]                   ` <48789EC3.2070701-Vw/NltI1exuRpAAqCnN02g@public.gmane.org>
2008-07-12 15:08                     ` Andy Lutomirski
     [not found]                 ` <48784F51.1010407-YSGFQ8SKJZVDPfheJLI6IQ@public.gmane.org>
2008-07-12 18:51                   ` Rafael J. Wysocki
2008-07-12 20:31                     ` Andy Lutomirski [this message]
2008-07-12 20:47                       ` Rafael J. Wysocki
2008-07-12 20:39                     ` Andy Lutomirski
2008-07-12 20:53                       ` Rafael J. Wysocki
2008-07-12 23:11                         ` Andy Lutomirski
2008-07-12 23:33                           ` Rafael J. Wysocki
2008-07-13  8:56                             ` Pavel Machek
2008-07-13 18:16                               ` H. Peter Anvin
2008-07-14  6:36                                 ` Pavel Machek
2008-07-13  9:15                             ` Ingo Molnar
2008-07-13 12:02                               ` Matthew Garrett
2008-07-13 15:50                                 ` Andy Lutomirski
2008-07-13 18:43                                   ` Andi Kleen
2008-07-13 19:15                                     ` Rafael J. Wysocki
2008-07-13 20:11                                       ` Andi Kleen
2008-07-13 20:29                                         ` Rafael J. Wysocki
2008-07-14  2:35                                           ` H. Peter Anvin
2008-07-14 20:10                                             ` Rafael J. Wysocki
2008-07-13 20:38                                         ` H. Peter Anvin
2008-07-14  1:31                                           ` Matthew Garrett
2008-07-14  4:18                                           ` H. Peter Anvin
2008-07-14  7:39                                             ` Pavel Machek
2008-07-14 20:09                                             ` Rafael J. Wysocki
2008-07-16 14:13                                             ` Andrew Lutomirski
2008-07-16 14:23                                               ` Ingo Molnar
2008-07-13 20:16                                     ` H. Peter Anvin
2008-07-13 20:21                                       ` Andi Kleen
2008-07-13 20:32                                         ` Rafael J. Wysocki
2008-07-14  1:22                                         ` Henrique de Moraes Holschuh
2008-07-14  6:14                                           ` Pavel Machek
2008-07-14 11:22                                             ` Henrique de Moraes Holschuh
2008-07-13 18:02                                 ` Rafael J. Wysocki
2008-07-01  7:02       ` H. Peter Anvin
2008-07-01 13:01         ` Andi Kleen
2008-07-01 15:55           ` H. Peter Anvin
     [not found]             ` <486A5378.7020601-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2008-07-01 16:21               ` Andi Kleen
2008-07-01 17:28                 ` H. Peter Anvin
2008-07-01  7:20 ` Ingo Molnar
     [not found]   ` <20080701072024.GB26601-X9Un+BFzKDI@public.gmane.org>
2008-07-01  7:28     ` Andrew Morton
2008-07-01  7:45       ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2008-07-12 23:07 H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48791484.4010408@myrealbox.com \
    --to=luto@myrealbox.com \
    --cc=andi@firstfloor.org \
    --cc=hpa@zytor.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mingo@elte.hu \
    --cc=pavel@ucw.cz \
    --cc=public-kernel-testers-u79uwXL29TY76Z2rM5mHXA@lo.gmane.org \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).