diff options
author | Paul Mackerras <paulus@samba.org> | 2008-08-19 19:18:20 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-08-19 19:18:20 -0400 |
commit | d82bf490948eaf10023ff850d0b5c70e49e0ba76 (patch) | |
tree | a29439a64b62a042717d523babd3c37c57f00752 /arch/powerpc | |
parent | a7f5aaf36ded825477c4d7167cc6eb1bcdc63191 (diff) | |
parent | cb9808d3d0cb0ed97197decadcf0431140b9e231 (diff) |
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jk/spufs into merge
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/run.c | 15 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/sched.c | 11 |
2 files changed, 17 insertions, 9 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c index f7edba6cb795..c9bb7cfd3dca 100644 --- a/arch/powerpc/platforms/cell/spufs/run.c +++ b/arch/powerpc/platforms/cell/spufs/run.c | |||
@@ -206,11 +206,6 @@ static int spu_run_init(struct spu_context *ctx, u32 *npc) | |||
206 | (SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE); | 206 | (SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE); |
207 | if (runcntl == 0) | 207 | if (runcntl == 0) |
208 | runcntl = SPU_RUNCNTL_RUNNABLE; | 208 | runcntl = SPU_RUNCNTL_RUNNABLE; |
209 | } | ||
210 | |||
211 | if (ctx->flags & SPU_CREATE_NOSCHED) { | ||
212 | spuctx_switch_state(ctx, SPU_UTIL_USER); | ||
213 | ctx->ops->runcntl_write(ctx, runcntl); | ||
214 | } else { | 209 | } else { |
215 | unsigned long privcntl; | 210 | unsigned long privcntl; |
216 | 211 | ||
@@ -219,9 +214,15 @@ static int spu_run_init(struct spu_context *ctx, u32 *npc) | |||
219 | else | 214 | else |
220 | privcntl = SPU_PRIVCNTL_MODE_NORMAL; | 215 | privcntl = SPU_PRIVCNTL_MODE_NORMAL; |
221 | 216 | ||
222 | ctx->ops->npc_write(ctx, *npc); | ||
223 | ctx->ops->privcntl_write(ctx, privcntl); | 217 | ctx->ops->privcntl_write(ctx, privcntl); |
224 | ctx->ops->runcntl_write(ctx, runcntl); | 218 | ctx->ops->npc_write(ctx, *npc); |
219 | } | ||
220 | |||
221 | ctx->ops->runcntl_write(ctx, runcntl); | ||
222 | |||
223 | if (ctx->flags & SPU_CREATE_NOSCHED) { | ||
224 | spuctx_switch_state(ctx, SPU_UTIL_USER); | ||
225 | } else { | ||
225 | 226 | ||
226 | if (ctx->state == SPU_STATE_SAVED) { | 227 | if (ctx->state == SPU_STATE_SAVED) { |
227 | ret = spu_activate(ctx, 0); | 228 | ret = spu_activate(ctx, 0); |
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 2deeeba7eccf..1c1b627ee843 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
@@ -641,8 +641,10 @@ static struct spu *find_victim(struct spu_context *ctx) | |||
641 | 641 | ||
642 | if (tmp && tmp->prio > ctx->prio && | 642 | if (tmp && tmp->prio > ctx->prio && |
643 | !(tmp->flags & SPU_CREATE_NOSCHED) && | 643 | !(tmp->flags & SPU_CREATE_NOSCHED) && |
644 | (!victim || tmp->prio > victim->prio)) | 644 | (!victim || tmp->prio > victim->prio)) { |
645 | victim = spu->ctx; | 645 | victim = spu->ctx; |
646 | get_spu_context(victim); | ||
647 | } | ||
646 | } | 648 | } |
647 | mutex_unlock(&cbe_spu_info[node].list_mutex); | 649 | mutex_unlock(&cbe_spu_info[node].list_mutex); |
648 | 650 | ||
@@ -658,6 +660,7 @@ static struct spu *find_victim(struct spu_context *ctx) | |||
658 | * look at another context or give up after X retries. | 660 | * look at another context or give up after X retries. |
659 | */ | 661 | */ |
660 | if (!mutex_trylock(&victim->state_mutex)) { | 662 | if (!mutex_trylock(&victim->state_mutex)) { |
663 | put_spu_context(victim); | ||
661 | victim = NULL; | 664 | victim = NULL; |
662 | goto restart; | 665 | goto restart; |
663 | } | 666 | } |
@@ -670,6 +673,7 @@ static struct spu *find_victim(struct spu_context *ctx) | |||
670 | * restart the search. | 673 | * restart the search. |
671 | */ | 674 | */ |
672 | mutex_unlock(&victim->state_mutex); | 675 | mutex_unlock(&victim->state_mutex); |
676 | put_spu_context(victim); | ||
673 | victim = NULL; | 677 | victim = NULL; |
674 | goto restart; | 678 | goto restart; |
675 | } | 679 | } |
@@ -687,6 +691,7 @@ static struct spu *find_victim(struct spu_context *ctx) | |||
687 | spu_add_to_rq(victim); | 691 | spu_add_to_rq(victim); |
688 | 692 | ||
689 | mutex_unlock(&victim->state_mutex); | 693 | mutex_unlock(&victim->state_mutex); |
694 | put_spu_context(victim); | ||
690 | 695 | ||
691 | return spu; | 696 | return spu; |
692 | } | 697 | } |
@@ -985,9 +990,11 @@ static int spusched_thread(void *unused) | |||
985 | struct spu_context *ctx = spu->ctx; | 990 | struct spu_context *ctx = spu->ctx; |
986 | 991 | ||
987 | if (ctx) { | 992 | if (ctx) { |
993 | get_spu_context(ctx); | ||
988 | mutex_unlock(mtx); | 994 | mutex_unlock(mtx); |
989 | spusched_tick(ctx); | 995 | spusched_tick(ctx); |
990 | mutex_lock(mtx); | 996 | mutex_lock(mtx); |
997 | put_spu_context(ctx); | ||
991 | } | 998 | } |
992 | } | 999 | } |
993 | mutex_unlock(mtx); | 1000 | mutex_unlock(mtx); |
@@ -1030,7 +1037,7 @@ void spuctx_switch_state(struct spu_context *ctx, | |||
1030 | node = spu->node; | 1037 | node = spu->node; |
1031 | if (old_state == SPU_UTIL_USER) | 1038 | if (old_state == SPU_UTIL_USER) |
1032 | atomic_dec(&cbe_spu_info[node].busy_spus); | 1039 | atomic_dec(&cbe_spu_info[node].busy_spus); |
1033 | if (new_state == SPU_UTIL_USER); | 1040 | if (new_state == SPU_UTIL_USER) |
1034 | atomic_inc(&cbe_spu_info[node].busy_spus); | 1041 | atomic_inc(&cbe_spu_info[node].busy_spus); |
1035 | } | 1042 | } |
1036 | } | 1043 | } |