summaryrefslogtreecommitdiff
path: root/arch/powerpc/platforms/cell/spufs/spufs.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2008-04-29 17:08:38 +1000
committerJeremy Kerr <jk@ozlabs.org>2008-04-30 15:01:54 +1000
commit5158e9b5218bd3799c9fa8c401ad24d7f0c0a0a1 (patch)
tree4ed17672fe0582c46f594217ba410ec92aebfb45 /arch/powerpc/platforms/cell/spufs/spufs.h
parent14b3ca4022f050f8622ed282b734ddf445464583 (diff)
[POWERPC] spufs: add context switch notification log
There are userspace instrumentation tools that need to monitor spu context switches. This patch adds a new file called 'switch_log' to each spufs context directory that can be used to monitor the context switches. Context switch in/out and exit from spu_run are monitored after the file was first opened and can be read from it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/spufs.h')
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index cdc515182f82..dd63b16bb072 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -47,6 +47,30 @@ enum {
SPU_SCHED_SPU_RUN, /* context is within spu_run */
};
+enum {
+ SWITCH_LOG_BUFSIZE = 4096,
+};
+
+enum {
+ SWITCH_LOG_START,
+ SWITCH_LOG_STOP,
+ SWITCH_LOG_EXIT,
+};
+
+struct switch_log {
+ spinlock_t lock;
+ wait_queue_head_t wait;
+ unsigned long head;
+ unsigned long tail;
+ struct switch_log_entry {
+ struct timespec tstamp;
+ s32 spu_id;
+ u32 type;
+ u32 val;
+ u64 timebase;
+ } log[];
+};
+
struct spu_context {
struct spu *spu; /* pointer to a physical SPU */
struct spu_state csa; /* SPU context save area. */
@@ -116,6 +140,9 @@ struct spu_context {
unsigned long long libassist;
} stats;
+ /* context switch log */
+ struct switch_log *switch_log;
+
struct list_head aff_list;
int aff_head;
int aff_offset;
@@ -256,6 +283,8 @@ int spu_activate(struct spu_context *ctx, unsigned long flags);
void spu_deactivate(struct spu_context *ctx);
void spu_yield(struct spu_context *ctx);
void spu_switch_notify(struct spu *spu, struct spu_context *ctx);
+void spu_switch_log_notify(struct spu *spu, struct spu_context *ctx,
+ u32 type, u32 val);
void spu_set_timeslice(struct spu_context *ctx);
void spu_update_sched_info(struct spu_context *ctx);
void __spu_update_sched_info(struct spu_context *ctx);