[Cbe-oss-dev] [PATCH 1/2]MARS/core: Tick counter api

Arnd Bergmann arnd at arndb.de
Tue Nov 25 23:50:28 EST 2008


On Tuesday 25 November 2008, Kazunori Asayama wrote:
> Arnd Bergmann wrote:
> > The 32 bit version is ok, the 64 bit version is not. In general, it's much
> 
> I suppose even the 32bit version doesn't fix the problem. It looks like
> the 32bit version considers only the case that upper 32bits are changed
> by carry while reading lower 32bits.

IIRC, that is sufficient. The problem in 64-bit mode only shows up
because we try to read both halves at the same time. In 32-bit mode
they are read in order, so the logic covers both problems.

> > easier to just use the gettimeofday() libc function, which is almost as
> > fast, and is guaranteed to work correctly.
> 
> For our purposes, gettimeofday is insufficient. Our major motivation to
> add this API function is to measure performance of various elements of
> MARS (including the scheduler). However, SPU's gettimeofday issues 'stop
> and signal' internally, so it has significant side effect on behavior of
> MARS. If we use gettimeofday only on PPU side, it will become difficult
> to measure time between PPU-SPU and/or SPU-SPU without significant side
> effect or error of measurement (see 'background' part in my patch).

Right. Note that the two are not synchronized though, and you have to
manually check the offset between the SPU decrementer (in each task)
and the PPU system wide timebase.

> > 
> > In general, functions named __foo are internal to the implementation and
> > should not be used directly.
> 
> As I mentioned in my previous message, __mftb is one of PPU intrinsics
> which are defined in "C/C++ Language Extensions for Cell
> Broadband Engine Architecture", so I believe they are public. (all PPU
> intrinsics begin with '__')

Ok, then they are just named inappropriately.

	Arnd <><



More information about the cbe-oss-dev mailing list