Skip to content

Commit

Permalink
idle: Provide a generic entry point for the idle code
Browse files Browse the repository at this point in the history
For now this calls cpu_idle(), but in the long run we want to move the
cpu bringup code to the core and therefor we add a state argument.

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>
Link: http://lkml.kernel.org/r/20130321215233.583190032@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
KAGA-KOKO committed Apr 8, 2013
1 parent 3a98f87 commit a1a04ec
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
8 changes: 8 additions & 0 deletions include/linux/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,12 @@ static inline int disable_nonboot_cpus(void) { return 0; }
static inline void enable_nonboot_cpus(void) {}
#endif /* !CONFIG_PM_SLEEP_SMP */

enum cpuhp_state {
CPUHP_OFFLINE,
CPUHP_ONLINE,
};

void cpu_startup_entry(enum cpuhp_state state);
void cpu_idle(void);

#endif /* _LINUX_CPU_H_ */
2 changes: 1 addition & 1 deletion init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ static noinline void __init_refok rest_init(void)
init_idle_bootup_task(current);
schedule_preempt_disabled();
/* Call into cpu_idle with preempt disabled */
cpu_idle();
cpu_startup_entry(CPUHP_ONLINE);
}

/* Check for early params. */
Expand Down
1 change: 1 addition & 0 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ endif

obj-y += sched/
obj-y += power/
obj-y += cpu/

obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o
obj-$(CONFIG_FREEZER) += freezer.o
Expand Down
1 change: 1 addition & 0 deletions kernel/cpu/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj-y = idle.o
10 changes: 10 additions & 0 deletions kernel/cpu/idle.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Generic entry point for the idle threads
*/
#include <linux/sched.h>
#include <linux/cpu.h>

void cpu_startup_entry(enum cpuhp_state state)
{
cpu_idle();
}

0 comments on commit a1a04ec

Please sign in to comment.