aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpu/idle.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/cpu/idle.c')
-rw-r--r--kernel/cpu/idle.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/cpu/idle.c b/kernel/cpu/idle.c
index 8b86c0c68edf..e695c0a0bcb5 100644
--- a/kernel/cpu/idle.c
+++ b/kernel/cpu/idle.c
@@ -5,6 +5,7 @@
5#include <linux/cpu.h> 5#include <linux/cpu.h>
6#include <linux/tick.h> 6#include <linux/tick.h>
7#include <linux/mm.h> 7#include <linux/mm.h>
8#include <linux/stackprotector.h>
8 9
9#include <asm/tlb.h> 10#include <asm/tlb.h>
10 11
@@ -40,11 +41,13 @@ __setup("hlt", cpu_idle_nopoll_setup);
40 41
41static inline int cpu_idle_poll(void) 42static inline int cpu_idle_poll(void)
42{ 43{
44 rcu_idle_enter();
43 trace_cpu_idle_rcuidle(0, smp_processor_id()); 45 trace_cpu_idle_rcuidle(0, smp_processor_id());
44 local_irq_enable(); 46 local_irq_enable();
45 while (!need_resched()) 47 while (!need_resched())
46 cpu_relax(); 48 cpu_relax();
47 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id()); 49 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
50 rcu_idle_exit();
48 return 1; 51 return 1;
49} 52}
50 53
@@ -56,6 +59,7 @@ void __weak arch_cpu_idle_dead(void) { }
56void __weak arch_cpu_idle(void) 59void __weak arch_cpu_idle(void)
57{ 60{
58 cpu_idle_force_poll = 1; 61 cpu_idle_force_poll = 1;
62 local_irq_enable();
59} 63}
60 64
61/* 65/*
@@ -110,6 +114,21 @@ static void cpu_idle_loop(void)
110 114
111void cpu_startup_entry(enum cpuhp_state state) 115void cpu_startup_entry(enum cpuhp_state state)
112{ 116{
117 /*
118 * This #ifdef needs to die, but it's too late in the cycle to
119 * make this generic (arm and sh have never invoked the canary
120 * init for the non boot cpus!). Will be fixed in 3.11
121 */
122#ifdef CONFIG_X86
123 /*
124 * If we're the non-boot CPU, nothing set the stack canary up
125 * for us. The boot CPU already has it initialized but no harm
126 * in doing it again. This is a good place for updating it, as
127 * we wont ever return from this function (so the invalid
128 * canaries already on the stack wont ever trigger).
129 */
130 boot_init_stack_canary();
131#endif
113 current_set_polling(); 132 current_set_polling();
114 arch_cpu_idle_prepare(); 133 arch_cpu_idle_prepare();
115 cpu_idle_loop(); 134 cpu_idle_loop();