Skip to content

Commit

Permalink
powerpc/spufs: Initialize ctx->stats.tstamp correctly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arnd Bergmann authored and Benjamin Herrenschmidt committed Mar 11, 2009
1 parent 9e1e372 commit 8f748aa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/powerpc/platforms/cell/spufs/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8f748aa

Please sign in to comment.