linux_dsm_epyc7002/arch/avr32/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
..
asm-offsets.c avr32: use kbuild.h macros instead of defining macros in asm-offsets.c 2008-04-29 08:06:29 -07:00
avr32_ksyms.c avr32: export strnlen_user 2008-05-26 13:26:36 +02:00
cpu.c [AVR32] constify function pointer tables 2008-01-25 08:31:43 +01:00
entry-avr32b.S avr32: Move sleep code into mach-at32ap 2008-04-19 20:40:07 -04:00
head.S AVR32: Get rid of board_early_init 2006-11-06 10:43:23 +01:00
init_task.c [PATCH] take init_files to fs/file.c 2008-05-16 17:22:20 -04:00
irq.c [AVR32] NMI debugging 2008-01-25 08:31:43 +01:00
kprobes.c [AVR32] Enable debugging only when needed 2008-01-25 08:31:39 +01:00
Makefile Generic semaphore implementation 2008-04-17 10:42:34 -04:00
module.c [AVR32] Clean up exception handling code 2007-04-27 13:44:13 +02:00
nmi_debug.c [AVR32] NMI debugging 2008-01-25 08:31:43 +01:00
ocd.c libfs: allow error return from simple attributes 2008-02-08 09:22:34 -08:00
process.c nohz: prevent tick stop outside of the idle loop 2008-07-18 18:10:28 +02:00
ptrace.c [AVR32] Enable debugging only when needed 2008-01-25 08:31:39 +01:00
setup.c atmel_lcdfb: don't initialize a pre-allocated framebuffer 2008-04-28 08:58:38 -07:00
signal.c [AVR32] Remove redundant try_to_freeze() call from do_signal() 2008-01-25 08:31:39 +01:00
stacktrace.c [AVR32] Implement stacktrace support 2007-12-07 14:52:36 +01:00
switch_to.S [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
sys_avr32.c unified (weak) sys_pipe implementation 2008-05-03 13:50:33 -07:00
syscall_table.S Fix timerfd breakage on avr32 2008-02-05 14:37:15 -08:00
syscall-stubs.S AVR32: Wire up sys_epoll_pwait 2006-11-06 14:07:15 +01:00
time.c avr32: Generic clockevents support 2008-04-19 20:40:08 -04:00
traps.c avr32: Build fix for CONFIG_BUG=n 2008-03-13 23:56:15 +01:00
vmlinux.lds.S all archs: consolidate init and exit sections in vmlinux.lds.h 2008-01-28 23:21:17 +01:00