aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs/file.c
diff options
context:
space:
mode:
authorLuke Browning <lukebrowning@us.ibm.com>2008-06-15 21:36:43 -0400
committerJeremy Kerr <jk@ozlabs.org>2008-07-08 20:13:40 -0400
commit46deed69b34d0aa6065e92ad79685e103d4ccd35 (patch)
treed66d31e0eceb3c6b5eeb0b17a673d973845474e6 /arch/powerpc/platforms/cell/spufs/file.c
parent0db9360aaa9b95b0cf67f82874809f16e68068eb (diff)
powerpc/spufs: provide context debug file
Add a ctxt file to spufs that shows spu context information that is used in scheduling. This info can be used for debugging spufs scheduler issues, and to isolate between application and spufs problems as it shows a lot of state such as priorities and dispatch counts. This file contains internal spufs state and is subject to change at any time, and therefore no applications should depend on it. The file is intended for the use of spufs kernel developers. Signed-off-by: Luke Browning <lukebrowning@us.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/file.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index f74259979cb6..fc595d0db21d 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -2555,6 +2555,58 @@ void spu_switch_log_notify(struct spu *spu, struct spu_context *ctx,
2555 wake_up(&ctx->switch_log->wait); 2555 wake_up(&ctx->switch_log->wait);
2556} 2556}
2557 2557
2558static int spufs_show_ctx(struct seq_file *s, void *private)
2559{
2560 struct spu_context *ctx = s->private;
2561 u64 mfc_control_RW;
2562
2563 mutex_lock(&ctx->state_mutex);
2564 if (ctx->spu) {
2565 struct spu *spu = ctx->spu;
2566 struct spu_priv2 __iomem *priv2 = spu->priv2;
2567
2568 spin_lock_irq(&spu->register_lock);
2569 mfc_control_RW = in_be64(&priv2->mfc_control_RW);
2570 spin_unlock_irq(&spu->register_lock);
2571 } else {
2572 struct spu_state *csa = &ctx->csa;
2573
2574 mfc_control_RW = csa->priv2.mfc_control_RW;
2575 }
2576
2577 seq_printf(s, "%c flgs(%lx) sflgs(%lx) pri(%d) ts(%d) spu(%02d)"
2578 " %c %lx %lx %lx %lx %x %x\n",
2579 ctx->state == SPU_STATE_SAVED ? 'S' : 'R',
2580 ctx->flags,
2581 ctx->sched_flags,
2582 ctx->prio,
2583 ctx->time_slice,
2584 ctx->spu ? ctx->spu->number : -1,
2585 !list_empty(&ctx->rq) ? 'q' : ' ',
2586 ctx->csa.class_0_pending,
2587 ctx->csa.class_0_dar,
2588 ctx->csa.class_1_dsisr,
2589 mfc_control_RW,
2590 ctx->ops->runcntl_read(ctx),
2591 ctx->ops->status_read(ctx));
2592
2593 mutex_unlock(&ctx->state_mutex);
2594
2595 return 0;
2596}
2597
2598static int spufs_ctx_open(struct inode *inode, struct file *file)
2599{
2600 return single_open(file, spufs_show_ctx, SPUFS_I(inode)->i_ctx);
2601}
2602
2603static const struct file_operations spufs_ctx_fops = {
2604 .open = spufs_ctx_open,
2605 .read = seq_read,
2606 .llseek = seq_lseek,
2607 .release = single_release,
2608};
2609
2558struct tree_descr spufs_dir_contents[] = { 2610struct tree_descr spufs_dir_contents[] = {
2559 { "capabilities", &spufs_caps_fops, 0444, }, 2611 { "capabilities", &spufs_caps_fops, 0444, },
2560 { "mem", &spufs_mem_fops, 0666, }, 2612 { "mem", &spufs_mem_fops, 0666, },
@@ -2591,6 +2643,7 @@ struct tree_descr spufs_dir_contents[] = {
2591 { "tid", &spufs_tid_fops, 0444, }, 2643 { "tid", &spufs_tid_fops, 0444, },
2592 { "stat", &spufs_stat_fops, 0444, }, 2644 { "stat", &spufs_stat_fops, 0444, },
2593 { "switch_log", &spufs_switch_log_fops, 0444 }, 2645 { "switch_log", &spufs_switch_log_fops, 0444 },
2646 { ".ctx", &spufs_ctx_fops, 0444, },
2594 {}, 2647 {},
2595}; 2648};
2596 2649
@@ -2616,6 +2669,7 @@ struct tree_descr spufs_dir_nosched_contents[] = {
2616 { "object-id", &spufs_object_id_ops, 0666, }, 2669 { "object-id", &spufs_object_id_ops, 0666, },
2617 { "tid", &spufs_tid_fops, 0444, }, 2670 { "tid", &spufs_tid_fops, 0444, },
2618 { "stat", &spufs_stat_fops, 0444, }, 2671 { "stat", &spufs_stat_fops, 0444, },
2672 { ".ctx", &spufs_ctx_fops, 0444, },
2619 {}, 2673 {},
2620}; 2674};
2621 2675