aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/tile/include/asm/switch_to.h10
-rw-r--r--arch/tile/kernel/process.c17
2 files changed, 18 insertions, 9 deletions
diff --git a/arch/tile/include/asm/switch_to.h b/arch/tile/include/asm/switch_to.h
index b8f888cbe6b0..422842a56a3d 100644
--- a/arch/tile/include/asm/switch_to.h
+++ b/arch/tile/include/asm/switch_to.h
@@ -53,15 +53,11 @@ extern unsigned long get_switch_to_pc(void);
53 * Kernel threads can check to see if they need to migrate their 53 * Kernel threads can check to see if they need to migrate their
54 * stack whenever they return from a context switch; for user 54 * stack whenever they return from a context switch; for user
55 * threads, we defer until they are returning to user-space. 55 * threads, we defer until they are returning to user-space.
56 * We defer homecache migration until the runqueue lock is released.
56 */ 57 */
57#define finish_arch_switch(prev) do { \ 58#define finish_arch_post_lock_switch() do { \
58 if (unlikely((prev)->state == TASK_DEAD)) \
59 __insn_mtspr(SPR_SIM_CONTROL, SIM_CONTROL_OS_EXIT | \
60 ((prev)->pid << _SIM_CONTROL_OPERATOR_BITS)); \
61 __insn_mtspr(SPR_SIM_CONTROL, SIM_CONTROL_OS_SWITCH | \
62 (current->pid << _SIM_CONTROL_OPERATOR_BITS)); \
63 if (current->mm == NULL && !kstack_hash && \ 59 if (current->mm == NULL && !kstack_hash && \
64 current_thread_info()->homecache_cpu != smp_processor_id()) \ 60 current_thread_info()->homecache_cpu != raw_smp_processor_id()) \
65 homecache_migrate_kthread(); \ 61 homecache_migrate_kthread(); \
66} while (0) 62} while (0)
67 63
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c
index a45213781ad0..1087375cd57c 100644
--- a/arch/tile/kernel/process.c
+++ b/arch/tile/kernel/process.c
@@ -448,11 +448,24 @@ struct task_struct *__sched _switch_to(struct task_struct *prev,
448 448
449 /* 449 /*
450 * Switch kernel SP, PC, and callee-saved registers. 450 * Switch kernel SP, PC, and callee-saved registers.
451 * Pass the value to use for SYSTEM_SAVE_K_0 when we reset our sp.
452 * Once we return from this function we will have changed stacks
453 * and be running with current == next.
454 */
455 __switch_to(prev, next, next_current_ksp0(next));
456
457 /* Notify the simulator of task switch and task exit. */
458 if (unlikely(prev->state == TASK_DEAD))
459 __insn_mtspr(SPR_SIM_CONTROL, SIM_CONTROL_OS_EXIT |
460 (prev->pid << _SIM_CONTROL_OPERATOR_BITS));
461 __insn_mtspr(SPR_SIM_CONTROL, SIM_CONTROL_OS_SWITCH |
462 (next->pid << _SIM_CONTROL_OPERATOR_BITS));
463
464 /*
451 * In the context of the new task, return the old task pointer 465 * In the context of the new task, return the old task pointer
452 * (i.e. the task that actually called __switch_to). 466 * (i.e. the task that actually called __switch_to).
453 * Pass the value to use for SYSTEM_SAVE_K_0 when we reset our sp.
454 */ 467 */
455 return __switch_to(prev, next, next_current_ksp0(next)); 468 return prev;
456} 469}
457 470
458/* 471/*