Commit 304e629b authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Ingo Molnar

x86: corruption check: run the corruption checks from a work queue

Impact: change the implementation of the debug feature

the periodic corruption checks are better off run from a work queue; there's
nothing time critical about them and this way the amount of
interrupt-context work is reduced.
Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 6784f7d0
#include <linux/module.h> #include <linux/module.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/workqueue.h>
#include <asm/e820.h> #include <asm/e820.h>
#include <asm/proto.h> #include <asm/proto.h>
...@@ -108,13 +109,14 @@ void __init setup_bios_corruption_check(void) ...@@ -108,13 +109,14 @@ void __init setup_bios_corruption_check(void)
update_e820(); update_e820();
} }
static struct timer_list periodic_check_timer;
void check_for_bios_corruption(void) void check_for_bios_corruption(void)
{ {
int i; int i;
int corruption = 0; int corruption = 0;
printk("dot\n");
if (!memory_corruption_check) if (!memory_corruption_check)
return; return;
...@@ -135,24 +137,29 @@ void check_for_bios_corruption(void) ...@@ -135,24 +137,29 @@ void check_for_bios_corruption(void)
WARN(corruption, KERN_ERR "Memory corruption detected in low memory\n"); WARN(corruption, KERN_ERR "Memory corruption detected in low memory\n");
} }
static void periodic_check_for_corruption(unsigned long data) static void check_corruption(struct work_struct *dummy);
static DECLARE_DELAYED_WORK(bios_check_work, check_corruption);
static void check_corruption(struct work_struct *dummy)
{ {
check_for_bios_corruption(); check_for_bios_corruption();
mod_timer(&periodic_check_timer, schedule_delayed_work(&bios_check_work,
round_jiffies(jiffies + corruption_check_period*HZ)); round_jiffies_relative(corruption_check_period*HZ));
} }
void start_periodic_check_for_corruption(void) static int start_periodic_check_for_corruption(void)
{ {
if (!memory_corruption_check || corruption_check_period == 0) if (!memory_corruption_check || corruption_check_period == 0)
return; return 0;
printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n", printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",
corruption_check_period); corruption_check_period);
init_timer(&periodic_check_timer); /* First time we run the checks right away */
periodic_check_timer.function = &periodic_check_for_corruption; schedule_delayed_work(&bios_check_work, 0);
periodic_check_for_corruption(0); return 0;
} }
module_init(start_periodic_check_for_corruption);
#endif #endif
...@@ -970,8 +970,6 @@ void __init mem_init(void) ...@@ -970,8 +970,6 @@ 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
......
...@@ -879,8 +879,6 @@ void __init mem_init(void) ...@@ -879,8 +879,6 @@ 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 */
......
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