linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: "Christian Sünkenberg" <christian.suenkenberg@student.kit.edu>
Cc: Jonas Heinrich <onny@project-insanity.org>,
	"len.brown@intel.com" <len.brown@intel.com>,
	"pavel@ucw.cz" <pavel@ucw.cz>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"x86@kernel.org" <x86@kernel.org>, "rjw@sisk.pl" <rjw@sisk.pl>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Subject: Re: [Bisected] 3.7-rc1 can't resume (still present in 3.9)
Date: Wed, 10 Jul 2013 16:57:19 -0700	[thread overview]
Message-ID: <51DDF4DF.4000902@zytor.com> (raw)
In-Reply-To: <51DDC972.3010005@student.kit.edu>

[-- Attachment #1: Type: text/plain, Size: 1463 bytes --]

On 07/10/2013 01:52 PM, Christian Sünkenberg wrote:
> Hello,
> 
> On 05/01/2013 07:33 PM, H. Peter Anvin wrote:
>> On 05/01/2013 10:01 AM, Jonas Heinrich wrote:
>>> Hello, I tried the newest kernel, 3.9 today but the bug is still
>>> present. Applying the attached patch solves the bug for me.
>>>
>>> Best regards, Jonas Heinrich
>>
>> Okay... WTF is going on here?  Does pmode_behavior just not get set up
>> correctly?  Since it seems you can get it to wake up with your patch,
>> perhaps we can get read out the value of pmode_behavior and print it...
> 
> indeed, arch/x86/kernel/acpi/sleep.c tries an rdmsr_safe(MSR_EFER, ...)
> and sets WAKEUP_BEHAVIOR_RESTORE_EFER bit on success, however,
> on 90 nm Pentium M (Family 6, Model 13), reading an invalid MSR
> is not guaranteed to trap, see Erratum X4 in "Intel® Pentium® M
> Processor on 90 nm Process with 2-MB L2 Cache and Intel® Processor A100
> and A110 on 90 nm process with 512-KB L2 Cache Specification Update".
> On Jonas' T43, which has an affected Pentium M without EFER,
> rdmsr_safe(MSR_EFER, ...) succeeds and WAKEUP_BEHAVIOR_RESTORE_EFER
> gets set, while on resume the corresponding wrmsr traps and thus resume
> fails.
> 
> The pre-3.7 code snippet incidentally catched this by not restoring
> EFER when it would be restored to all 0s.
> 

That does seem like a reasonable explanation.

Does this patch fix the problem?  (Comment blatantly ripped off from
your email message.)

	-hpa



[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 1003 bytes --]

diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index b44577b..927c5ce 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -48,9 +48,20 @@ int acpi_suspend_lowlevel(void)
 #ifndef CONFIG_64BIT
 	native_store_gdt((struct desc_ptr *)&header->pmode_gdt);
 
+	/*
+	 * We have to check that we can write back the value, and not
+	 * just read it.  At least on 90 nm Pentium M (Family 6, Model
+	 * 13), reading an invalid MSR is not guaranteed to trap, see
+	 * Erratum X4 in "Intel Pentium M Processor on 90 nm Process
+	 * with 2-MB L2 Cache and Intel® Processor A100 and A110 on 90
+	 * nm process with 512-KB L2 Cache Specification Update".
+	 */
 	if (!rdmsr_safe(MSR_EFER,
 			&header->pmode_efer_low,
-			&header->pmode_efer_high))
+			&header->pmode_efer_high) &&
+	    !wrmsr_safe(MSR_EFER,
+			header->pmode_efer_low,
+			header->pmode_efer_high))
 		header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_EFER);
 #endif /* !CONFIG_64BIT */
 

  reply	other threads:[~2013-07-10 23:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-18 15:54 [Bisected] 3.7-rc1 can't resume Jonas Heinrich
2013-02-18 16:21 ` H. Peter Anvin
2013-02-23 13:18   ` Jonas Heinrich
2013-02-23 21:54     ` H. Peter Anvin
     [not found]       ` <20130320143257.GA473@onny>
2013-05-01 17:01         ` [Bisected] 3.7-rc1 can't resume (still present in 3.9) Jonas Heinrich
2013-05-01 17:33           ` H. Peter Anvin
2013-05-01 18:51             ` Jonas Heinrich
2013-05-01 18:55               ` H. Peter Anvin
2013-05-02  0:45                 ` Rafael J. Wysocki
2013-05-02 20:32                   ` Jonas Heinrich
2013-05-02 23:29                     ` Rafael J. Wysocki
2013-05-03 11:07                       ` Jonas Heinrich
2013-05-03 11:37                         ` Rafael J. Wysocki
2013-05-28 21:36                           ` Rafael J. Wysocki
2013-05-03 12:15                         ` Jarkko Sakkinen
2013-07-08  9:50                           ` Jonas Heinrich
2013-07-08 13:05                             ` Rafael J. Wysocki
2013-07-15 21:11                               ` H. Peter Anvin
2013-07-10 20:52             ` Christian Sünkenberg
2013-07-10 23:57               ` H. Peter Anvin [this message]
2013-07-12 23:36                 ` Christian Sünkenberg
2013-07-12 23:45                   ` 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=51DDF4DF.4000902@zytor.com \
    --to=hpa@zytor.com \
    --cc=christian.suenkenberg@student.kit.edu \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=onny@project-insanity.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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).