* Re: patch x86-work-around-mtrr-mask-setting.patch added to 2.6.26-stable tree [not found] ` <20080903003208.7682214543E0@imap.suse.de> @ 2008-09-03 0:54 ` Yinghai Lu 2008-09-03 3:27 ` Greg KH 0 siblings, 1 reply; 2+ messages in thread From: Yinghai Lu @ 2008-09-03 0:54 UTC (permalink / raw) To: gregkh; +Cc: mingo, stable, stable-commits, Linux Kernel Mailing List 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 ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: patch x86-work-around-mtrr-mask-setting.patch added to 2.6.26-stable tree 2008-09-03 0:54 ` patch x86-work-around-mtrr-mask-setting.patch added to 2.6.26-stable tree Yinghai Lu @ 2008-09-03 3:27 ` Greg KH 0 siblings, 0 replies; 2+ messages in thread From: Greg KH @ 2008-09-03 3:27 UTC (permalink / raw) To: Yinghai Lu; +Cc: mingo, stable, stable-commits, Linux Kernel Mailing List On Tue, Sep 02, 2008 at 05:54:10PM -0700, Yinghai Lu wrote: > 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.. Ok, will add it to the queue. thanks, greg k-h ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-03 3:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200808221740.m7MHe5ud013727@hera.kernel.org>
[not found] ` <20080903003208.7682214543E0@imap.suse.de>
2008-09-03 0:54 ` patch x86-work-around-mtrr-mask-setting.patch added to 2.6.26-stable tree Yinghai Lu
2008-09-03 3:27 ` Greg KH
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome