Continual reading from the PowerPc time base register is not stable

Csdncannon csdncannon at gmail.com
Tue Apr 6 18:02:39 EST 2010


Hi guys
       In fact my problem is gettimeofday cannot return right value
sometimes, and this will bring instability to our system software. You can
find a law from the log that there is a 17592 seconds' shift every time
error occurs.



2010/3/26 Csdncannon <csdncannon at gmail.com>

> Yes, the missing 64-bit conversion is the key problem, I will try removing
> isync later.
>
> Thanks for your support.
>
>
> 2010/3/26 Segher Boessenkool <segher at kernel.crashing.org>
>
>> > Yes indeed.  Could you post the relevant piece if disassembly from
>>
>> > your original binary (the one that has the problem)?  Or send me the
>> > binary (not to the mailing list), I'll do it then.
>>
>> Ah scratch that.  I compiled your original code (after fixing the
>> compile errors -- there is no such type as "bool" in C).
>>
>> The problem is that  (upper << 32) | lower  thing.  "upper" is a 32-bit
>> type, so shifting it by 32 or more bits is undefined.  GCC compiles this
>> to (shortened):
>>
>> 0: mftbu 9 ; mftbl 11 ; mftbu 0 ; cmpw 0,9 ; bne 0b  # so far so good
>>   slwi 0,0,0 ; or 4,0,11 ; li 3,0 ; blr
>>
>> so it shifts by 0, i.e. it does  upper | lower .
>>
>> Case closed, no hardware problem :-)
>>
>>
>> Segher
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20100406/2fbec47e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gettime.c
Type: application/octet-stream
Size: 1111 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20100406/2fbec47e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gettime.log
Type: application/octet-stream
Size: 939 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20100406/2fbec47e/attachment-0001.obj>


More information about the Linuxppc-dev mailing list