mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Andy Whitcroft <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
9483a578df
commit
6b74ab97bc
6 changed files with 79 additions and 9 deletions
|
|
@ -59,4 +59,31 @@ static inline unsigned long page_order(struct page *page)
|
|||
#define __paginginit __init
|
||||
#endif
|
||||
|
||||
/* Memory initialisation debug and verification */
|
||||
enum mminit_level {
|
||||
MMINIT_WARNING,
|
||||
MMINIT_VERIFY,
|
||||
MMINIT_TRACE
|
||||
};
|
||||
|
||||
#ifdef CONFIG_DEBUG_MEMORY_INIT
|
||||
|
||||
extern int mminit_loglevel;
|
||||
|
||||
#define mminit_dprintk(level, prefix, fmt, arg...) \
|
||||
do { \
|
||||
if (level < mminit_loglevel) { \
|
||||
printk(level <= MMINIT_WARNING ? KERN_WARNING : KERN_DEBUG); \
|
||||
printk(KERN_CONT "mminit::" prefix " " fmt, ##arg); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
static inline void mminit_dprintk(enum mminit_level level,
|
||||
const char *prefix, const char *fmt, ...)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DEBUG_MEMORY_INIT */
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue