diff options
author | arnd@arndb.de <arnd@arndb.de> | 2006-06-19 14:33:24 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-06-21 01:01:30 -0400 |
commit | 7b1a701480fb17b7f78b95b257bfc90a4f949d04 (patch) | |
tree | 658ea67f2b96a174b90a3de52e2251a4471c2dc4 | |
parent | 724bd80e8102ac137868b23fad2b06af65f8e168 (diff) |
[POWERPC] spufs: add a phys-id attribute to each SPU context
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.
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@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/file.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index 3bc00913fe18..80c02660e617 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c | |||
@@ -1328,6 +1328,22 @@ static u64 spufs_srr0_get(void *data) | |||
1328 | DEFINE_SIMPLE_ATTRIBUTE(spufs_srr0_ops, spufs_srr0_get, spufs_srr0_set, | 1328 | DEFINE_SIMPLE_ATTRIBUTE(spufs_srr0_ops, spufs_srr0_get, spufs_srr0_set, |
1329 | "%llx\n") | 1329 | "%llx\n") |
1330 | 1330 | ||
1331 | static u64 spufs_id_get(void *data) | ||
1332 | { | ||
1333 | struct spu_context *ctx = data; | ||
1334 | u64 num; | ||
1335 | |||
1336 | spu_acquire(ctx); | ||
1337 | if (ctx->state == SPU_STATE_RUNNABLE) | ||
1338 | num = ctx->spu->number; | ||
1339 | else | ||
1340 | num = (unsigned int)-1; | ||
1341 | spu_release(ctx); | ||
1342 | |||
1343 | return num; | ||
1344 | } | ||
1345 | DEFINE_SIMPLE_ATTRIBUTE(spufs_id_ops, spufs_id_get, 0, "0x%llx\n") | ||
1346 | |||
1331 | struct tree_descr spufs_dir_contents[] = { | 1347 | struct tree_descr spufs_dir_contents[] = { |
1332 | { "mem", &spufs_mem_fops, 0666, }, | 1348 | { "mem", &spufs_mem_fops, 0666, }, |
1333 | { "regs", &spufs_regs_fops, 0666, }, | 1349 | { "regs", &spufs_regs_fops, 0666, }, |
@@ -1351,5 +1367,6 @@ struct tree_descr spufs_dir_contents[] = { | |||
1351 | { "spu_tag_mask", &spufs_spu_tag_mask_ops, 0666, }, | 1367 | { "spu_tag_mask", &spufs_spu_tag_mask_ops, 0666, }, |
1352 | { "event_mask", &spufs_event_mask_ops, 0666, }, | 1368 | { "event_mask", &spufs_event_mask_ops, 0666, }, |
1353 | { "srr0", &spufs_srr0_ops, 0666, }, | 1369 | { "srr0", &spufs_srr0_ops, 0666, }, |
1370 | { "phys-id", &spufs_id_ops, 0666, }, | ||
1354 | {}, | 1371 | {}, |
1355 | }; | 1372 | }; |