android_kernel_xiaomi_sm8350/arch/powerpc/platforms
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
..
8xx [POWERPC] CPM: Always use new binding. 2008-04-17 01:01:40 -05:00
40x [POWERPC] 4xx: Create common ppc4xx_reset_system() in ppc4xx_soc.c 2008-04-02 20:44:56 -05:00
44x [POWERPC] 4xx: Add idle wait support for 44x platforms 2008-04-16 07:32:06 -05:00
52xx [POWERPC] mpc5200: add Phytec pcm030 board support 2008-04-29 07:17:12 -06:00
82xx Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-04-21 15:50:49 -07:00
83xx [POWERPC] 83xx: mpc8315 - fix USB UTMI Host setup 2008-04-17 09:52:50 -05:00
85xx [POWERPC] 85xx: SBC8548 - Add flash support and HW Rev reporting 2008-05-13 08:53:48 -05:00
86xx [POWERPC] 86xx: mpc8610_hpcd: fix second serial port 2008-05-13 08:53:48 -05:00
512x
cell [POWERPC] cell: Fix section mismatches in io-workarounds code 2008-05-15 20:49:57 +10:00
chrp mv643xx_eth: get rid of static variables, allow multiple instances 2008-04-28 21:17:07 -07:00
embedded6xx [POWERPC] mv64x60: Fix FDT compatible names: mv64x60 => mv64360 2008-04-15 21:21:24 +10:00
iseries nohz: prevent tick stop outside of the idle loop 2008-07-18 18:10:28 +02:00
maple [POWERPC] maple: Kill fixup_maple_ide 2008-03-26 08:44:04 +11:00
pasemi i2c: Switch pasemi to the new device/driver matching scheme 2008-05-18 20:49:40 +02:00
powermac [POWERPC] Fix building of pmac32 when CONFIG_NVRAM=m 2008-04-29 15:57:34 +10:00
prep
ps3 [POWERPC] PS3: Fix memory hotplug 2008-05-23 16:15:29 +10:00
pseries [POWERPC] Assign PDE->data before gluing PDE into /proc tree 2008-05-05 16:47:14 +10:00
fsl_uli1575.c
Kconfig [POWERPC] celleb: Move the files for celleb base support 2008-04-24 21:08:13 +10:00
Kconfig.cputype [POWERPC] Raise the upper limit of NR_CPUS and move the pacas into the BSS 2008-04-24 20:58:04 +10:00
Makefile [POWERPC] celleb: Move miscellaneous files for Beat 2008-04-24 21:08:14 +10:00