kernel-ark/arch/mips/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
..
8250-platform.c
asm-offsets.c mips: use kbuild.h instead of macros in asm-offsets.c 2008-04-29 08:06:29 -07:00
binfmt_elfn32.c remove div_long_long_rem 2008-05-01 08:03:58 -07:00
binfmt_elfo32.c remove div_long_long_rem 2008-05-01 08:03:58 -07:00
branch.c
cevt-bcm1480.c [MIPS] Sibyte: Stop timers before programming next even. 2007-11-15 23:21:50 +00:00
cevt-ds1287.c [MIPS] DS1287: Add clockevent driver 2008-04-28 17:14:32 +01:00
cevt-gt641xx.c [MIPS] cevt-gt641xx: Kill unnecessary include 2008-04-28 17:14:32 +01:00
cevt-r4k.c [MIPS] Handle R4000/R4400 mfc0 from count register. 2007-11-26 17:26:14 +00:00
cevt-sb1250.c [MIPS] Sibyte: Stop timers before programming next even. 2007-11-15 23:21:50 +00:00
cevt-txx9.c
cpu-bugs64.c [MIPS] Add empty argument parenthesis to GCC_IMM_ASM 2008-05-12 16:46:52 +01:00
cpu-probe.c [MIPS] Move arch/mips/philips to arch/mips/nxp 2008-04-28 17:14:26 +01:00
csrc-bcm1480.c
csrc-ioasic.c [MIPS] add DECstation I/O ASIC clocksource 2008-04-28 17:14:32 +01:00
csrc-r4k.c [MIPS] Clocksource: Only install r4k counter as clocksource if present. 2008-03-12 14:14:42 +00:00
csrc-sb1250.c [MIPS] Sibyte: Fix name of clocksource. 2007-11-15 23:21:51 +00:00
early_printk.c
entry.S
gdb-low.S
gdb-stub.c [MIPS] Make KGDB compile on UP 2008-04-04 22:43:47 +01:00
genex.S [MIPS] R4000/R4400 daddiu erratum workaround 2008-01-29 10:14:55 +00:00
gpio_txx9.c [MIPS] generic txx9 gpio support 2008-04-28 17:14:31 +01:00
head.S [MIPS] Fix loads of section missmatches 2008-03-12 14:14:41 +00:00
i8253.c [MIPS] I8253: Export i2853_lock to modules. 2008-04-01 15:46:33 +01:00
i8259.c MIPS: Mark all but i8259 interrupts as no-probe. 2008-02-08 09:22:42 -08:00
init_task.c [PATCH] take init_files to fs/file.c 2008-05-16 17:22:20 -04:00
irix5sys.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
irixelf.c [MIPS] IRIX: Handle do_brk() error return correctly. 2008-05-12 16:46:51 +01:00
irixinv.c
irixioctl.c [PATCH] remove horrors with irix tty ioctls handling 2008-05-01 13:07:21 -04:00
irixsig.c pid: fix mips irix emulation pid usage 2008-02-08 09:22:28 -08:00
irq_cpu.c [MIPS] irq_cpu: use handle_percpu_irq handler to avoid dropping interrupts. 2007-11-15 23:21:52 +00:00
irq_txx9.c
irq-gic.c [MIPS] Add support for MIPS CMP platform. 2008-04-28 17:14:26 +01:00
irq-gt641xx.c
irq-msc01.c [MIPS] Fix some sparse warnings on traps.c and irq-msc01.c 2008-04-28 17:14:32 +01:00
irq-rm7000.c [MIPS] Fix broken rm7000/rm9000 interrupt handling 2008-02-19 17:01:31 +00:00
irq-rm9000.c [MIPS] Fix broken rm7000/rm9000 interrupt handling 2008-02-19 17:01:31 +00:00
irq.c MIPS: Mark all but i8259 interrupts as no-probe. 2008-02-08 09:22:42 -08:00
kspd.c [MIPS] MT: Functional fixes and a little reformatting of APRP support 2008-05-12 16:46:51 +01:00
linux32.c [MIPS] compat: handle argument endianess of sys32_(f)truncate64 with merge_64 2008-01-29 10:15:02 +00:00
machine_kexec.c
Makefile [MIPS] MT: Functional fixes and a little reformatting of APRP support 2008-05-12 16:46:51 +01:00
mips_ksyms.c
mips-mt-fpaff.c [MIPS] Use find_task_by_vpid in system calls 2008-02-19 17:01:30 +00:00
mips-mt.c [MIPS] SMP: Call platform methods via ops structure. 2008-01-29 10:14:57 +00:00
module.c
proc.c [MIPS]: constify function pointer tables 2008-01-29 10:15:03 +00:00
process.c nohz: prevent tick stop outside of the idle loop 2008-07-18 18:10:28 +02:00
ptrace32.c
ptrace.c
r4k_fpu.S
r4k_switch.S
r2300_fpu.S
r2300_switch.S
r6000_fpu.S
relocate_kernel.S
reset.c
rtlx.c [MIPS] MT: Functional fixes and a little reformatting of APRP support 2008-05-12 16:46:51 +01:00
scall32-o32.S [MIPS] Wire up the timerfd_*() o32 system calls 2008-02-19 17:01:31 +00:00
scall64-64.S [MIPS] Wire up the timerfd_*() o32 system calls 2008-02-19 17:01:31 +00:00
scall64-n32.S [MIPS] Wire up the timerfd_*() o32 system calls 2008-02-19 17:01:31 +00:00
scall64-o32.S [MIPS] Wire up the timerfd_*() o32 system calls 2008-02-19 17:01:31 +00:00
setup.c [MIPS] Initialize max_pfn again. 2008-05-12 16:46:51 +01:00
signal32.c
signal_n32.c
signal-common.h [MIPS] replace remaining __FUNCTION__ occurrences 2008-04-28 17:14:27 +01:00
signal.c
smp-cmp.c [MIPS] Add support for MIPS CMP platform. 2008-04-28 17:14:26 +01:00
smp-mt.c [MIPS] Add support for MIPS CMP platform. 2008-04-28 17:14:26 +01:00
smp-up.c [MIPS] Only build r4k clocksource for systems that work ok with it. 2007-11-26 17:26:14 +00:00
smp.c [MIPS] fix warning message on SMP kernels 2008-05-12 16:46:56 +01:00
smtc-asm.S
smtc-proc.c [MIPS] SMP: Call platform methods via ops structure. 2008-01-29 10:14:57 +00:00
smtc.c [MIPS] Add support for MIPS CMP platform. 2008-04-28 17:14:26 +01:00
spram.c [MIPS] Basic SPRAM support 2008-04-28 17:14:23 +01:00
stacktrace.c
sync-r4k.c [MIPS] Add support for MIPS CMP platform. 2008-04-28 17:14:26 +01:00
syscall.c
sysirix.c [MIPS] Use find_task_by_vpid in system calls 2008-02-19 17:01:30 +00:00
time.c [MIPS] unexport null_perf_irq() and make it static 2008-04-28 17:14:31 +01:00
topology.c
traps.c [MIPS] Fix handling of trap and breakpoint instructions 2008-04-28 17:14:33 +01:00
unaligned.c
vmlinux.lds.S all archs: consolidate init and exit sections in vmlinux.lds.h 2008-01-28 23:21:17 +01:00
vpe.c [MIPS] ELF handling - use SELFMAG instead of numeric constant 2008-05-12 16:46:55 +01:00