[Cbe-oss-dev] [PATCH 7:7] spusched: provide new spufs file for debugging spu scheduling

Luke Browning lukebr at linux.vnet.ibm.com
Tue May 13 09:52:49 EST 2008


Provide ctxt debug file

Add a ctxt file to the spu virtual file system that shows 
spu context information used in scheduling.

Signed-off-by: Luke Browning <lukebrowning at us.ibm.com>

---
Index: spufs/arch/powerpc/platforms/cell/spufs/file.c
===================================================================
--- spufs.orig/arch/powerpc/platforms/cell/spufs/file.c
+++ spufs/arch/powerpc/platforms/cell/spufs/file.c
@@ -2411,6 +2411,52 @@ static const struct file_operations spuf
 	.release	= single_release,
 };
 
+static int spufs_show_ctxt(struct seq_file *s, void *private)
+{
+	struct spu_context *ctx = s->private;
+	u64 mfc_control_RW;
+
+	if (ctx->spu) {
+		struct spu *spu = ctx->spu;
+		struct spu_priv2 __iomem *priv2 = spu->priv2;
+
+		mfc_control_RW = in_be64(&priv2->mfc_control_RW);
+	}
+	else {
+		struct spu_state *csa = &ctx->csa;
+
+		mfc_control_RW = csa->priv2.mfc_control_RW;
+	}
+
+	seq_printf(s, "%c flgs(%lx) sflgs(%lx) ts(%d) spu(%02d)"
+			" %c %lx %lx %lx %lx %x %x\n",
+		ctx->state == SPU_STATE_SAVED ? 'S' : 'R',
+		ctx->flags,
+		ctx->sched_flags,
+		ctx->time_slice,
+		ctx->spu ? ctx->spu->number : -1,
+		!list_empty(&ctx->rq) ? 'q' : ' ',
+		ctx->csa.class_0_pending,
+		ctx->csa.class_0_dar,
+		ctx->csa.class_1_dsisr,
+		mfc_control_RW,
+		ctx->ops->runcntl_read(ctx),
+		ctx->ops->status_read(ctx));
+
+	return 0;
+}
+
+static int spufs_ctxt_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, spufs_show_ctxt, SPUFS_I(inode)->i_ctx);
+}
+
+static const struct file_operations spufs_ctxt_fops = {
+	.open           = spufs_ctxt_open,
+	.read           = seq_read,
+	.llseek         = seq_lseek,
+	.release        = single_release,
+};
 
 struct tree_descr spufs_dir_contents[] = {
 	{ "capabilities", &spufs_caps_fops, 0444, },
@@ -2447,6 +2493,7 @@ struct tree_descr spufs_dir_contents[] =
 	{ "proxydma_info", &spufs_proxydma_info_fops, 0444, },
 	{ "tid", &spufs_tid_fops, 0444, },
 	{ "stat", &spufs_stat_fops, 0444, },
+	{ "ctxt", &spufs_ctxt_fops, 0444, },
 	{},
 };
 
@@ -2472,6 +2519,7 @@ struct tree_descr spufs_dir_nosched_cont
 	{ "object-id", &spufs_object_id_ops, 0666, },
 	{ "tid", &spufs_tid_fops, 0444, },
 	{ "stat", &spufs_stat_fops, 0444, },
+	{ "ctxt", &spufs_ctxt_fops, 0444, },
 	{},
 };
 





More information about the cbe-oss-dev mailing list