Commit bb577f98 authored by Hugh Dickins's avatar Hugh Dickins Committed by Ingo Molnar

x86: add periodic corruption check

Perodically check for corruption in low phusical memory.  Don't bother
checking at fault time, since it won't show anything useful.
Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 5394f80f
...@@ -623,6 +623,7 @@ static void __init setup_bios_corruption_check(void) ...@@ -623,6 +623,7 @@ static void __init setup_bios_corruption_check(void)
} }
static int __read_mostly bios_corruption_check = 1; static int __read_mostly bios_corruption_check = 1;
static struct timer_list periodic_check_timer;
void check_for_bios_corruption(void) void check_for_bios_corruption(void)
{ {
...@@ -650,6 +651,22 @@ void check_for_bios_corruption(void) ...@@ -650,6 +651,22 @@ void check_for_bios_corruption(void)
dump_stack(); dump_stack();
} }
static void periodic_check_for_corruption(unsigned long data)
{
check_for_bios_corruption();
mod_timer(&periodic_check_timer, jiffies + 60*HZ);
}
void start_periodic_check_for_corruption(void)
{
if (!bios_corruption_check)
return;
init_timer(&periodic_check_timer);
periodic_check_timer.function = &periodic_check_for_corruption;
periodic_check_for_corruption(0);
}
static int set_bios_corruption_check(char *arg) static int set_bios_corruption_check(char *arg)
{ {
char *end; char *end;
......
...@@ -848,8 +848,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) ...@@ -848,8 +848,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
* Oops. The kernel tried to access some bad page. We'll have to * Oops. The kernel tried to access some bad page. We'll have to
* terminate things with extreme prejudice. * terminate things with extreme prejudice.
*/ */
check_for_bios_corruption();
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
bust_spinlocks(1); bust_spinlocks(1);
#else #else
......
...@@ -907,6 +907,8 @@ void __init mem_init(void) ...@@ -907,6 +907,8 @@ void __init mem_init(void)
int codesize, reservedpages, datasize, initsize; int codesize, reservedpages, datasize, initsize;
int tmp; int tmp;
start_periodic_check_for_corruption();
#ifdef CONFIG_FLATMEM #ifdef CONFIG_FLATMEM
BUG_ON(!mem_map); BUG_ON(!mem_map);
#endif #endif
......
...@@ -769,6 +769,8 @@ void __init mem_init(void) ...@@ -769,6 +769,8 @@ void __init mem_init(void)
{ {
long codesize, reservedpages, datasize, initsize; long codesize, reservedpages, datasize, initsize;
start_periodic_check_for_corruption();
pci_iommu_alloc(); pci_iommu_alloc();
/* clear_bss() already clear the empty_zero_page */ /* clear_bss() already clear the empty_zero_page */
......
...@@ -246,6 +246,7 @@ extern int root_mountflags; ...@@ -246,6 +246,7 @@ extern int root_mountflags;
* able to scatter it around anywhere in the kernel. * able to scatter it around anywhere in the kernel.
*/ */
void check_for_bios_corruption(void); void check_for_bios_corruption(void);
void start_periodic_check_for_corruption(void);
#else #else
static inline void check_for_bios_corruption(void) static inline void check_for_bios_corruption(void)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment