x86: use round_jiffies() for the corruption check timer
PATCH 1/1 x86: use round_jiffies() for the corruption check timer
From: Arjan van de Ven <[email protected]>
Date: Sat, 20 Sep 2008 20:32:43 -0700
Subject: [PATCH] x86: use round_jiffies() for the corruption check timer
the exact timing of the corruption check isn't too important (it's once a minute timer), use round_jiffies() to align it and avoid extra wakeups.
--- arch/x86/kernel/setup.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/setup.c +1 -1
@@ -715,7 +715,7 @@ void check_for_bios_corruption(void)static void periodic_check_for_corruption (unsigned long data) {check_for_bios_corruption (); -mod_timer (&periodic_check_timer, jiffies + corruption_check_period*HZ ); +mod_timer (&periodic_check_timer,round_jiffies (jiffies + corruption_check_period*HZ )); }void start_periodic_check_for_corruption (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
Ingo Molnar
AppliedQuoted 11 lines · Arjan van de Ven
From: Arjan van de Ven <[email protected]>
Date: Sat, 20 Sep 2008 20:32:43 -0700
Subject: [PATCH] x86: useround_jiffies()for the corruption check timerthe exact timing of the corruption check isn't too important (it's once a minute timer), use
round_jiffies()to align it and avoid extra wakeups.Signed-off-by Arjan van de Ven <[email protected]>CC Hugh Dickins <[email protected]>CC Jeremy Fitzhardinge <[email protected]>
applied to tip/x86/memory-corruption-check, thanks Arjan!
Ingo
PATCH 1/2 corruption check: move the corruption checks into their own file
In reply to Arjan van de VenFrom: 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 | 156 +++++++++++++++++++++++++++++++++++++ arch/x86/kernel/setup.c | 151 ----------------------------------- include/asm-x86/setup.h | 4 + 4 files changed, 161 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 +156 -0
156 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 · 1 line
1.5.5.1
PATCH 2/2 corruption check: run the corruption checks from a work queue
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 (including interrupt latency)
--- arch/x86/kernel/corruptioncheck.c | 21 +++++++++++++++++---- arch/x86/mm/init_32.c | 2 -- arch/x86/mm/init_64.c | 2 -- include/linux/kernel.h | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-)
arch/x86/kernel/corruptioncheck.c +17 -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,22 +136,34 @@ 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 )); +// periodic_check_for_corruption(0); +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 · 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
Re: [PATCH 2/2] corruption check: run the corruption checks from a work queue
eh a stray debug // snuck in; update attached
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 | 21 +++++++++++++++++---- arch/x86/mm/init_32.c | 2 -- arch/x86/mm/init_64.c | 2 -- include/linux/kernel.h | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-)
arch/x86/kernel/corruptioncheck.c +17 -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,22 +136,34 @@ 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 · 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
Re: [PATCH 2/2] corruption check: run the corruption checks from a work queue
Quoted 1 line · Arjan van de Ven
eh a stray debug // snuck in; update attached
In that case, patch 1/2 contains "for(" and "while(". :(
Signature · 1 line
~Randy
Re: [PATCH 2/2] corruption check: run the corruption checks from a work queue
Quoted 6 lines · On Mon, 22 Sep 2008 16:28:23 -0700 (PDT) "Randy.Dunlap" <[email protected]>…
Quoted 1 line · Arjan van de Ven
eh a stray debug // snuck in; update attached
In that case, patch 1/2 contains "for(" and "while(". :(
that's a dillema case.
I'm just moving code around in patch 1/2; I personally consider it bad form to also change it at the same time.....
(and it confuses git change tracking)
Signature · 3 lines
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
Quoted 7 lines · Arjan van de Ven
Quoted 4 lines · On Mon, 22 Sep 2008 16:28:23 -0700 (PDT) "Randy.Dunlap" <[email protected]>…
Quoted 1 line · Arjan van de Ven
eh a stray debug // snuck in; update attached
Quoted 8 lines
Quoted 2 lines
In that case, patch 1/2 contains "for(" and "while(". :(
that's a dillema case.
I'm just moving code around in patch 1/2; I personally consider it bad form to also change it at the same time.....(and it confuses git change tracking)
correct. The right solution in this case (where code is moved around) to do a separate patch for the style errors Randy reported, once the code has been moved over.
Ingo