[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux1394-devel
Subject:    Re: read_cycle_timer backwards for sub-cycle 0000, 0001
From:       Stefan Richter <stefanr () s5r6 ! in-berlin ! de>
Date:       2009-12-30 23:31:03
Message-ID: 4B3BE2B7.5030301 () s5r6 ! in-berlin ! de
[Download RAW message or body]

Håkan Johansson wrote:
> I just found when reading raw1394_read_cycle_timer in a tight loop that
> the values are not monotonically increasing.  For sub-cycles 0000 and
> 0001, it seems to consistently return the previous (unchanged) cycle
> value, i.e. time is wrong by .125 ms.  For others, I also seen spurious
> smaller mishaps.  Some examples output with the attached patch (vs
> libraw1394-2.0.4/tools/testlibraw.c):
> 
>     cycle timer: 119 3390 3003 -  1262209833.717980
>     cycle timer: 119 3390 3037 -  1262209833.717982
>   * cycle timer: 119 3390 0000 -  1262209833.717983
>     cycle timer: 119 3391 0035 -  1262209833.717985
>     cycle timer: 119 3391 0069 -  1262209833.717986
> 
>     cycle timer: 119 3411 3004 -  1262209833.720606
>     cycle timer: 119 3411 3039 -  1262209833.720607
>   * cycle timer: 119 3411 0001 -  1262209833.720608
>     cycle timer: 119 3412 0036 -  1262209833.720610
>     cycle timer: 119 3412 0071 -  1262209833.720611

This is consistent with what I heard from Pieter (Cc'd) already:  Some
controllers do not perform cycle timer register accesses atomically.  In
these two examples, the controller missed to show that the cycleTimer
part should already be increased.

There is also a second failure mode encountered with other controllers:
Sometimes the register read returns all zeros.

>     cycle timer: 119 3418 0157 -  1262209833.721365
>     cycle timer: 119 3418 0255 -  1262209833.721366
>   * cycle timer: 119 3418 0226 -  1262209833.721368
>     cycle timer: 119 3418 0261 -  1262209833.721369
>     cycle timer: 119 3418 0296 -  1262209833.721371

This one is curious.

>     cycle timer: 119 3442 3002 -  1262209833.724481
>     cycle timer: 119 3442 3037 -  1262209833.724483
>   * cycle timer: 119 3442 0000 -  1262209833.724484
>     cycle timer: 119 3443 0035 -  1262209833.724485
>     cycle timer: 119 3443 0070 -  1262209833.724487

This is again consistent with the first two examples.

> taken with kernel:
> 
> Linux version 2.6.32-trunk-686 (Debian 2.6.32-3) (ben@decadent.org.uk)
> (gcc version 4.3.4 (Debian 4.3.4-6) ) #1 SMP Thu Dec 24 05:52:30 UTC 2009
> 
> 00:0c.0 FireWire (IEEE 1394): VIA Technologies, Inc. VT6306 Fire II IEEE
> 1394 OHCI Link Layer Controller (rev 46)
> 00:0c.0 0c00: 1106:3044 (rev 46)
> 
> I've seen similar issues on the same box with a 2.6.26 kernel (using
> libraw1394-1.3.0) and also on a powerpc (again 2.6.26 and 1.3.0)

It is not a kernel issue or library issue, just a controller hardware bug.

> 0000:00:01.0 FireWire (IEEE 1394): VIA Technologies, Inc. VT6306 Fire II
> IEEE 1394 OHCI Link Layer Controller (rev 46)
> 0000:00:01.0 0c00: 1106:3044 (rev 46)
> 
> Well, it seem to be the same kind of controller in the two machines...
> This exhausts my current firewire hardware pool  :-)
> 
> Perhaps this is known from before?  I have not been able to find any
> mentioning of it however.

Cycle timer to local time conversion, together with isochronous packet
timestamps, plays an important role in FFADO.  Hence FFADO expends some
effort to detect and correct such bad register reads.
http://subversion.ffado.org/browser/trunk/libffado/src/libieee1394/CycleTimerHelper.cpp

We could note these two known hardware quirks in libraw1394's inline
function reference documentation.
-- 
Stefan Richter
-=====-==--= ==-- ====-
http://arcgraph.de/sr/

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
mailing list linux1394-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux1394-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic