aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2008-10-05 15:09:03 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-27 13:09:45 -0400
commit304e629bf4a3150a0bf6556fc45c52c5c082340f (patch)
tree26fb35d1e1b3c44411b0198a484e65f7f466bcee
parent6784f7d0a5016a397d38be1134e63fc784c1ca8e (diff)
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: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/check.c27
-rw-r--r--arch/x86/mm/init_32.c2
-rw-r--r--arch/x86/mm/init_64.c2
3 files changed, 17 insertions, 14 deletions
diff --git a/arch/x86/kernel/check.c b/arch/x86/kernel/check.c
index 5056703e1b05..55eed1752b43 100644
--- a/arch/x86/kernel/check.c
+++ b/arch/x86/kernel/check.c
@@ -1,6 +1,7 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/sched.h> 2#include <linux/sched.h>
3 3#include <linux/kthread.h>
4#include <linux/workqueue.h>
4#include <asm/e820.h> 5#include <asm/e820.h>
5#include <asm/proto.h> 6#include <asm/proto.h>
6 7
@@ -108,13 +109,14 @@ void __init setup_bios_corruption_check(void)
108 update_e820(); 109 update_e820();
109} 110}
110 111
111static struct timer_list periodic_check_timer;
112 112
113void check_for_bios_corruption(void) 113void check_for_bios_corruption(void)
114{ 114{
115 int i; 115 int i;
116 int corruption = 0; 116 int corruption = 0;
117 117
118 printk("dot\n");
119
118 if (!memory_corruption_check) 120 if (!memory_corruption_check)
119 return; 121 return;
120 122
@@ -135,24 +137,29 @@ void check_for_bios_corruption(void)
135 WARN(corruption, KERN_ERR "Memory corruption detected in low memory\n"); 137 WARN(corruption, KERN_ERR "Memory corruption detected in low memory\n");
136} 138}
137 139
138static void periodic_check_for_corruption(unsigned long data) 140static void check_corruption(struct work_struct *dummy);
141static DECLARE_DELAYED_WORK(bios_check_work, check_corruption);
142
143static void check_corruption(struct work_struct *dummy)
139{ 144{
140 check_for_bios_corruption(); 145 check_for_bios_corruption();
141 mod_timer(&periodic_check_timer, 146 schedule_delayed_work(&bios_check_work,
142 round_jiffies(jiffies + corruption_check_period*HZ)); 147 round_jiffies_relative(corruption_check_period*HZ));
143} 148}
144 149
145void start_periodic_check_for_corruption(void) 150static int start_periodic_check_for_corruption(void)
146{ 151{
147 if (!memory_corruption_check || corruption_check_period == 0) 152 if (!memory_corruption_check || corruption_check_period == 0)
148 return; 153 return 0;
149 154
150 printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n", 155 printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n",
151 corruption_check_period); 156 corruption_check_period);
152 157
153 init_timer(&periodic_check_timer); 158 /* First time we run the checks right away */
154 periodic_check_timer.function = &periodic_check_for_corruption; 159 schedule_delayed_work(&bios_check_work, 0);
155 periodic_check_for_corruption(0); 160 return 0;
156} 161}
162
163module_init(start_periodic_check_for_corruption);
157#endif 164#endif
158 165
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 8396868e82c5..5e6377560ff1 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -970,8 +970,6 @@ void __init mem_init(void)
970 int codesize, reservedpages, datasize, initsize; 970 int codesize, reservedpages, datasize, initsize;
971 int tmp; 971 int tmp;
972 972
973 start_periodic_check_for_corruption();
974
975#ifdef CONFIG_FLATMEM 973#ifdef CONFIG_FLATMEM
976 BUG_ON(!mem_map); 974 BUG_ON(!mem_map);
977#endif 975#endif
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index b8e461d49412..d6ef1589b95a 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -879,8 +879,6 @@ void __init mem_init(void)
879{ 879{
880 long codesize, reservedpages, datasize, initsize; 880 long codesize, reservedpages, datasize, initsize;
881 881
882 start_periodic_check_for_corruption();
883
884 pci_iommu_alloc(); 882 pci_iommu_alloc();
885 883
886 /* clear_bss() already clear the empty_zero_page */ 884 /* clear_bss() already clear the empty_zero_page */