patch x86-work-around-mtrr-mask-setting.patch added to 2.6.26-stable tree
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 93 lines · On Tue, Sep 2, 2008 at 5:26 PM, <[email protected]> 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=summaryFrom [email protected] Tue Sep 2 17:14:12 2008
From: Yinghai Lu <[email protected]>
Date: Fri, 22 Aug 2008 17:40:05 GMT
Subject: x86: work around MTRR mask setting
To: [email protected], [email protected]
Message-ID: <[email protected]>From: Yinghai Lu <[email protected]>
commit
38cc1c3df77c1bb739a4766788eb9fa49f16ffdfupstreamJoshua Hoblitt reported that only 3 GB of his 16 GB of RAM is usable. Booting with
mtrr_showshowed us the BIOS-initialized MTRR settings - which are all wrong.So the root cause is that the BIOS has not set the mask correctly:
Quoted 12 lines
[ 0.429971] MSR00000200: 00000000d0000000 [ 0.433305] MSR00000201: 0000000ff0000800should be ==> [ 0.433305] MSR00000201:
0000003ff0000800[ 0.436638] MSR00000202: 00000000e0000000 [ 0.439971] MSR00000203: 0000000fe0000800should be ==> [ 0.439971] MSR00000203:
0000003fe0000800[ 0.443304] MSR00000204: 0000000000000006 [ 0.446637] MSR00000205: 0000000c00000800should be ==> [ 0.446637] MSR00000205:
0000003c00000800Quoted 7 lines
[ 0.449970] MSR00000206: 0000000400000006 [ 0.453303] MSR00000207: 0000000fe0000800should be ==> [ 0.453303] MSR00000207:
0000003fe0000800[ 0.456636] MSR00000208: 0000000420000006 [ 0.459970] MSR00000209: 0000000ff0000800should be ==> [ 0.459970] MSR00000209:
0000003ff0000800So detect this borkage and add the prefix 111.
Signed-off-by Yinghai Lu <[email protected]>Signed-off-by Ingo Molnar <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/x86/kernel/cpu/mtrr/generic.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)arch/x86/kernel/cpu/mtrr/generic.c +13
-2@@ -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 inrdmsr (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. */
Quoted 3 lines
Patches currently in stable-queue which might be from [email protected] are
queue-2.6.26/x86-work-around-mtrr-mask-setting.patch
please put
commit 9754a5b840a209bc1f192d59f63e81b698a55ac8
Author: Ingo Molnar <[email protected]> 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.
(quoted diff) +0 -0
b/arch/x86/kernel/cpu/mtrr/generic.c
index 43102e0..cb7d3b6 100644
arch/x86/kernel/cpu/mtrr/generic.c +0 -0
@@ -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
Quoted 140 lines · Yinghai Lu
Quoted 93 lines · On Tue, Sep 2, 2008 at 5:26 PM, <[email protected]> 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=summaryFrom [email protected] Tue Sep 2 17:14:12 2008
From: Yinghai Lu <[email protected]>
Date: Fri, 22 Aug 2008 17:40:05 GMT
Subject: x86: work around MTRR mask setting
To: [email protected], [email protected]
Message-ID: <[email protected]>From: Yinghai Lu <[email protected]>
commit
38cc1c3df77c1bb739a4766788eb9fa49f16ffdfupstreamJoshua Hoblitt reported that only 3 GB of his 16 GB of RAM is usable. Booting with
mtrr_showshowed us the BIOS-initialized MTRR settings - which are all wrong.So the root cause is that the BIOS has not set the mask correctly:
Quoted 12 lines
[ 0.429971] MSR00000200: 00000000d0000000 [ 0.433305] MSR00000201: 0000000ff0000800should be ==> [ 0.433305] MSR00000201:
0000003ff0000800[ 0.436638] MSR00000202: 00000000e0000000 [ 0.439971] MSR00000203: 0000000fe0000800should be ==> [ 0.439971] MSR00000203:
0000003fe0000800[ 0.443304] MSR00000204: 0000000000000006 [ 0.446637] MSR00000205: 0000000c00000800should be ==> [ 0.446637] MSR00000205:
0000003c00000800Quoted 7 lines
[ 0.449970] MSR00000206: 0000000400000006 [ 0.453303] MSR00000207: 0000000fe0000800should be ==> [ 0.453303] MSR00000207:
0000003fe0000800[ 0.456636] MSR00000208: 0000000420000006 [ 0.459970] MSR00000209: 0000000ff0000800should be ==> [ 0.459970] MSR00000209:
0000003ff0000800So detect this borkage and add the prefix 111.
Signed-off-by Yinghai Lu <[email protected]>Signed-off-by Ingo Molnar <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/x86/kernel/cpu/mtrr/generic.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)arch/x86/kernel/cpu/mtrr/generic.c +13
-2@@ -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 inrdmsr (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. */ Quoted 3 lines
Patches currently in stable-queue which might be from [email protected] are
queue-2.6.26/x86-work-around-mtrr-mask-setting.patchplease put
commit
9754a5b840a209bc1f192d59f63e81b698a55ac8Author: Ingo Molnar <[email protected]> Date: Fri Aug 22 08:22:23 2008 +0200x86: work around MTRR mask setting, v2
improve the debug printout:
- make it actually display something
- print it only oncewould be nice to have a
WARN_ONCE()facility, to feed such things to kerneloops.org.Signed-off-by Ingo Molnar <[email protected]>arch/x86/kernel/cpu/mtrr/generic.c +6
-1@@ -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; } }
Quoted 2 lines
into stable too....
otherwiseWARN_ONwill keep dump calling stack..
Ok, will add it to the queue.
thanks,
greg k-h