corruption check: move the corruption checks into their own file
PATCH 1/2 corruption check: move the corruption checks into their own file
updated patch based on feedback from Randy that I should fix whitespace issues while moving code
Quoted 1 line
From
2ff2b1bf047dbb730ce6811ee5d4a8f5703be52fMon Sep 17 00:00:00 2001
From: Arjan van de Ven <[email protected]>
Date: Mon, 22 Sep 2008 09:35:06 -0700
Subject: [PATCH] corruption check: move the corruption checks into their own file
The corruption check code is rather sizable and it's likely to grow over time when we add checks for more types of corruptions (there's a few candidates in kerneloops.org that I want to add checks for)... so lets move it to its own file
--- arch/x86/kernel/Makefile | 1 + arch/x86/kernel/corruptioncheck.c | 157 +++++++++++++++++++++++++++++++++++++ arch/x86/kernel/setup.c | 151 ----------------------------------- include/asm-x86/setup.h | 4 + 4 files changed, 162 insertions(+), 151 deletions(-) create mode 100644 arch/x86/kernel/corruptioncheck.c
arch/x86/kernel/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-y += bootflag.o e820.o obj-y += pci-dma.o quirks.o i8237.o topology.o kdebugfs.o obj-y += alternative.o i8253.o pci-nommu.o obj-y += tsc.o io_delay.o rtc.o +obj-y += corruptioncheck.o obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o obj-y += process.o
arch/x86/kernel/corruptioncheck.c new file +157 -0
157 lines not on this page · raw message
arch/x86/kernel/setup.c +0 -151
157 lines not on this page · raw message
include/asm-x86/setup.h +4 -0
@@ -8,6 +8,10 @@/* Interrupt control for vSMPowered x86_64 systems */ void vsmp_init (void ); + +void setup_bios_corruption_check (void ); + +#ifdef CONFIG_X86_VISWS extern void visws_early_detect (void );extern int is_visws_box (void );
Signature · 8 lines
1.5.5.1 -- Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
PATCH 2/2 corruption check: run the corruption checks from a work queue
Quoted 1 line
From
adf881d00dc1b5a0e9961ecb08dc37ee4973a900Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <[email protected]>
Date: Mon, 22 Sep 2008 13:42:15 -0700
Subject: [PATCH] corruption check: run the corruption checks from a work queue
the 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.
--- arch/x86/kernel/corruptioncheck.c | 22 ++++++++++++++++++---- arch/x86/mm/init_32.c | 2 -- arch/x86/mm/init_64.c | 2 -- include/linux/kernel.h | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-)
arch/x86/kernel/corruptioncheck.c +18 -4
@@ -1,5 +1,6 @@#include <linux/module.h> #include <linux/sched.h> +#include <linux/kthread.h> #include <asm/e820.h> #include <asm/proto.h>
@@ -135,23 +136,36 @@ void check_for_bios_corruption(void)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) {check_for_bios_corruption (); +} + +static void periodic_check_for_corruption (unsigned long data) +{ + static DECLARE_WORK(corruptioncheck_work, check_corruption); +schedule_work (&corruptioncheck_work);mod_timer (&periodic_check_timer,round_jiffies (jiffies + corruption_check_period*HZ )); } -void start_periodic_check_for_corruption (void ) + + +int start_periodic_check_for_corruption (void ) {if (!memory_corruption_check || corruption_check_period ==0 ) -return ; +return 0 ;printk (KERN_INFO "Scanning for low memory corruption every %d seconds\n" , corruption_check_period);init_timer (&periodic_check_timer); periodic_check_timer.function = &periodic_check_for_corruption; -periodic_check_for_corruption (0 ); +mod_timer (&periodic_check_timer, +round_jiffies (jiffies + corruption_check_period*HZ )); + +return 0 ; } + +module_init (start_periodic_check_for_corruption);#endif
arch/x86/mm/init_32.c +0 -2
@@ -905,8 +905,6 @@ void __init mem_init(void)int codesize, reservedpages, datasize, initsize;int tmp; -start_periodic_check_for_corruption (); -#ifdef CONFIG_FLATMEM BUG_ON (!mem_map);#endif
arch/x86/mm/init_64.c +0 -2
@@ -822,8 +822,6 @@ void __init mem_init(void) {long codesize, reservedpages, datasize, initsize; -start_periodic_check_for_corruption (); -pci_iommu_alloc ();/* clear_bss() already clear the empty_zero_page */
include/linux/kernel.h +1 -1
@@ -260,7 +260,7 @@ extern int root_mountflags;* able to scatter it around anywhere in the kernel. */ void check_for_bios_corruption (void ); -void start_periodic_check_for_corruption (void ); +int start_periodic_check_for_corruption (void );#else static inline void check_for_bios_corruption (void ) {
Signature · 9 lines
1.5.5.1 -- Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Re: [PATCH 2/2] corruption check: run the corruption checks from a work queue
arch/x86/kernel/corruptioncheck.c void check_for_bios_corruption(void) · line 154
Quoted 5 lines · Arjan van de Ven
arch/x86/kernel/corruptioncheck.c +3
-1-void start_periodic_check_for_corruption (void ) + + +int start_periodic_check_for_corruption (void )
Couldn't this be static now?
Quoted 8 lines
{
arch/x86/kernel/corruptioncheck.c +1
-1if (!memory_corruption_check || corruption_check_period ==0 ) -return ; +return 0 ;printk (KERN_INFO "Scanning for low memory corruption every %d seconds\n" , corruption_check_period);
arch/x86/kernel/corruptioncheck.c void check_for_bios_corruption(void) · line 170
Quoted 10 lines
arch/x86/kernel/corruptioncheck.c +6
-1init_timer (&periodic_check_timer); periodic_check_timer.function = &periodic_check_for_corruption; -periodic_check_for_corruption (0 ); +mod_timer (&periodic_check_timer, +round_jiffies (jiffies + corruption_check_period*HZ )); + +return 0 ; } + +module_init (start_periodic_check_for_corruption);
J
Quoted 2 lines · Arjan van de Ven
updated patch based on feedback from Randy that I should fix whitespace issues while moving code
but that's wrong. You should _never_ change code while moving it because it's utterly unreviewable. Please split into two patches: first move the code, then do the style cleanups in the target file.
also, could you please rename the new file to check.c - it's shorter and we might check other things there too.
Ingo