summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2009-02-23 21:44:37 +0000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-03-11 17:10:15 +1100
commit8f748aae4b5eda6a6ec3ab3554e7e19c7702ccc2 (patch)
treea21c57dd939fea9e14a96731c1b4613cc81e9fa0
parent9e1e3723be3828d6faac03ff6889e78cc0e64286 (diff)
downloadblackbird-obmc-linux-8f748aae4b5eda6a6ec3ab3554e7e19c7702ccc2.tar.gz
blackbird-obmc-linux-8f748aae4b5eda6a6ec3ab3554e7e19c7702ccc2.zip
powerpc/spufs: Initialize ctx->stats.tstamp correctly
spuctx_switch_state() warns if ktime goes backwards, but it sometimes compares an uninitialized value, which showed that the data was unreliable when we actually saw the warning. Initialize it to the current time in order to get correct data. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 6653ddbed048..db5398c0339f 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -35,6 +35,8 @@ atomic_t nr_spu_contexts = ATOMIC_INIT(0);
struct spu_context *alloc_spu_context(struct spu_gang *gang)
{
struct spu_context *ctx;
+ struct timespec ts;
+
ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
if (!ctx)
goto out;
@@ -64,6 +66,8 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
__spu_update_sched_info(ctx);
spu_set_timeslice(ctx);
ctx->stats.util_state = SPU_UTIL_IDLE_LOADED;
+ ktime_get_ts(&ts);
+ ctx->stats.tstamp = timespec_to_ns(&ts);
atomic_inc(&nr_spu_contexts);
goto out;
OpenPOWER on IntegriCloud