Commit 8f748aae authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Benjamin Herrenschmidt

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: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 9e1e3723
...@@ -35,6 +35,8 @@ atomic_t nr_spu_contexts = ATOMIC_INIT(0); ...@@ -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 *alloc_spu_context(struct spu_gang *gang)
{ {
struct spu_context *ctx; struct spu_context *ctx;
struct timespec ts;
ctx = kzalloc(sizeof *ctx, GFP_KERNEL); ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
if (!ctx) if (!ctx)
goto out; goto out;
...@@ -64,6 +66,8 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang) ...@@ -64,6 +66,8 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
__spu_update_sched_info(ctx); __spu_update_sched_info(ctx);
spu_set_timeslice(ctx); spu_set_timeslice(ctx);
ctx->stats.util_state = SPU_UTIL_IDLE_LOADED; ctx->stats.util_state = SPU_UTIL_IDLE_LOADED;
ktime_get_ts(&ts);
ctx->stats.tstamp = timespec_to_ns(&ts);
atomic_inc(&nr_spu_contexts); atomic_inc(&nr_spu_contexts);
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment