aboutsummaryrefslogtreecommitdiffstats
path: root/mm/internal.h
diff options
context:
space:
mode:
authorMel Gorman <mel@csn.ul.ie>2008-07-24 00:26:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:13 -0400
commit6b74ab97bc12ce74acec900f1d89a4aee2e4d70d (patch)
treed9d7b522a4a8f5f605d2e0f7f7a1bcb9d5049a82 /mm/internal.h
parent9483a578df27fe7603605d565eefe039c1ba5845 (diff)
mm: add a basic debugging framework for memory initialisation
Boot initialisation is very complex, with significant numbers of architecture-specific routines, hooks and code ordering. While significant amounts of the initialisation is architecture-independent, it trusts the data received from the architecture layer. This is a mistake, and has resulted in a number of difficult-to-diagnose bugs. This patchset adds some validation and tracing to memory initialisation. It also introduces a few basic defensive measures. The validation code can be explicitly disabled for embedded systems. This patch: Add additional debugging and verification code for memory initialisation. Once enabled, the verification checks are always run and when required additional debugging information may be outputted via a mminit_loglevel= command-line parameter. The verification code is placed in a new file mm/mm_init.c. Ideally other mm initialisation code will be moved here over time. Signed-off-by: Mel Gorman <mel@csn.ul.ie> Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Andy Whitcroft <apw@shadowen.org> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/internal.h')
-rw-r--r--mm/internal.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/mm/internal.h b/mm/internal.h
index 0034e947e4bc..a7ee05253294 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -59,4 +59,31 @@ static inline unsigned long page_order(struct page *page)
59#define __paginginit __init 59#define __paginginit __init
60#endif 60#endif
61 61
62/* Memory initialisation debug and verification */
63enum mminit_level {
64 MMINIT_WARNING,
65 MMINIT_VERIFY,
66 MMINIT_TRACE
67};
68
69#ifdef CONFIG_DEBUG_MEMORY_INIT
70
71extern int mminit_loglevel;
72
73#define mminit_dprintk(level, prefix, fmt, arg...) \
74do { \
75 if (level < mminit_loglevel) { \
76 printk(level <= MMINIT_WARNING ? KERN_WARNING : KERN_DEBUG); \
77 printk(KERN_CONT "mminit::" prefix " " fmt, ##arg); \
78 } \
79} while (0)
80
81#else
82
83static inline void mminit_dprintk(enum mminit_level level,
84 const char *prefix, const char *fmt, ...)
85{
86}
87
88#endif /* CONFIG_DEBUG_MEMORY_INIT */
62#endif 89#endif