aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs/run.c
diff options
context:
space:
mode:
authorAndre Detsch <adetsch@br.ibm.com>2007-07-20 15:39:33 -0400
committerArnd Bergmann <arnd@klappe.arndb.de>2007-07-20 15:41:50 -0400
commit27ec41d3a1d4df2b7cd190e93aad22ab86a72aa1 (patch)
tree6c9d5af3fc3c3cfbef390eb34caf4dc7e7a3913e /arch/powerpc/platforms/cell/spufs/run.c
parente840cfe6814d6f13ecb86cff7097ad7259df502e (diff)
[CELL] spufs: add spu stats in sysfs and ctx stat file in spufs
This patch exports per-context statistics in spufs as long as spu statistics in sysfs. It was formed by merging: "spufs: add spu stats in sysfs" From: Christoph Hellwig "spufs: add stat file to spufs" From: Christoph Hellwig "spufs: fix libassist accounting" From: Jeremy Kerr "spusched: fix spu utilization statistics" From: Luke Browning And some adjustments by myself, after suggestions on cbe-oss-dev. Having separate patches was making the review process harder than it should, as we end up integrating spus and ctx statistics accounting much more than it was on the first implementation. Signed-off-by: Andre Detsch <adetsch@br.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/run.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
index 58ae13b7de8..8c91b3f9315 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -126,6 +126,8 @@ out:
126 126
127static int spu_run_init(struct spu_context *ctx, u32 * npc) 127static int spu_run_init(struct spu_context *ctx, u32 * npc)
128{ 128{
129 spuctx_switch_state(ctx, SPU_UTIL_SYSTEM);
130
129 if (ctx->flags & SPU_CREATE_ISOLATE) { 131 if (ctx->flags & SPU_CREATE_ISOLATE) {
130 unsigned long runcntl; 132 unsigned long runcntl;
131 133
@@ -151,6 +153,8 @@ static int spu_run_init(struct spu_context *ctx, u32 * npc)
151 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE); 153 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE);
152 } 154 }
153 155
156 spuctx_switch_state(ctx, SPU_UTIL_USER);
157
154 return 0; 158 return 0;
155} 159}
156 160
@@ -161,6 +165,8 @@ static int spu_run_fini(struct spu_context *ctx, u32 * npc,
161 165
162 *status = ctx->ops->status_read(ctx); 166 *status = ctx->ops->status_read(ctx);
163 *npc = ctx->ops->npc_read(ctx); 167 *npc = ctx->ops->npc_read(ctx);
168
169 spuctx_switch_state(ctx, SPU_UTIL_IDLE_LOADED);
164 spu_release(ctx); 170 spu_release(ctx);
165 171
166 if (signal_pending(current)) 172 if (signal_pending(current))
@@ -328,6 +334,9 @@ long spufs_run_spu(struct file *file, struct spu_context *ctx,
328 ret = spufs_wait(ctx->stop_wq, spu_stopped(ctx, &status)); 334 ret = spufs_wait(ctx->stop_wq, spu_stopped(ctx, &status));
329 if (unlikely(ret)) 335 if (unlikely(ret))
330 break; 336 break;
337
338 spuctx_switch_state(ctx, SPU_UTIL_SYSTEM);
339
331 if ((status & SPU_STATUS_STOPPED_BY_STOP) && 340 if ((status & SPU_STATUS_STOPPED_BY_STOP) &&
332 (status >> SPU_STOP_STATUS_SHIFT == 0x2104)) { 341 (status >> SPU_STOP_STATUS_SHIFT == 0x2104)) {
333 ret = spu_process_callback(ctx); 342 ret = spu_process_callback(ctx);
@@ -356,6 +365,7 @@ long spufs_run_spu(struct file *file, struct spu_context *ctx,
356 (ctx->state == SPU_STATE_RUNNABLE)) 365 (ctx->state == SPU_STATE_RUNNABLE))
357 ctx->stats.libassist++; 366 ctx->stats.libassist++;
358 367
368
359 ctx->ops->master_stop(ctx); 369 ctx->ops->master_stop(ctx);
360 ret = spu_run_fini(ctx, npc, &status); 370 ret = spu_run_fini(ctx, npc, &status);
361 spu_yield(ctx); 371 spu_yield(ctx);