diff options
| -rw-r--r-- | drivers/irqchip/irq-gic.c | 3 | ||||
| -rw-r--r-- | fs/proc/array.c | 1 | ||||
| -rw-r--r-- | include/linux/sched.h | 5 | ||||
| -rw-r--r-- | include/trace/events/sched.h | 2 | ||||
| -rw-r--r-- | kernel/hrtimer.c | 3 | ||||
| -rw-r--r-- | kernel/kthread.c | 52 | ||||
| -rw-r--r-- | kernel/smpboot.c | 14 |
7 files changed, 48 insertions, 32 deletions
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index a32e0d5aa45f..fc6aebf1e4b2 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
| @@ -236,7 +236,8 @@ static int gic_retrigger(struct irq_data *d) | |||
| 236 | if (gic_arch_extn.irq_retrigger) | 236 | if (gic_arch_extn.irq_retrigger) |
| 237 | return gic_arch_extn.irq_retrigger(d); | 237 | return gic_arch_extn.irq_retrigger(d); |
| 238 | 238 | ||
| 239 | return -ENXIO; | 239 | /* the genirq layer expects 0 if we can't retrigger in hardware */ |
| 240 | return 0; | ||
| 240 | } | 241 | } |
| 241 | 242 | ||
| 242 | #ifdef CONFIG_SMP | 243 | #ifdef CONFIG_SMP |
diff --git a/fs/proc/array.c b/fs/proc/array.c index f7ed9ee46eb9..cbd0f1b324b9 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
| @@ -143,6 +143,7 @@ static const char * const task_state_array[] = { | |||
| 143 | "x (dead)", /* 64 */ | 143 | "x (dead)", /* 64 */ |
| 144 | "K (wakekill)", /* 128 */ | 144 | "K (wakekill)", /* 128 */ |
| 145 | "W (waking)", /* 256 */ | 145 | "W (waking)", /* 256 */ |
| 146 | "P (parked)", /* 512 */ | ||
| 146 | }; | 147 | }; |
| 147 | 148 | ||
| 148 | static inline const char *get_task_state(struct task_struct *tsk) | 149 | static inline const char *get_task_state(struct task_struct *tsk) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index d35d2b6ddbfb..e692a022527b 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -163,9 +163,10 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) | |||
| 163 | #define TASK_DEAD 64 | 163 | #define TASK_DEAD 64 |
| 164 | #define TASK_WAKEKILL 128 | 164 | #define TASK_WAKEKILL 128 |
| 165 | #define TASK_WAKING 256 | 165 | #define TASK_WAKING 256 |
| 166 | #define TASK_STATE_MAX 512 | 166 | #define TASK_PARKED 512 |
| 167 | #define TASK_STATE_MAX 1024 | ||
| 167 | 168 | ||
| 168 | #define TASK_STATE_TO_CHAR_STR "RSDTtZXxKW" | 169 | #define TASK_STATE_TO_CHAR_STR "RSDTtZXxKWP" |
| 169 | 170 | ||
| 170 | extern char ___assert_task_state[1 - 2*!!( | 171 | extern char ___assert_task_state[1 - 2*!!( |
| 171 | sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; | 172 | sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; |
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 5a8671e8a67f..e5586caff67a 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
| @@ -147,7 +147,7 @@ TRACE_EVENT(sched_switch, | |||
| 147 | __print_flags(__entry->prev_state & (TASK_STATE_MAX-1), "|", | 147 | __print_flags(__entry->prev_state & (TASK_STATE_MAX-1), "|", |
| 148 | { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" }, | 148 | { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" }, |
| 149 | { 16, "Z" }, { 32, "X" }, { 64, "x" }, | 149 | { 16, "Z" }, { 32, "X" }, { 64, "x" }, |
| 150 | { 128, "W" }) : "R", | 150 | { 128, "K" }, { 256, "W" }, { 512, "P" }) : "R", |
| 151 | __entry->prev_state & TASK_STATE_MAX ? "+" : "", | 151 | __entry->prev_state & TASK_STATE_MAX ? "+" : "", |
| 152 | __entry->next_comm, __entry->next_pid, __entry->next_prio) | 152 | __entry->next_comm, __entry->next_pid, __entry->next_prio) |
| 153 | ); | 153 | ); |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index cc47812d3feb..14be27feda49 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
| @@ -63,6 +63,7 @@ | |||
| 63 | DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = | 63 | DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = |
| 64 | { | 64 | { |
| 65 | 65 | ||
| 66 | .lock = __RAW_SPIN_LOCK_UNLOCKED(hrtimer_bases.lock), | ||
| 66 | .clock_base = | 67 | .clock_base = |
| 67 | { | 68 | { |
| 68 | { | 69 | { |
| @@ -1642,8 +1643,6 @@ static void __cpuinit init_hrtimers_cpu(int cpu) | |||
| 1642 | struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu); | 1643 | struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu); |
| 1643 | int i; | 1644 | int i; |
| 1644 | 1645 | ||
| 1645 | raw_spin_lock_init(&cpu_base->lock); | ||
| 1646 | |||
| 1647 | for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { | 1646 | for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { |
| 1648 | cpu_base->clock_base[i].cpu_base = cpu_base; | 1647 | cpu_base->clock_base[i].cpu_base = cpu_base; |
| 1649 | timerqueue_init_head(&cpu_base->clock_base[i].active); | 1648 | timerqueue_init_head(&cpu_base->clock_base[i].active); |
diff --git a/kernel/kthread.c b/kernel/kthread.c index 691dc2ef9baf..9eb7fed0bbaa 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
| @@ -124,12 +124,12 @@ void *kthread_data(struct task_struct *task) | |||
| 124 | 124 | ||
| 125 | static void __kthread_parkme(struct kthread *self) | 125 | static void __kthread_parkme(struct kthread *self) |
| 126 | { | 126 | { |
| 127 | __set_current_state(TASK_INTERRUPTIBLE); | 127 | __set_current_state(TASK_PARKED); |
| 128 | while (test_bit(KTHREAD_SHOULD_PARK, &self->flags)) { | 128 | while (test_bit(KTHREAD_SHOULD_PARK, &self->flags)) { |
| 129 | if (!test_and_set_bit(KTHREAD_IS_PARKED, &self->flags)) | 129 | if (!test_and_set_bit(KTHREAD_IS_PARKED, &self->flags)) |
| 130 | complete(&self->parked); | 130 | complete(&self->parked); |
| 131 | schedule(); | 131 | schedule(); |
| 132 | __set_current_state(TASK_INTERRUPTIBLE); | 132 | __set_current_state(TASK_PARKED); |
| 133 | } | 133 | } |
| 134 | clear_bit(KTHREAD_IS_PARKED, &self->flags); | 134 | clear_bit(KTHREAD_IS_PARKED, &self->flags); |
| 135 | __set_current_state(TASK_RUNNING); | 135 | __set_current_state(TASK_RUNNING); |
| @@ -256,8 +256,13 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), | |||
| 256 | } | 256 | } |
| 257 | EXPORT_SYMBOL(kthread_create_on_node); | 257 | EXPORT_SYMBOL(kthread_create_on_node); |
| 258 | 258 | ||
| 259 | static void __kthread_bind(struct task_struct *p, unsigned int cpu) | 259 | static void __kthread_bind(struct task_struct *p, unsigned int cpu, long state) |
| 260 | { | 260 | { |
| 261 | /* Must have done schedule() in kthread() before we set_task_cpu */ | ||
| 262 | if (!wait_task_inactive(p, state)) { | ||
| 263 | WARN_ON(1); | ||
| 264 | return; | ||
| 265 | } | ||
| 261 | /* It's safe because the task is inactive. */ | 266 | /* It's safe because the task is inactive. */ |
| 262 | do_set_cpus_allowed(p, cpumask_of(cpu)); | 267 | do_set_cpus_allowed(p, cpumask_of(cpu)); |
| 263 | p->flags |= PF_THREAD_BOUND; | 268 | p->flags |= PF_THREAD_BOUND; |
| @@ -274,12 +279,7 @@ static void __kthread_bind(struct task_struct *p, unsigned int cpu) | |||
| 274 | */ | 279 | */ |
| 275 | void kthread_bind(struct task_struct *p, unsigned int cpu) | 280 | void kthread_bind(struct task_struct *p, unsigned int cpu) |
| 276 | { | 281 | { |
| 277 | /* Must have done schedule() in kthread() before we set_task_cpu */ | 282 | __kthread_bind(p, cpu, TASK_UNINTERRUPTIBLE); |
| 278 | if (!wait_task_inactive(p, TASK_UNINTERRUPTIBLE)) { | ||
| 279 | WARN_ON(1); | ||
| 280 | return; | ||
| 281 | } | ||
| 282 | __kthread_bind(p, cpu); | ||
| 283 | } | 283 | } |
| 284 | EXPORT_SYMBOL(kthread_bind); | 284 | EXPORT_SYMBOL(kthread_bind); |
| 285 | 285 | ||
| @@ -324,6 +324,22 @@ static struct kthread *task_get_live_kthread(struct task_struct *k) | |||
| 324 | return NULL; | 324 | return NULL; |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | static void __kthread_unpark(struct task_struct *k, struct kthread *kthread) | ||
| 328 | { | ||
| 329 | clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags); | ||
| 330 | /* | ||
| 331 | * We clear the IS_PARKED bit here as we don't wait | ||
| 332 | * until the task has left the park code. So if we'd | ||
| 333 | * park before that happens we'd see the IS_PARKED bit | ||
| 334 | * which might be about to be cleared. | ||
| 335 | */ | ||
| 336 | if (test_and_clear_bit(KTHREAD_IS_PARKED, &kthread->flags)) { | ||
| 337 | if (test_bit(KTHREAD_IS_PER_CPU, &kthread->flags)) | ||
| 338 | __kthread_bind(k, kthread->cpu, TASK_PARKED); | ||
| 339 | wake_up_state(k, TASK_PARKED); | ||
| 340 | } | ||
| 341 | } | ||
| 342 | |||
| 327 | /** | 343 | /** |
| 328 | * kthread_unpark - unpark a thread created by kthread_create(). | 344 | * kthread_unpark - unpark a thread created by kthread_create(). |
| 329 | * @k: thread created by kthread_create(). | 345 | * @k: thread created by kthread_create(). |
| @@ -336,20 +352,8 @@ void kthread_unpark(struct task_struct *k) | |||
| 336 | { | 352 | { |
| 337 | struct kthread *kthread = task_get_live_kthread(k); | 353 | struct kthread *kthread = task_get_live_kthread(k); |
| 338 | 354 | ||
| 339 | if (kthread) { | 355 | if (kthread) |
| 340 | clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags); | 356 | __kthread_unpark(k, kthread); |
| 341 | /* | ||
| 342 | * We clear the IS_PARKED bit here as we don't wait | ||
| 343 | * until the task has left the park code. So if we'd | ||
| 344 | * park before that happens we'd see the IS_PARKED bit | ||
| 345 | * which might be about to be cleared. | ||
| 346 | */ | ||
| 347 | if (test_and_clear_bit(KTHREAD_IS_PARKED, &kthread->flags)) { | ||
| 348 | if (test_bit(KTHREAD_IS_PER_CPU, &kthread->flags)) | ||
| 349 | __kthread_bind(k, kthread->cpu); | ||
| 350 | wake_up_process(k); | ||
| 351 | } | ||
| 352 | } | ||
| 353 | put_task_struct(k); | 357 | put_task_struct(k); |
| 354 | } | 358 | } |
| 355 | 359 | ||
| @@ -407,7 +411,7 @@ int kthread_stop(struct task_struct *k) | |||
| 407 | trace_sched_kthread_stop(k); | 411 | trace_sched_kthread_stop(k); |
| 408 | if (kthread) { | 412 | if (kthread) { |
| 409 | set_bit(KTHREAD_SHOULD_STOP, &kthread->flags); | 413 | set_bit(KTHREAD_SHOULD_STOP, &kthread->flags); |
| 410 | clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags); | 414 | __kthread_unpark(k, kthread); |
| 411 | wake_up_process(k); | 415 | wake_up_process(k); |
| 412 | wait_for_completion(&kthread->exited); | 416 | wait_for_completion(&kthread->exited); |
| 413 | } | 417 | } |
diff --git a/kernel/smpboot.c b/kernel/smpboot.c index 8eaed9aa9cf0..02fc5c933673 100644 --- a/kernel/smpboot.c +++ b/kernel/smpboot.c | |||
| @@ -185,8 +185,18 @@ __smpboot_create_thread(struct smp_hotplug_thread *ht, unsigned int cpu) | |||
| 185 | } | 185 | } |
| 186 | get_task_struct(tsk); | 186 | get_task_struct(tsk); |
| 187 | *per_cpu_ptr(ht->store, cpu) = tsk; | 187 | *per_cpu_ptr(ht->store, cpu) = tsk; |
| 188 | if (ht->create) | 188 | if (ht->create) { |
| 189 | ht->create(cpu); | 189 | /* |
| 190 | * Make sure that the task has actually scheduled out | ||
| 191 | * into park position, before calling the create | ||
| 192 | * callback. At least the migration thread callback | ||
| 193 | * requires that the task is off the runqueue. | ||
| 194 | */ | ||
| 195 | if (!wait_task_inactive(tsk, TASK_PARKED)) | ||
| 196 | WARN_ON(1); | ||
| 197 | else | ||
| 198 | ht->create(cpu); | ||
| 199 | } | ||
| 190 | return 0; | 200 | return 0; |
| 191 | } | 201 | } |
| 192 | 202 | ||
