Skip to contentSkip to conversation

Boot option to make memory reporting more verbose

PATCH In review George Dunlap 1 participant 2 messages Apr 28, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Boot option to make memory reporting more verbose

e820_verbose option to:
* Print BIOS-given e820 map (pre-sanitized, pre-clipped)
* Print MTRR registers as they're read
For information and debugging.

Also, when clipping, print how much we're clipping from and to, instead of just how much we're clipping to.

#1 lore raw

Forgot patch...

Quoted 10 lines · George Dunlap

e820_verbose option to:
* Print BIOS-given e820 map (pre-sanitized, pre-clipped)
* Print MTRR registers as they're read
For information and debugging.

Also, when clipping, print how much we're clipping from and to, instead of just how much we're clipping to.

xen/arch/x86/e820.c +24 -2
diff -r fdf7025207e6 xen/arch/x86/e820.c
@@ -19,6 +19,10 @@
 static int __initdata opt_no_mtrr_check = 0;
 boolean_param("nomtrr", opt_no_mtrr_check);
 
+/* opt_e820_verbose: Be verbose about clipping, the original e820, &c */
+static int __initdata opt_e820_verbose = 0;
+boolean_param("e820_verbose", opt_e820_verbose);
+
 struct e820map e820;
 
 static void __init add_memory_region(unsigned long long start,
@@ -328,6 +332,10 @@
 {
     int i;
     char _warnmsg[160];
+    int cur_limit;
+
+    i = e820.nr_map-1;
+    cur_limit = e820.map[i].addr + e820.map[i].size;
 
     for ( i = 0; i < e820.nr_map; i++ )
     {
@@ -338,8 +346,8 @@
             snprintf(_warnmsg, sizeof(_warnmsg), warnmsg, (long)(limit>>30));
             printk("WARNING: %s\n", _warnmsg);
         }
-        printk("Truncating memory map to %lukB\n",
-               (unsigned long)(limit >> 10));
+        printk("Truncating memory map from %lukB to %lukB\n",
+               (unsigned long)(cur_limit >> 10), (unsigned long)(limit >> 10));
         if ( e820.map[i].addr >= limit )
         {
             e820.nr_map = i;
@@ -361,6 +369,8 @@
     uint64_t mtrr_cap, mtrr_def, addr_mask, base, mask, top;
     unsigned int i, phys_bits = 36;
 
+    printk("Checking MTRR ranges...\n");
+
     /* Does the CPU support architectural MTRRs? */
     cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
     if ( !test_bit(X86_FEATURE_MTRR & 31, &edx) )
@@ -378,6 +388,9 @@
     rdmsrl(MSR_MTRRcap, mtrr_cap);
     rdmsrl(MSR_MTRRdefType, mtrr_def);
 
+    if ( opt_e820_verbose )
+        printk(" MTRR cap: %lx type: %lx\n", mtrr_cap, mtrr_def);
+
     /* MTRRs enabled, and default memory type is not writeback? */
     if ( !test_bit(11, &mtrr_def) || ((uint8_t)mtrr_def == MTRR_TYPE_WRBACK) )
         return 0;
@@ -391,6 +404,10 @@
     {
         rdmsrl(MSR_MTRRphysBase(i), base);
         rdmsrl(MSR_MTRRphysMask(i), mask);
+
+        if ( opt_e820_verbose )
+            printk(" MTRR[%d]: base %lx mask %lx\n", i, base, mask);
+
         if ( !test_bit(11, &mask) || ((uint8_t)base != MTRR_TYPE_WRBACK) )
             continue;
         base &= addr_mask;
@@ -550,6 +567,11 @@
 unsigned long __init init_e820(
     const char *str, struct e820entry *raw, int *raw_nr)
 {
+    if ( opt_e820_verbose )
+    {
+        printk("Initial %s RAM map:\n", str);
+        print_e820_memory_map(raw, *raw_nr);
+    }
     machine_specific_memory_setup(raw, raw_nr);
     printk("%s RAM map:\n", str);
     print_e820_memory_map(e820.map, e820.nr_map);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel