aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/sched.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 2f25e68b4bac..39823cec0844 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -127,14 +127,6 @@ static void spu_remove_from_active_list(struct spu *spu)
127 mutex_unlock(&spu_prio->active_mutex[node]); 127 mutex_unlock(&spu_prio->active_mutex[node]);
128} 128}
129 129
130static inline void mm_needs_global_tlbie(struct mm_struct *mm)
131{
132 int nr = (NR_CPUS > 1) ? NR_CPUS : NR_CPUS + 1;
133
134 /* Global TLBIE broadcast required with SPEs. */
135 __cpus_setall(&mm->cpu_vm_mask, nr);
136}
137
138static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier); 130static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier);
139 131
140static void spu_switch_notify(struct spu *spu, struct spu_context *ctx) 132static void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
@@ -167,8 +159,7 @@ static void spu_bind_context(struct spu *spu, struct spu_context *ctx)
167 ctx->spu = spu; 159 ctx->spu = spu;
168 ctx->ops = &spu_hw_ops; 160 ctx->ops = &spu_hw_ops;
169 spu->pid = current->pid; 161 spu->pid = current->pid;
170 spu->mm = ctx->owner; 162 spu_associate_mm(spu, ctx->owner);
171 mm_needs_global_tlbie(spu->mm);
172 spu->ibox_callback = spufs_ibox_callback; 163 spu->ibox_callback = spufs_ibox_callback;
173 spu->wbox_callback = spufs_wbox_callback; 164 spu->wbox_callback = spufs_wbox_callback;
174 spu->stop_callback = spufs_stop_callback; 165 spu->stop_callback = spufs_stop_callback;
@@ -205,7 +196,7 @@ static void spu_unbind_context(struct spu *spu, struct spu_context *ctx)
205 spu->stop_callback = NULL; 196 spu->stop_callback = NULL;
206 spu->mfc_callback = NULL; 197 spu->mfc_callback = NULL;
207 spu->dma_callback = NULL; 198 spu->dma_callback = NULL;
208 spu->mm = NULL; 199 spu_associate_mm(spu, NULL);
209 spu->pid = 0; 200 spu->pid = 0;
210 ctx->ops = &spu_backing_ops; 201 ctx->ops = &spu_backing_ops;
211 ctx->spu = NULL; 202 ctx->spu = NULL;
@@ -263,7 +254,6 @@ static void spu_prio_wait(struct spu_context *ctx)
263{ 254{
264 DEFINE_WAIT(wait); 255 DEFINE_WAIT(wait);
265 256
266 set_bit(SPU_SCHED_WAKE, &ctx->sched_flags);
267 prepare_to_wait_exclusive(&ctx->stop_wq, &wait, TASK_INTERRUPTIBLE); 257 prepare_to_wait_exclusive(&ctx->stop_wq, &wait, TASK_INTERRUPTIBLE);
268 if (!signal_pending(current)) { 258 if (!signal_pending(current)) {
269 mutex_unlock(&ctx->state_mutex); 259 mutex_unlock(&ctx->state_mutex);
@@ -272,7 +262,6 @@ static void spu_prio_wait(struct spu_context *ctx)
272 } 262 }
273 __set_current_state(TASK_RUNNING); 263 __set_current_state(TASK_RUNNING);
274 remove_wait_queue(&ctx->stop_wq, &wait); 264 remove_wait_queue(&ctx->stop_wq, &wait);
275 clear_bit(SPU_SCHED_WAKE, &ctx->sched_flags);
276} 265}
277 266
278/** 267/**
@@ -292,7 +281,7 @@ static void spu_reschedule(struct spu *spu)
292 best = sched_find_first_bit(spu_prio->bitmap); 281 best = sched_find_first_bit(spu_prio->bitmap);
293 if (best < MAX_PRIO) { 282 if (best < MAX_PRIO) {
294 struct spu_context *ctx = spu_grab_context(best); 283 struct spu_context *ctx = spu_grab_context(best);
295 if (ctx && test_bit(SPU_SCHED_WAKE, &ctx->sched_flags)) 284 if (ctx)
296 wake_up(&ctx->stop_wq); 285 wake_up(&ctx->stop_wq);
297 } 286 }
298 spin_unlock(&spu_prio->runq_lock); 287 spin_unlock(&spu_prio->runq_lock);
@@ -414,8 +403,7 @@ int spu_activate(struct spu_context *ctx, unsigned long flags)
414 } 403 }
415 404
416 spu_add_to_rq(ctx); 405 spu_add_to_rq(ctx);
417 if (!(flags & SPU_ACTIVATE_NOWAKE)) 406 spu_prio_wait(ctx);
418 spu_prio_wait(ctx);
419 spu_del_from_rq(ctx); 407 spu_del_from_rq(ctx);
420 } while (!signal_pending(current)); 408 } while (!signal_pending(current));
421 409