public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* How much we can trust packet timestamping
@ 2002-12-30 11:28 uaca
  2002-12-30 13:09 ` Alan Cox
  0 siblings, 1 reply; 7+ messages in thread
From: uaca @ 2002-12-30 11:28 UTC (permalink / raw)
  To: linux-kernel

Hi all

IMHO The problem is quite complicated because

+ common hardware is not designed for real time:

	- sends multiple PDUs within one interrupt, and can be delayed
	- Host adapter bus & infraestructure is not designed to garantee latency
  	etc...
     
+ software is also not designed for realtime

	- drivers may timestamp in softirq's
	- irqs has no deterministic latency either
	etc...

So even if do_gettimeofday() has 1/CPUfreq resolution by using TSC register
packet timestamping meassurement is biased, how much?

anybody has studied this? are there reports/doc about this topic?

of course, this can be avoided by using specialiced hardware, but I'm not
interested on that and I would like to know how much I can trust this
timestamps

Any comment would be greatly appreciated

Thanks

	Ulisses

                Debian GNU/Linux: a dream come true
-----------------------------------------------------------------------------
"Computers are useless. They can only give answers."            Pablo Picasso

--->	Visita http://www.valux.org/ para saber acerca de la	<---
--->	Asociación Valenciana de Usuarios de Linux		<---

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How much we can trust packet timestamping
  2002-12-30 13:09 ` Alan Cox
@ 2002-12-30 13:01   ` uaca
  2002-12-30 15:10     ` Alan Cox
  2003-01-10 22:07   ` Werner Almesberger
  1 sibling, 1 reply; 7+ messages in thread
From: uaca @ 2002-12-30 13:01 UTC (permalink / raw)
  To: linux-kernel

On Mon, Dec 30, 2002 at 01:09:03PM +0000, Alan Cox wrote:
> On Mon, 2002-12-30 at 11:28, uaca@alumni.uv.es wrote:
> > Hi all
> > 
> > IMHO The problem is quite complicated because
> > 
> > + common hardware is not designed for real time:
> > 
> > 	- sends multiple PDUs within one interrupt, and can be delayed
> > 	- Host adapter bus & infraestructure is not designed to garantee latency
> >   	etc...
> 
> The packet can be timestamped by the hardware receiving as well as by
> the kernel netif_rx code. This is actually intentional and there is
> hardware that supports doing IRQ raise time sampling which the driver
> can then use to get very accurate data.

Thanks Alan

Anybody know about a Linux driver that supports doing IRQ raise time
sampling? any doc/pointer/suggestion would be greatly appreciated

Thanks in advance

	Ulisses
                Debian GNU/Linux: a dream come true
-----------------------------------------------------------------------------
"Computers are useless. They can only give answers."            Pablo Picasso

--->	Visita http://www.valux.org/ para saber acerca de la	<---
--->	Asociación Valenciana de Usuarios de Linux		<---
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How much we can trust packet timestamping
  2002-12-30 11:28 How much we can trust packet timestamping uaca
@ 2002-12-30 13:09 ` Alan Cox
  2002-12-30 13:01   ` uaca
  2003-01-10 22:07   ` Werner Almesberger
  0 siblings, 2 replies; 7+ messages in thread
From: Alan Cox @ 2002-12-30 13:09 UTC (permalink / raw)
  To: uaca; +Cc: Linux Kernel Mailing List

On Mon, 2002-12-30 at 11:28, uaca@alumni.uv.es wrote:
> Hi all
> 
> IMHO The problem is quite complicated because
> 
> + common hardware is not designed for real time:
> 
> 	- sends multiple PDUs within one interrupt, and can be delayed
> 	- Host adapter bus & infraestructure is not designed to garantee latency
>   	etc...

The packet can be timestamped by the hardware receiving as well as by
the kernel netif_rx code. This is actually intentional and there is
hardware that supports doing IRQ raise time sampling which the driver
can then use to get very accurate data.

Alan


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How much we can trust packet timestamping
  2002-12-30 13:01   ` uaca
@ 2002-12-30 15:10     ` Alan Cox
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Cox @ 2002-12-30 15:10 UTC (permalink / raw)
  To: uaca; +Cc: Linux Kernel Mailing List

On Mon, 2002-12-30 at 13:01, uaca@alumni.uv.es wrote:
> Anybody know about a Linux driver that supports doing IRQ raise time
> sampling? any doc/pointer/suggestion would be greatly appreciated

Caederus has engineers who did the ISA bus hardware that led to the
SIOCGSTAMP facility in the first place (then the tcpdump type folks
decided it was really rather cool so it went generic anyway)

www.caederus.co.uk

I don't know if anyone is doing this in the PCI bus world


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How much we can trust packet timestamping
  2002-12-30 13:09 ` Alan Cox
  2002-12-30 13:01   ` uaca
@ 2003-01-10 22:07   ` Werner Almesberger
  2003-01-11  2:43     ` Alan Cox
  1 sibling, 1 reply; 7+ messages in thread
From: Werner Almesberger @ 2003-01-10 22:07 UTC (permalink / raw)
  To: Alan Cox; +Cc: uaca, Linux Kernel Mailing List, dveitch

Alan Cox wrote:
> The packet can be timestamped by the hardware receiving as well as by
> the kernel netif_rx code. This is actually intentional and there is
> hardware that supports doing IRQ raise time sampling which the driver
> can then use to get very accurate data.

By the way, the group of Darryl Veitch have done some extremely
interesting work with high-resolution timestamps, in particular
using the TSC on recent ia32:

http://www.cubinlab.ee.mu.oz.au/probing/
http://www.cubinlab.ee.mu.oz.au/~darryl/tscclock_final.pdf.gz

One general issue in this area is what we can do with time
sources that aren't system-wide, e.g. NIC-local timers. The
problem is to calibrate them and to synchronize them to
wall-clock time. I think there are basically two possible
approaches:

 1) driver gives time synchronization system (in user-space)
    access to "raw" running timer value. Timestamps are also
    "raw" timer values, plus a time source ID, which can then
    be used to convert the values to wall-clock time.

 2) user space pushes exact time to kernel space, which then
    does all the math. Timestamps are already converted to
    wall-clock time.

2) is essentially what we can do with today's interfaces (an
event notifier would be useful, though). The big drawback is
that non-trivial math would have to be done in kernel space.
1) is much easier on the kernel, but has the issue of
requiring some API to get time values and time source
characteristics (time representation, range, etc.).

I'm leaning towards solution 1), because it keeps things simple
for the kernel. But perhaps the best approach is to simply
implement both, and then compare ...

- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, Buenos Aires, Argentina         wa@almesberger.net /
/_http://www.almesberger.net/____________________________________________/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How much we can trust packet timestamping
  2003-01-10 22:07   ` Werner Almesberger
@ 2003-01-11  2:43     ` Alan Cox
  2003-01-12 23:04       ` Werner Almesberger
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Cox @ 2003-01-11  2:43 UTC (permalink / raw)
  To: Werner Almesberger; +Cc: uaca, Linux Kernel Mailing List, dveitch

On Fri, 2003-01-10 at 22:07, Werner Almesberger wrote:
> One general issue in this area is what we can do with time
> sources that aren't system-wide, e.g. NIC-local timers. The
> problem is to calibrate them and to synchronize them to
> wall-clock time. I think there are basically two possible
> approaches:

You run NTP between the host clock and the nic timer. Its
all you really need. In the i2it hardware the NIC clock 
implemented hardware slewing so it could do NTP stuff


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How much we can trust packet timestamping
  2003-01-11  2:43     ` Alan Cox
@ 2003-01-12 23:04       ` Werner Almesberger
  0 siblings, 0 replies; 7+ messages in thread
From: Werner Almesberger @ 2003-01-12 23:04 UTC (permalink / raw)
  To: Alan Cox; +Cc: uaca, Linux Kernel Mailing List, dveitch

Alan Cox wrote:
> You run NTP between the host clock and the nic timer.

While NTP is a good synchronization source (frequently the only
affordable one around), I'm not so sure it's such a good tool
for correcting drift. If you have a look at figure 5 in
http://www.cubinlab.ee.mu.oz.au/~darryl/tscclock_final.pdf.gz
you'll see that NTP uses drift to correct for offset errors, so
using NTP directly doesn't yield a clock that remains stable
unless it's constantly getting corrected by NTP.

What should work better is to use NTP only as a reference for
offset, and then calibrate the hardware clock from that.
Particularly the TSC is very stable, so there isn't much drift
to worry about.

But what I'm after is the interface between kernel and user space,
and any kernel-internal interfaces that may be needed. If people
really want to use NTP directly on hardware clocks, I guess my
approach 1) (export everything to user space, and let user space
worry about the details) would then be the appropriately flexible
choice ?

- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, Buenos Aires, Argentina         wa@almesberger.net /
/_http://www.almesberger.net/____________________________________________/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-01-12 22:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-30 11:28 How much we can trust packet timestamping uaca
2002-12-30 13:09 ` Alan Cox
2002-12-30 13:01   ` uaca
2002-12-30 15:10     ` Alan Cox
2003-01-10 22:07   ` Werner Almesberger
2003-01-11  2:43     ` Alan Cox
2003-01-12 23:04       ` Werner Almesberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox