powerpc: Use generic idle loop
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Paul McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Reviewed-by: Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Cc: Magnus Damm <magnus.damm@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Link: http://lkml.kernel.org/r/20130321215235.026838003@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
		
					parent
					
						
							
								fad48ad63d
							
						
					
				
			
			
				commit
				
					
						799fef0612
					
				
			
		
					 3 changed files with 30 additions and 60 deletions
				
			
		|  | @ -133,6 +133,7 @@ config PPC | ||||||
| 	select HAVE_ARCH_JUMP_LABEL | 	select HAVE_ARCH_JUMP_LABEL | ||||||
| 	select ARCH_HAVE_NMI_SAFE_CMPXCHG | 	select ARCH_HAVE_NMI_SAFE_CMPXCHG | ||||||
| 	select GENERIC_SMP_IDLE_THREAD | 	select GENERIC_SMP_IDLE_THREAD | ||||||
|  | 	select GENERIC_IDLE_LOOP | ||||||
| 	select GENERIC_CMOS_UPDATE | 	select GENERIC_CMOS_UPDATE | ||||||
| 	select GENERIC_TIME_VSYSCALL_OLD | 	select GENERIC_TIME_VSYSCALL_OLD | ||||||
| 	select GENERIC_CLOCKEVENTS | 	select GENERIC_CLOCKEVENTS | ||||||
|  |  | ||||||
|  | @ -33,11 +33,6 @@ | ||||||
| #include <asm/runlatch.h> | #include <asm/runlatch.h> | ||||||
| #include <asm/smp.h> | #include <asm/smp.h> | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_HOTPLUG_CPU |  | ||||||
| #define cpu_should_die()	cpu_is_offline(smp_processor_id()) |  | ||||||
| #else |  | ||||||
| #define cpu_should_die()	0 |  | ||||||
| #endif |  | ||||||
| 
 | 
 | ||||||
| unsigned long cpuidle_disable = IDLE_NO_OVERRIDE; | unsigned long cpuidle_disable = IDLE_NO_OVERRIDE; | ||||||
| EXPORT_SYMBOL(cpuidle_disable); | EXPORT_SYMBOL(cpuidle_disable); | ||||||
|  | @ -50,64 +45,38 @@ static int __init powersave_off(char *arg) | ||||||
| } | } | ||||||
| __setup("powersave=off", powersave_off); | __setup("powersave=off", powersave_off); | ||||||
| 
 | 
 | ||||||
| /*
 | #ifdef CONFIG_HOTPLUG_CPU | ||||||
|  * The body of the idle task. | void arch_cpu_idle_dead(void) | ||||||
|  */ |  | ||||||
| void cpu_idle(void) |  | ||||||
| { | { | ||||||
| 	set_thread_flag(TIF_POLLING_NRFLAG); | 	sched_preempt_enable_no_resched(); | ||||||
| 	while (1) { | 	cpu_die(); | ||||||
| 		tick_nohz_idle_enter(); | } | ||||||
| 		rcu_idle_enter(); | #endif | ||||||
| 
 | 
 | ||||||
| 		while (!need_resched() && !cpu_should_die()) { | void arch_cpu_idle(void) | ||||||
| 			ppc64_runlatch_off(); | { | ||||||
|  | 	ppc64_runlatch_off(); | ||||||
| 
 | 
 | ||||||
| 			if (ppc_md.power_save) { | 	if (ppc_md.power_save) { | ||||||
| 				clear_thread_flag(TIF_POLLING_NRFLAG); | 		ppc_md.power_save(); | ||||||
| 				/*
 | 		/*
 | ||||||
| 				 * smp_mb is so clearing of TIF_POLLING_NRFLAG | 		 * Some power_save functions return with | ||||||
| 				 * is ordered w.r.t. need_resched() test. | 		 * interrupts enabled, some don't. | ||||||
| 				 */ | 		 */ | ||||||
| 				smp_mb(); | 		if (irqs_disabled()) | ||||||
| 				local_irq_disable(); | 			local_irq_enable(); | ||||||
| 
 | 	} else { | ||||||
| 				/* Don't trace irqs off for idle */ | 		local_irq_enable(); | ||||||
| 				stop_critical_timings(); | 		/*
 | ||||||
| 
 | 		 * Go into low thread priority and possibly | ||||||
| 				/* check again after disabling irqs */ | 		 * low power mode. | ||||||
| 				if (!need_resched() && !cpu_should_die()) | 		 */ | ||||||
| 					ppc_md.power_save(); | 		HMT_low(); | ||||||
| 
 | 		HMT_very_low(); | ||||||
| 				start_critical_timings(); |  | ||||||
| 
 |  | ||||||
| 				/* Some power_save functions return with
 |  | ||||||
| 				 * interrupts enabled, some don't. |  | ||||||
| 				 */ |  | ||||||
| 				if (irqs_disabled()) |  | ||||||
| 					local_irq_enable(); |  | ||||||
| 				set_thread_flag(TIF_POLLING_NRFLAG); |  | ||||||
| 
 |  | ||||||
| 			} else { |  | ||||||
| 				/*
 |  | ||||||
| 				 * Go into low thread priority and possibly |  | ||||||
| 				 * low power mode. |  | ||||||
| 				 */ |  | ||||||
| 				HMT_low(); |  | ||||||
| 				HMT_very_low(); |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		HMT_medium(); |  | ||||||
| 		ppc64_runlatch_on(); |  | ||||||
| 		rcu_idle_exit(); |  | ||||||
| 		tick_nohz_idle_exit(); |  | ||||||
| 		if (cpu_should_die()) { |  | ||||||
| 			sched_preempt_enable_no_resched(); |  | ||||||
| 			cpu_die(); |  | ||||||
| 		} |  | ||||||
| 		schedule_preempt_disabled(); |  | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	HMT_medium(); | ||||||
|  | 	ppc64_runlatch_on(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int powersave_nap; | int powersave_nap; | ||||||
|  |  | ||||||
|  | @ -669,7 +669,7 @@ __cpuinit void start_secondary(void *unused) | ||||||
| 
 | 
 | ||||||
| 	local_irq_enable(); | 	local_irq_enable(); | ||||||
| 
 | 
 | ||||||
| 	cpu_idle(); | 	cpu_startup_entry(CPUHP_ONLINE); | ||||||
| 
 | 
 | ||||||
| 	BUG(); | 	BUG(); | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thomas Gleixner
				Thomas Gleixner