Re: [discuss] Re: [PATCH] Allow all Opteron processors to change pstate at same time

From: Andi Kleen
Date: Tue Jul 11 2006 - 12:03:07 EST


On Tuesday 11 July 2006 18:15, Alan Cox wrote:
> Ar Maw, 2006-07-11 am 15:14 +0200, ysgrifennodd Arjan van de Ven:
> > if you have per cpu offset and speed, then you don't even need to tie
> > all frequencies together... sounds like the best solution to me..
>
> CPU clocks on some systems are not stable relative to one another. Doing
> the maths only works if you know the divergence isn't cause by
> independant clock sources

You misunderstood the proposal (actually there is a prototype, so it's
more than that)

The reason the TSCs need to be synchronized is that gettimeofday always
takes the offset against a global variable set by the last timer interrupt.
So your TSC needs to be synchronized to the CPU of the TSC that runs
the timer interrupt.

If instead the per CPU timers set a cpu local variable then you
can do the offset calculation per CPU.

The scheduler already uses this trick by keeping sched_clock comparisions
always CPU local.

In practice there are a few more complications, but that's it in a nutshell.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/