[PATCH] x86: make mtrr code could use debugpat

From: Yinghai Lu
Date: Fri Apr 03 2009 - 18:36:59 EST




Impact: cleanup

only print out get_mtrr when debugpat

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>

---
arch/x86/kernel/cpu/mtrr/generic.c | 9 ++++++---
arch/x86/kernel/cpu/mtrr/mtrr.h | 4 ++++
arch/x86/mm/pat.c | 6 +++---
3 files changed, 13 insertions(+), 6 deletions(-)

Index: linux-2.6/arch/x86/kernel/cpu/mtrr/generic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/mtrr/generic.c
+++ linux-2.6/arch/x86/kernel/cpu/mtrr/generic.c
@@ -462,9 +462,12 @@ static void generic_get_mtrr(unsigned in
*base = base_hi << (32 - PAGE_SHIFT) | base_lo >> PAGE_SHIFT;
*type = base_lo & 0xff;

- printk(KERN_DEBUG " get_mtrr: cpu%d reg%02d base=%010lx size=%010lx %s\n",
- cpu, reg, *base, *size,
- mtrr_attrib_to_str(*type & 0xff));
+#ifdef CONFIG_X86_PAT
+ if (debugpat)
+ printk(KERN_DEBUG " get_mtrr: cpu%d reg%02d base=%010lx size=%010lx %s\n",
+ cpu, reg, *base, *size,
+ mtrr_attrib_to_str(*type & 0xff));
+#endif
out_put_cpu:
put_cpu();
}
Index: linux-2.6/arch/x86/kernel/cpu/mtrr/mtrr.h
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/mtrr/mtrr.h
+++ linux-2.6/arch/x86/kernel/cpu/mtrr/mtrr.h
@@ -92,3 +92,7 @@ int centaur_init_mtrr(void);

extern int changed_by_mtrr_cleanup;
extern int mtrr_cleanup(unsigned address_bits);
+
+#if CONFIG_X86_PAT
+extern int debugpat;
+#endif
Index: linux-2.6/arch/x86/mm/pat.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/pat.c
+++ linux-2.6/arch/x86/mm/pat.c
@@ -51,17 +51,17 @@ static inline void pat_disable(const cha
#endif


-static int debug_enable;
+int debugpat;

static int __init pat_debug_setup(char *str)
{
- debug_enable = 1;
+ debugpat = 1;
return 0;
}
__setup("debugpat", pat_debug_setup);

#define dprintk(fmt, arg...) \
- do { if (debug_enable) printk(KERN_INFO fmt, ##arg); } while (0)
+ do { if (debugpat) printk(KERN_INFO fmt, ##arg); } while (0)


static u64 __read_mostly boot_pat_state;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/