From: "Yinghai Lu" <yhlu.kernel@gmail.com>
To: gregkh@suse.de
Cc: mingo@elte.hu, stable@kernel.org, stable-commits@vger.kernel.org,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: patch x86-work-around-mtrr-mask-setting.patch added to 2.6.26-stable tree
Date: Tue, 2 Sep 2008 17:54:10 -0700 [thread overview]
Message-ID: <86802c440809021754s7cd5ad5dy30a46ff65f9f2e5c@mail.gmail.com> (raw)
In-Reply-To: <20080903003208.7682214543E0@imap.suse.de>
On Tue, Sep 2, 2008 at 5:26 PM, <gregkh@suse.de> wrote:
>
> This is a note to let you know that we have just queued up the patch titled
>
> Subject: x86: work around MTRR mask setting
>
> to the 2.6.26-stable tree. Its filename is
>
> x86-work-around-mtrr-mask-setting.patch
>
> A git repo of this tree can be found at
> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>
>
> From jejb@kernel.org Tue Sep 2 17:14:12 2008
> From: Yinghai Lu <yhlu.kernel@gmail.com>
> Date: Fri, 22 Aug 2008 17:40:05 GMT
> Subject: x86: work around MTRR mask setting
> To: jejb@kernel.org, stable@kernel.org
> Message-ID: <200808221740.m7MHe5ud013727@hera.kernel.org>
>
> From: Yinghai Lu <yhlu.kernel@gmail.com>
>
> commit 38cc1c3df77c1bb739a4766788eb9fa49f16ffdf upstream
>
> Joshua Hoblitt reported that only 3 GB of his 16 GB of RAM is
> usable. Booting with mtrr_show showed us the BIOS-initialized
> MTRR settings - which are all wrong.
>
> So the root cause is that the BIOS has not set the mask correctly:
>
>> [ 0.429971] MSR00000200: 00000000d0000000
>> [ 0.433305] MSR00000201: 0000000ff0000800
>> should be ==> [ 0.433305] MSR00000201: 0000003ff0000800
>>
>> [ 0.436638] MSR00000202: 00000000e0000000
>> [ 0.439971] MSR00000203: 0000000fe0000800
>> should be ==> [ 0.439971] MSR00000203: 0000003fe0000800
>>
>> [ 0.443304] MSR00000204: 0000000000000006
>> [ 0.446637] MSR00000205: 0000000c00000800
>> should be ==> [ 0.446637] MSR00000205: 0000003c00000800
>>
>> [ 0.449970] MSR00000206: 0000000400000006
>> [ 0.453303] MSR00000207: 0000000fe0000800
>> should be ==> [ 0.453303] MSR00000207: 0000003fe0000800
>>
>> [ 0.456636] MSR00000208: 0000000420000006
>> [ 0.459970] MSR00000209: 0000000ff0000800
>> should be ==> [ 0.459970] MSR00000209: 0000003ff0000800
>
> So detect this borkage and add the prefix 111.
>
> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
>
> ---
> arch/x86/kernel/cpu/mtrr/generic.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> --- a/arch/x86/kernel/cpu/mtrr/generic.c
> +++ b/arch/x86/kernel/cpu/mtrr/generic.c
> @@ -365,6 +365,7 @@ static void generic_get_mtrr(unsigned in
> unsigned long *size, mtrr_type *type)
> {
> unsigned int mask_lo, mask_hi, base_lo, base_hi;
> + unsigned int tmp, hi;
>
> rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi);
> if ((mask_lo & 0x800) == 0) {
> @@ -378,8 +379,18 @@ static void generic_get_mtrr(unsigned in
> rdmsr(MTRRphysBase_MSR(reg), base_lo, base_hi);
>
> /* Work out the shifted address mask. */
> - mask_lo = size_or_mask | mask_hi << (32 - PAGE_SHIFT)
> - | mask_lo >> PAGE_SHIFT;
> + tmp = mask_hi << (32 - PAGE_SHIFT) | mask_lo >> PAGE_SHIFT;
> + mask_lo = size_or_mask | tmp;
> + /* Expand tmp with high bits to all 1s*/
> + hi = fls(tmp);
> + if (hi > 0) {
> + tmp |= ~((1<<(hi - 1)) - 1);
> +
> + if (tmp != mask_lo) {
> + WARN_ON("mtrr: your BIOS has set up an incorrect mask, fixing it up.\n");
> + mask_lo = tmp;
> + }
> + }
>
> /* This works correctly if size is a power of two, i.e. a
> contiguous range. */
>
>
> Patches currently in stable-queue which might be from yhlu.kernel@gmail.com are
>
> queue-2.6.26/x86-work-around-mtrr-mask-setting.patch
please put
commit 9754a5b840a209bc1f192d59f63e81b698a55ac8
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Aug 22 08:22:23 2008 +0200
x86: work around MTRR mask setting, v2
improve the debug printout:
- make it actually display something
- print it only once
would be nice to have a WARN_ONCE() facility, to feed such things to
kerneloops.org.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c
b/arch/x86/kernel/cpu/mtrr/generic.c
index 43102e0..cb7d3b6 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -401,7 +401,12 @@ static void generic_get_mtrr(unsigned int reg,
unsigned long *base,
tmp |= ~((1<<(hi - 1)) - 1);
if (tmp != mask_lo) {
- WARN_ON("mtrr: your BIOS has set up an
incorrect mask, fixing it up.\n");
+ static int once = 1;
+
+ if (once) {
+ printk(KERN_INFO "mtrr: your BIOS has
set up an incorrect mask, fixing it up.\n");
+ once = 0;
+ }
mask_lo = tmp;
}
}
into stable too....
otherwise WARN_ON will keep dump calling stack..
YH
next parent reply other threads:[~2008-09-03 0:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200808221740.m7MHe5ud013727@hera.kernel.org>
[not found] ` <20080903003208.7682214543E0@imap.suse.de>
2008-09-03 0:54 ` Yinghai Lu [this message]
2008-09-03 3:27 ` Greg KH
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=86802c440809021754s7cd5ad5dy30a46ff65f9f2e5c@mail.gmail.com \
--to=yhlu.kernel@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=stable-commits@vger.kernel.org \
--cc=stable@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
all inboxes | Powered by JetHome®