linux/arch/blackfin/kernel
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
..
cplb-mpu [Blackfin] arch: lose unnecessary dependency on CONFIG_BFIN_ICACHE for MPU 2008-04-25 03:26:48 +08:00
cplb-nompu [Blackfin] arch: detect the memory available in the system on the fly by default 2008-04-25 02:04:05 +08:00
asm-offsets.c [Blackfin] arch: Delete unused (copied from m68k) entries in asm-offsets.c. 2008-05-07 11:41:26 +08:00
bfin_dma_5xx.c Blackfin arch: Check for Anomaly 05000182 2008-05-17 15:57:01 +08:00
bfin_gpio.c Blackfin arch: Add workaround to read edge triggered GPIOs 2008-05-17 16:01:51 +08:00
bfin_ksyms.c Blackfin arch: IO Port functions to read/write unalligned memory 2008-05-17 16:38:52 +08:00
dma-mapping.c [Blackfin] arch: __FUNCTION__ is gcc-specific, use __func__ 2008-04-23 09:39:01 +08:00
dualcore_test.c Blackfin arch: cleanup warnings from checkpatch -- no functional changes 2007-07-12 22:58:21 +08:00
early_printk.c [Blackfin] arch: Spelling fixes 2007-12-24 20:03:51 +08:00
entry.S Blackfin arch: Fix random crash issue found by Michael. 2007-10-29 18:14:15 +08:00
fixed_code.S [Blackfin] arch: fix wrong header name in comment 2008-05-07 11:41:26 +08:00
flat.c Blackfin arch: cleanup warnings from checkpatch -- no functional changes 2007-07-12 22:58:21 +08:00
gptimers.c [Blackfin] arch: add support for the rest of the gptimers on the BF54x 2008-04-23 08:53:15 +08:00
init_task.c [PATCH] take init_files to fs/file.c 2008-05-16 17:22:20 -04:00
irqchip.c Blackfin arch: allow people to select the feature that is unavailable to the kernel 2007-08-05 17:03:59 +08:00
kgdb.c Blackfin arch: kgdb specific code 2007-06-29 16:35:17 +08:00
Makefile [Blackfin] arch: initial generic time and clock sources 2008-02-29 12:24:23 +08:00
module.c [Blackfin] arch: fix bug - Remove module will not free L1 memory used 2008-05-07 11:41:26 +08:00
process.c nohz: prevent tick stop outside of the idle loop 2008-07-18 18:10:28 +02:00
ptrace.c [Blackfin] arch: Delete unused (copied from m68k) entries in asm-offsets.c. 2008-05-07 11:41:26 +08:00
reboot.c [Blackfin] arch: update reboot code to match latest info (really just copy from u-boot) 2008-04-23 08:01:31 +08:00
setup.c [Blackfin] arch: take DDR DEVWD into consideration as well for BF548 2008-04-25 04:31:23 +08:00
signal.c [Blackfin] arch: disable single stepping when delivering a signal 2008-05-07 11:41:26 +08:00
sys_bfin.c unified (weak) sys_pipe implementation 2008-05-03 13:50:33 -07:00
time-ts.c [Blackfin] arch: Support for CPU_FREQ and NOHZ 2008-05-07 11:41:26 +08:00
time.c [Blackfin] arch: Functional power management support: Add support for cpu frequency scaling 2008-04-25 04:58:29 +08:00
traps.c Blackfin arch: cleanup the icplb/dcplb multiple hit checks 2008-05-17 16:18:08 +08:00
vmlinux.lds.S [Blackfin] arch: use the same style for missing L1 sections 2008-04-24 06:21:25 +08:00