mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yinghai Lu" <yhlu.kernel@gmail.com>
To: "Andrew Morton" <akpm@linux-foundation.org>
Cc: bugme-daemon@bugzilla.kernel.org, linux-kernel@vger.kernel.org,
	j_kernel@hoblitt.com
Subject: Re: [Bug 11388] New: 2.6.27-rc3 warns about MTRR range; only 3 of 16gb of memory is usable
Date: Wed, 20 Aug 2008 18:49:11 -0700	[thread overview]
Message-ID: <86802c440808201849k6665c395x5a5b871eca55addd@mail.gmail.com> (raw)
In-Reply-To: <86802c440808201820w6c684a10y2f1d0f70a344a14a@mail.gmail.com>

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

On Wed, Aug 20, 2008 at 6:20 PM, Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> On Wed, Aug 20, 2008 at 6:04 PM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
>>
>> (switched to email.  Please respond via emailed reply-to-all, not via the
>> bugzilla web interface).
>>
>> On Wed, 20 Aug 2008 17:38:59 -0700 (PDT)
>> bugme-daemon@bugzilla.kernel.org wrote:
>>
>>> http://bugzilla.kernel.org/show_bug.cgi?id=11388
>>>
>>>            Summary: 2.6.27-rc3 warns about MTRR range; only 3 of 16gb of
>>>                     memory is usable
>>>            Product: Memory Management
>>>            Version: 2.5
>>>      KernelVersion: 2.6.27-rc3
>>>           Platform: All
>>>         OS/Version: Linux
>>>               Tree: Mainline
>>>             Status: NEW
>>>           Severity: normal
>>>           Priority: P1
>>>          Component: MTTR
>>>         AssignedTo: akpm@osdl.org
>>>         ReportedBy: j_kernel@hoblitt.com
>>>
>>>
>>> Latest working kernel version: 2.4.24.2 (possibly later)
>>> Earliest failing kernel version: 2.6.27-rc3-21328-ga7f5aaf (from netdev-2.6)
>>> Distribution: Gentoo
>>> Hardware Environment: 2x Intel X5482
>>> Software Environment:
>>> Problem Description:
>>>
>>> [    0.000000] WARNING: BIOS bug: CPU MTRRs don't cover all of memory, losing
>>> 13056MB of RAM.
>>> [    0.000000] ------------[ cut here ]------------
>>> [    0.000000] WARNING: at arch/x86/kernel/cpu/mtrr/main.c:1561
>>> mtrr_trim_uncached_memory+0x508/0x550()
>>> [    0.000000] Modules linked in:
>>> [    0.000000] Pid: 0, comm: swapper Not tainted 2.6.27-rc3-21328-ga7f5aaf #8
>>> [    0.000000]
>>> [    0.000000] Call Trace:
>>> [    0.000000]  [<ffffffff80234c3e>] warn_on_slowpath+0x51/0x77
>>> [    0.000000]  [<ffffffff8023570a>] printk+0x4e/0x56
>>> [    0.000000]  [<ffffffff803add02>] sort+0xfa/0x18c
>>> [    0.000000]  [<ffffffff808283d3>] cmp_range+0x0/0x6
>>> [    0.000000]  [<ffffffff80828a47>] mtrr_trim_uncached_memory+0x508/0x550
>>> [    0.000000]  [<ffffffff802178e1>] post_set+0x20/0x3d
>>> [    0.000000]  [<ffffffff80824f99>] setup_arch+0x39d/0x6be
>>> [    0.000000]  [<ffffffff8081e962>] start_kernel+0x74/0x341
>>> [    0.000000]  [<ffffffff8081e394>] x86_64_start_kernel+0xe3/0xe7
>>> [    0.000000]
>>> [    0.000000] ---[ end trace 4eaa2a86a8e2da22 ]---
>>>
>>>
>>> Steps to reproduce:
>>>
>>> This warning isn't present under 2.6.24.2 and the full range of physical memory
>>> is usable.
>>
>> Looks like a post-2.6.26 regression caused by
>> 12031a624af7816ec7660b82be648aa3703b4ebe.
> reg00: base=0xd0000000 (3328MB), size=196864MB: uncachable, count=1
> reg01: base=0xe0000000 (3584MB), size=197120MB: uncachable, count=1
> reg02: base=0x00000000 (   0MB), size=212992MB: write-back, count=1
> reg03: base=0x400000000 (16384MB), size=197120MB: write-back, count=1
> reg04: base=0x420000000 (16896MB), size=196864MB: write-back, count=1
>
> the size mtrr looks crazy.

please apply attached patch and boot with show_msr=1 to dump the msr
(including mtrr)

YH

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: debug_extra_print_out_msr_x.patch --]
[-- Type: text/x-patch; name=debug_extra_print_out_msr_x.patch, Size: 3059 bytes --]

[PATCH] x86_64: printout msr

commandline show_msr=1 for bsp, show_msr=32 for all 32 cpus.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/x86/kernel/cpu/common_64.c |   46 ++++++++++++++++++++++++++++++++++++++++
 include/asm-x86/msr.h           |   23 ++++++++++++++++++++
 2 files changed, 69 insertions(+)

Index: linux-2.6/arch/x86/kernel/cpu/common_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/common_64.c
+++ linux-2.6/arch/x86/kernel/cpu/common_64.c
@@ -430,6 +430,49 @@ static __init int setup_noclflush(char *
 }
 __setup("noclflush", setup_noclflush);
 
+struct msr_range {
+	unsigned min;
+	unsigned max;
+};
+
+static struct msr_range msr_range_array[] __cpuinitdata = {
+	{ 0x00000000, 0x00000418},
+	{ 0xc0000000, 0xc000040b},
+	{ 0xc0010000, 0xc0010142},
+	{ 0xc0011000, 0xc001103b},
+};
+
+static void __cpuinit print_cpu_msr(void)
+{
+	unsigned index;
+	u64 val;
+	int i;
+	unsigned index_min, index_max;
+
+	for (i = 0; i < ARRAY_SIZE(msr_range_array); i++) {
+		index_min = msr_range_array[i].min;
+		index_max = msr_range_array[i].max;
+		for (index = index_min; index < index_max; index++) {
+			if (rdmsrl_amd_safe(index, &val))
+				continue;
+			printk(KERN_INFO " MSR%08x: %016llx\n", index, val);
+		}
+	}
+}
+
+static int show_msr __cpuinitdata;
+static __init int setup_show_msr(char *arg)
+{
+	int num;
+
+	get_option(&arg, &num);
+
+	if (num > 0)
+		show_msr = num;
+	return 1;
+}
+__setup("show_msr=", setup_show_msr);
+
 void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
 {
 	if (c->x86_model_id[0])
@@ -439,6 +482,9 @@ void __cpuinit print_cpu_info(struct cpu
 		printk(KERN_CONT " stepping %02x\n", c->x86_mask);
 	else
 		printk(KERN_CONT "\n");
+
+	if (c->cpu_index < show_msr)
+		print_cpu_msr();
 }
 
 static __init int setup_disablecpuid(char *arg)
Index: linux-2.6/include/asm-x86/msr.h
===================================================================
--- linux-2.6.orig/include/asm-x86/msr.h
+++ linux-2.6/include/asm-x86/msr.h
@@ -63,6 +63,22 @@ static inline unsigned long long native_
 	return EAX_EDX_VAL(val, low, high);
 }
 
+static inline unsigned long long native_read_msr_amd_safe(unsigned int msr,
+						      int *err)
+{
+	DECLARE_ARGS(val, low, high);
+
+	asm volatile("2: rdmsr ; xor %0,%0\n"
+		     "1:\n\t"
+		     ".section .fixup,\"ax\"\n\t"
+		     "3:  mov %3,%0 ; jmp 1b\n\t"
+		     ".previous\n\t"
+		     _ASM_EXTABLE(2b, 3b)
+		     : "=r" (*err), EAX_EDX_RET(val, low, high)
+		     : "c" (msr), "D" (0x9c5a203a), "i" (-EFAULT));
+	return EAX_EDX_VAL(val, low, high);
+}
+
 static inline void native_write_msr(unsigned int msr,
 				    unsigned low, unsigned high)
 {
@@ -158,6 +174,13 @@ static inline int rdmsrl_safe(unsigned m
 	*p = native_read_msr_safe(msr, &err);
 	return err;
 }
+static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
+{
+	int err;
+
+	*p = native_read_msr_amd_safe(msr, &err);
+	return err;
+}
 
 #define rdtscl(low)						\
 	((low) = (u32)native_read_tsc())

  reply	other threads:[~2008-08-21  1:49 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-11388-27@http.bugzilla.kernel.org/>
2008-08-21  1:04 ` Andrew Morton
2008-08-21  1:20   ` Yinghai Lu
2008-08-21  1:49     ` Yinghai Lu [this message]
2008-08-21 11:44       ` Ingo Molnar
2008-08-21 11:56         ` Ingo Molnar
2008-08-21 15:39           ` Yinghai Lu
2008-08-22  3:51             ` Ingo Molnar
2008-08-22  4:45               ` Yinghai Lu
2008-08-21 20:55       ` Joshua Hoblitt
2008-08-21 21:51         ` Yinghai Lu
2008-08-21 23:33           ` Joshua Hoblitt
2008-08-22  0:10             ` Joshua Hoblitt
2008-08-22  0:28               ` Yinghai Lu
2008-08-22  0:29                 ` Joshua Hoblitt
2008-08-22  1:00                   ` Joshua Hoblitt
2008-08-22  1:10                     ` Joshua Hoblitt
2008-08-22  1:55                       ` Yinghai Lu
2008-08-22  2:15                         ` Joshua Hoblitt
2008-08-22  2:26                           ` Yinghai Lu
2008-08-22  3:24                             ` Yinghai Lu
2008-08-22  3:50                               ` Ingo Molnar
2008-08-22  3:56                                 ` Ingo Molnar
2008-08-22  4:48                                   ` Yinghai Lu
2008-08-23  0:22                                     ` Joshua Hoblitt
2008-08-23  5:52                                       ` Yinghai Lu
2008-08-23 10:43                                         ` Ingo Molnar
2008-08-26  8:35                                           ` Joshua Hoblitt
2008-08-26  8:42                                             ` Ingo Molnar
2008-08-25 21:43                                   ` Joshua Hoblitt
2008-08-22  6:16                                 ` Yinghai Lu
2008-08-22  6:24                                   ` Ingo Molnar
2008-08-23 23:53                                     ` Arjan van de Ven
2008-08-25  9:17                                       ` Ingo Molnar
2008-08-22  3:26                             ` Joshua Hoblitt

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=86802c440808201849k6665c395x5a5b871eca55addd@mail.gmail.com \
    --to=yhlu.kernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bugme-daemon@bugzilla.kernel.org \
    --cc=j_kernel@hoblitt.com \
    --cc=linux-kernel@vger.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®