Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0dc8153c authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

tile: Use generic idle loop



Signed-off-by: default avatarThomas 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: default avatarCc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Acked-by: default avatarChris Metcalf <cmetcalf@tilera.com>
Link: http://lkml.kernel.org/r/20130321215235.348460344@linutronix.de


Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent e26ef8fe
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ config TILE
	select ARCH_HAVE_NMI_SAFE_CMPXCHG
	select ARCH_HAVE_NMI_SAFE_CMPXCHG
	select GENERIC_CLOCKEVENTS
	select GENERIC_CLOCKEVENTS
	select MODULES_USE_ELF_RELA
	select MODULES_USE_ELF_RELA
	select GENERIC_IDLE_LOOP


# FIXME: investigate whether we need/want these options.
# FIXME: investigate whether we need/want these options.
#	select HAVE_IOREMAP_PROT
#	select HAVE_IOREMAP_PROT
+9 −56
Original line number Original line Diff line number Diff line
@@ -40,13 +40,11 @@
#include <arch/abi.h>
#include <arch/abi.h>
#include <arch/sim_def.h>
#include <arch/sim_def.h>



/*
/*
 * Use the (x86) "idle=poll" option to prefer low latency when leaving the
 * Use the (x86) "idle=poll" option to prefer low latency when leaving the
 * idle loop over low power while in the idle loop, e.g. if we have
 * idle loop over low power while in the idle loop, e.g. if we have
 * one thread per core and we want to get threads out of futex waits fast.
 * one thread per core and we want to get threads out of futex waits fast.
 */
 */
static int no_idle_nap;
static int __init idle_setup(char *str)
static int __init idle_setup(char *str)
{
{
	if (!str)
	if (!str)
@@ -54,64 +52,19 @@ static int __init idle_setup(char *str)


	if (!strcmp(str, "poll")) {
	if (!strcmp(str, "poll")) {
		pr_info("using polling idle threads.\n");
		pr_info("using polling idle threads.\n");
		no_idle_nap = 1;
		cpu_idle_poll_ctrl(true);
	} else if (!strcmp(str, "halt"))
		no_idle_nap = 0;
	else
		return -1;

		return 0;
		return 0;
	} else if (!strcmp(str, "halt")) {
		return 0;
	}
	return -1;
}
}
early_param("idle", idle_setup);
early_param("idle", idle_setup);


/*
void arch_cpu_idle(void)
 * The idle thread. There's no useful work to be
 * done, so just try to conserve power and have a
 * low exit latency (ie sit in a loop waiting for
 * somebody to say that they'd like to reschedule)
 */
void cpu_idle(void)
{
{
	int cpu = smp_processor_id();


	current_thread_info()->status |= TS_POLLING;

	if (no_idle_nap) {
		while (1) {
			while (!need_resched())
				cpu_relax();
			schedule();
		}
	}

	/* endless idle loop with no priority at all */
	while (1) {
		tick_nohz_idle_enter();
		rcu_idle_enter();
		while (!need_resched()) {
			if (cpu_is_offline(cpu))
				BUG();  /* no HOTPLUG_CPU */

			local_irq_disable();
	__get_cpu_var(irq_stat).idle_timestamp = jiffies;
	__get_cpu_var(irq_stat).idle_timestamp = jiffies;
			current_thread_info()->status &= ~TS_POLLING;
			/*
			 * TS_POLLING-cleared state must be visible before we
			 * test NEED_RESCHED:
			 */
			smp_mb();

			if (!need_resched())
	_cpu_idle();
	_cpu_idle();
			else
				local_irq_enable();
			current_thread_info()->status |= TS_POLLING;
		}
		rcu_idle_exit();
		tick_nohz_idle_exit();
		schedule_preempt_disabled();
	}
}
}


/*
/*
+1 −1
Original line number Original line Diff line number Diff line
@@ -207,7 +207,7 @@ void __cpuinit online_secondary(void)
	/* Set up tile-timer clock-event device on this cpu */
	/* Set up tile-timer clock-event device on this cpu */
	setup_tile_timer();
	setup_tile_timer();


	cpu_idle();
	cpu_startup_entry(CPUHP_ONLINE);
}
}


int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)