linux/arch/arm
Thomas Gleixner b8f8c3cf0a nohz: prevent tick stop outside of the idle loop
Jack Ren and Eric Miao tracked down the following long standing
problem in the NOHZ code:

	scheduler switch to idle task
	enable interrupts

Window starts here

	----> interrupt happens (does not set NEED_RESCHED)
	      	irq_exit() stops the tick

	----> interrupt happens (does set NEED_RESCHED)

	return from schedule()
	
	cpu_idle(): preempt_disable();

Window ends here

The interrupts can happen at any point inside the race window. The
first interrupt stops the tick, the second one causes the scheduler to
rerun and switch away from idle again and we end up with the tick
disabled.

The fact that it needs two interrupts where the first one does not set
NEED_RESCHED and the second one does made the bug obscure and extremly
hard to reproduce and analyse. Kudos to Jack and Eric.

Solution: Limit the NOHZ functionality to the idle loop to make sure
that we can not run into such a situation ever again.

cpu_idle()
{
	preempt_disable();

	while(1) {
		 tick_nohz_stop_sched_tick(1); <- tell NOHZ code that we
		 			          are in the idle loop

		 while (!need_resched())
		       halt();

		 tick_nohz_restart_sched_tick(); <- disables NOHZ mode
		 preempt_enable_no_resched();
		 schedule();
		 preempt_disable();
	}
}

In hindsight we should have done this forever, but ... 

/me grabs a large brown paperbag.

Debugged-by: Jack Ren <jack.ren@marvell.com>, 
Debugged-by: eric miao <eric.y.miao@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-07-18 18:10:28 +02:00
..
boot [ARM] 4854/1: fix the load address of uImage for CONFIG_ZBOOT_ROM=y 2008-04-19 11:28:07 +01:00
common [ARM] 5026/1: locomo: add .settype for gpio and several small fixes 2008-05-17 22:53:54 +01:00
configs Merge branches 'pxa' and 'orion-fixes1' 2008-04-29 21:31:06 +01:00
kernel nohz: prevent tick stop outside of the idle loop 2008-07-18 18:10:28 +02:00
lib
mach-aaec2000 arch: Remove unnecessary inclusions of asm/semaphore.h 2008-04-18 22:14:49 -04:00
mach-at91 [ARM] 5052/1: export clock functions for the at91x40 2008-05-23 13:50:07 +01:00
mach-clps711x [ARM] Add initial sparsemem support 2008-04-19 11:36:48 +01:00
mach-clps7500 [ARM] Fix timer damage from d3d74453c3 2008-01-28 10:17:12 +00:00
mach-davinci arm: use non-racy method for /proc/davinci_clocks creation 2008-04-29 08:06:21 -07:00
mach-ebsa110 [ARM] Fix timer damage from d3d74453c3 2008-01-28 10:17:12 +00:00
mach-ep93xx [ARM] 5023/1: Fix broken gpio interrupts on ep93xx 2008-05-04 11:06:05 +01:00
mach-footbridge [ARM] Fix timer damage from d3d74453c3 2008-01-28 10:17:12 +00:00
mach-h720x [ARM] replace remaining __FUNCTION__ occurrences 2008-03-06 12:18:18 +00:00
mach-imx [ARM] replace remaining __FUNCTION__ occurrences 2008-03-06 12:18:18 +00:00
mach-integrator [ARM] integrator: fix build warnings and errors 2008-05-23 19:35:52 +01:00
mach-iop13xx [ARM] replace remaining __FUNCTION__ occurrences 2008-03-06 12:18:18 +00:00
mach-iop32x i2c: Convert most new-style drivers to use module aliasing 2008-04-29 23:11:40 +02:00
mach-iop33x iop: unconditionally initialize the ATU on platforms known to be 'hosts' 2008-03-26 12:33:41 -07:00
mach-ixp4xx Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-04-30 08:45:48 -07:00
mach-ixp23xx [ARM] remove duplicate includes 2008-01-26 14:50:07 +00:00
mach-ixp2000 [ARM] Fix timer damage from d3d74453c3 2008-01-28 10:17:12 +00:00
mach-ks8695 [ARM] 4981/1: [KS8695] Simple LED driver 2008-04-17 15:58:25 +01:00
mach-l7200
mach-lh7a40x [ARM] fix lh7a40x/kev7a400 build 2008-04-20 16:40:47 +01:00
mach-msm [ARM] msm: dma support for MSM7X00A 2008-01-26 14:39:14 +00:00
mach-mx3 [ARM] Fix timer damage from d3d74453c3 2008-01-28 10:17:12 +00:00
mach-netx [ARM] replace remaining __FUNCTION__ occurrences 2008-03-06 12:18:18 +00:00
mach-ns9xxx Merge branch 'irq-fix' of git://www.modarm9.com/gitsrc/pub/people/ukleinek/linux-2.6.git 2008-05-07 21:55:01 +01:00
mach-omap1 [ARM] 5038/1: ARM: OMAP: Remove tsc2102 references from board-palmte.c 2008-05-22 14:10:35 +01:00
mach-omap2 ARM: OMAP: Fixed comments on global PRM register usage 2008-05-09 10:25:04 -07:00
mach-orion5x [ARM] 5037/1: Orion: fix DNS323/Kurobox Pro PCI initialisation 2008-05-17 22:55:15 +01:00
mach-pnx4008 arch: Remove unnecessary inclusions of asm/semaphore.h 2008-04-18 22:14:49 -04:00
mach-pxa Revert "[ARM] pxa: spitz wants PXA27x UDC definitions" 2008-05-23 13:53:31 +01:00
mach-realview Merge branch 'semaphore' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc 2008-04-21 15:41:27 -07:00
mach-rpc Rename: linux/pata_platform.h to linux/ata_platform.h 2008-02-06 06:54:17 -05:00
mach-s3c2400
mach-s3c2410 [ARM] 5041/1: VR1000: Fix DM9000 IRQ flags initialisation 2008-05-22 14:10:37 +01:00
mach-s3c2412 [ARM] 4985/1: S3C2412: Fix ARMDIVN name in CLKDIVN definition. 2008-04-17 17:04:38 +01:00
mach-s3c2440 [ARM] 4986/1: S3C24XX: Simtec machines need UCLK as parent to DCLK 2008-04-17 17:04:40 +01:00
mach-s3c2442 [ARM] 4794/1: S3C24XX: Comonise S3C2440 and S3C2442 clock code 2008-01-28 13:20:52 +00:00
mach-s3c2443 Driver core: change sysdev classes to use dynamic kobject names 2008-01-24 20:40:40 -08:00
mach-sa1100 [ARM] 5025/2: fix collie cpu initialisation 2008-05-22 14:03:20 +01:00
mach-shark [ARM] Fix timer damage from d3d74453c3 2008-01-28 10:17:12 +00:00
mach-versatile arch: Remove unnecessary inclusions of asm/semaphore.h 2008-04-18 22:14:49 -04:00
mm [ARM] 5034/1: fix arm{925,926,940,946} dma_flush_range() in WT mode 2008-05-17 22:55:14 +01:00
nwfpe
oprofile [ARM] 5018/1: RealView: Fix the ARM11MPCore Oprofile compilation 2008-04-28 17:03:34 +01:00
plat-iop iop: unconditionally initialize the ATU on platforms known to be 'hosts' 2008-03-26 12:33:41 -07:00
plat-mxc [ARM] 4887/1: i.MXC family: Separate current platform code 2008-04-17 16:15:17 +01:00
plat-omap [ARM] omap: fix omap clk support build errors 2008-05-22 16:38:50 +01:00
plat-orion [ARM] 4954/1: Orion: fix some function section mismatch 2008-04-10 15:27:09 +01:00
plat-s3c
plat-s3c24xx [ARM] 5039/1: S3C244X: Rename SDI device if running on S3C244X. 2008-05-22 14:17:22 +01:00
tools [ARM] Update mach-types 2008-04-19 11:28:05 +01:00
vfp [ARM] 4583/1: ARMv7: Add VFPv3 support 2008-01-26 14:41:28 +00:00
Kconfig ARM: always select HAVE_IDE 2008-04-28 23:44:43 +02:00
Kconfig-nommu
Kconfig.debug [ARM] CONFIG_DEBUG_STACK_USAGE 2008-01-26 14:50:06 +00:00
Makefile Merge branches 'arm', 'at91', 'ep93xx', 'iop', 'ks8695', 'misc', 'mxc', 'ns9x', 'orion', 'pxa', 'sa1100', 's3c' and 'sparsemem' into devel 2008-04-19 17:17:25 +01:00