[Cbe-oss-dev] [RFC] spufs: add a phys-id attribute to each SPU context

Michael Ellerman michael at ellerman.id.au
Wed Apr 12 23:46:23 EST 2006


On Wed, 2006-04-12 at 15:30 +0200, Arnd Bergmann wrote:
> For performance analysis, it is often interesting to know
> which physical SPE a thread is currently running on, and,
> more importantly, if it is running at all.

Do you want to call it "running-on" to make that clearer? "phys-id" is a
little opaque.

cheers

> This patch adds a simple attribute to each SPU directory
> with that information.
> The attribute is read-only and called 'phys-id'. It contains
> an ascii string with the number of the physical SPU (e.g.
> "0x5"), or alternatively the string "0xffffffff" (32 bit -1)
> when it is not running at all at the time that the file
> is read.
> 
> Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>
> ---
> Index: linus-2.6/arch/powerpc/platforms/cell/spufs/file.c
> ===================================================================
> --- linus-2.6.orig/arch/powerpc/platforms/cell/spufs/file.c
> +++ linus-2.6/arch/powerpc/platforms/cell/spufs/file.c
> @@ -1328,6 +1328,22 @@ static u64 spufs_srr0_get(void *data)
>  DEFINE_SIMPLE_ATTRIBUTE(spufs_srr0_ops, spufs_srr0_get, spufs_srr0_set,
>  			"%llx\n")
>  
> +static u64 spufs_id_get(void *data)
> +{
> +	struct spu_context *ctx = data;
> +	u64 num;
> +
> +	spu_acquire(ctx);
> +	if (ctx->state == SPU_STATE_RUNNABLE)
> +		num = ctx->spu->number;
> +	else
> +		num = (unsigned int)-1;
> +	spu_release(ctx);
> +
> +	return num;
> +}
> +DEFINE_SIMPLE_ATTRIBUTE(spufs_id_ops, spufs_id_get, 0, "0x%llx\n")
> +
>  struct tree_descr spufs_dir_contents[] = {
>  	{ "mem",  &spufs_mem_fops,  0666, },
>  	{ "regs", &spufs_regs_fops,  0666, },
> @@ -1351,5 +1367,6 @@ struct tree_descr spufs_dir_contents[] =
>  	{ "spu_tag_mask", &spufs_spu_tag_mask_ops, 0666, },
>  	{ "event_mask", &spufs_event_mask_ops, 0666, },
>  	{ "srr0", &spufs_srr0_ops, 0666, },
> +	{ "phys-id", &spufs_id_ops, 0666, },
>  	{},
>  };
> _______________________________________________
> cbe-oss-dev mailing list
> cbe-oss-dev at ozlabs.org
> https://ozlabs.org/mailman/listinfo/cbe-oss-dev
-- 
Michael Ellerman
IBM OzLabs

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20060412/675d0c9f/attachment.pgp>


More information about the cbe-oss-dev mailing list