diff options
author | Christoph Hellwig <hch@lst.de> | 2007-06-28 20:58:01 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-07-03 01:24:45 -0400 |
commit | 476273adc7277333aed9963bc4dc9b39066d3038 (patch) | |
tree | c134d69a196296a744e2b1dd4720a490d275d37e | |
parent | 7022543ee404880aab5c641e4983e237815edc35 (diff) |
[POWERPC] spufs: Add tid file
The new tid file contains the ID of the thread currently running the
context, if any. This is used so that the new spu-top and spu-ps
tools can find the thread in /proc.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/file.c | 22 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/sched.c | 7 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/spufs.h | 3 |
3 files changed, 32 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index 2e84ed5ae67b..2bb51ca51a6c 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c | |||
@@ -2039,6 +2039,26 @@ static const struct file_operations spufs_proxydma_info_fops = { | |||
2039 | .read = spufs_proxydma_info_read, | 2039 | .read = spufs_proxydma_info_read, |
2040 | }; | 2040 | }; |
2041 | 2041 | ||
2042 | static int spufs_show_tid(struct seq_file *s, void *private) | ||
2043 | { | ||
2044 | struct spu_context *ctx = s->private; | ||
2045 | |||
2046 | seq_printf(s, "%d\n", ctx->tid); | ||
2047 | return 0; | ||
2048 | } | ||
2049 | |||
2050 | static int spufs_tid_open(struct inode *inode, struct file *file) | ||
2051 | { | ||
2052 | return single_open(file, spufs_show_tid, SPUFS_I(inode)->i_ctx); | ||
2053 | } | ||
2054 | |||
2055 | static const struct file_operations spufs_tid_fops = { | ||
2056 | .open = spufs_tid_open, | ||
2057 | .read = seq_read, | ||
2058 | .llseek = seq_lseek, | ||
2059 | .release = single_release, | ||
2060 | }; | ||
2061 | |||
2042 | struct tree_descr spufs_dir_contents[] = { | 2062 | struct tree_descr spufs_dir_contents[] = { |
2043 | { "capabilities", &spufs_caps_fops, 0444, }, | 2063 | { "capabilities", &spufs_caps_fops, 0444, }, |
2044 | { "mem", &spufs_mem_fops, 0666, }, | 2064 | { "mem", &spufs_mem_fops, 0666, }, |
@@ -2072,6 +2092,7 @@ struct tree_descr spufs_dir_contents[] = { | |||
2072 | { "wbox_info", &spufs_wbox_info_fops, 0444, }, | 2092 | { "wbox_info", &spufs_wbox_info_fops, 0444, }, |
2073 | { "dma_info", &spufs_dma_info_fops, 0444, }, | 2093 | { "dma_info", &spufs_dma_info_fops, 0444, }, |
2074 | { "proxydma_info", &spufs_proxydma_info_fops, 0444, }, | 2094 | { "proxydma_info", &spufs_proxydma_info_fops, 0444, }, |
2095 | { "tid", &spufs_tid_fops, 0444, }, | ||
2075 | {}, | 2096 | {}, |
2076 | }; | 2097 | }; |
2077 | 2098 | ||
@@ -2095,6 +2116,7 @@ struct tree_descr spufs_dir_nosched_contents[] = { | |||
2095 | { "psmap", &spufs_psmap_fops, 0666, }, | 2116 | { "psmap", &spufs_psmap_fops, 0666, }, |
2096 | { "phys-id", &spufs_id_ops, 0666, }, | 2117 | { "phys-id", &spufs_id_ops, 0666, }, |
2097 | { "object-id", &spufs_object_id_ops, 0666, }, | 2118 | { "object-id", &spufs_object_id_ops, 0666, }, |
2119 | { "tid", &spufs_tid_fops, 0444, }, | ||
2098 | {}, | 2120 | {}, |
2099 | }; | 2121 | }; |
2100 | 2122 | ||
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 4381dd00d231..540067550e88 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
@@ -102,6 +102,13 @@ void spu_set_timeslice(struct spu_context *ctx) | |||
102 | void __spu_update_sched_info(struct spu_context *ctx) | 102 | void __spu_update_sched_info(struct spu_context *ctx) |
103 | { | 103 | { |
104 | /* | 104 | /* |
105 | * 32-Bit assignment are atomic on powerpc, and we don't care about | ||
106 | * memory ordering here because retriving the controlling thread is | ||
107 | * per defintion racy. | ||
108 | */ | ||
109 | ctx->tid = current->pid; | ||
110 | |||
111 | /* | ||
105 | * We do our own priority calculations, so we normally want | 112 | * We do our own priority calculations, so we normally want |
106 | * ->static_prio to start with. Unfortunately thies field | 113 | * ->static_prio to start with. Unfortunately thies field |
107 | * contains junk for threads with a realtime scheduling | 114 | * contains junk for threads with a realtime scheduling |
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h index dab8858b6995..8ff16b4b6bd7 100644 --- a/arch/powerpc/platforms/cell/spufs/spufs.h +++ b/arch/powerpc/platforms/cell/spufs/spufs.h | |||
@@ -77,6 +77,9 @@ struct spu_context { | |||
77 | struct list_head gang_list; | 77 | struct list_head gang_list; |
78 | struct spu_gang *gang; | 78 | struct spu_gang *gang; |
79 | 79 | ||
80 | /* owner thread */ | ||
81 | pid_t tid; | ||
82 | |||
80 | /* scheduler fields */ | 83 | /* scheduler fields */ |
81 | struct list_head rq; | 84 | struct list_head rq; |
82 | unsigned int time_slice; | 85 | unsigned int time_slice; |