All of lore.kernel.org
 help / color / mirror / Atom feed
From: george anzinger <george@mvista.com>
To: Xinwen - Fu <xinwenfu@cs.tamu.edu>
Cc: root@chaos.analogic.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: kernel timers vs network card interrupt
Date: Thu, 04 Jul 2002 23:11:57 -0700	[thread overview]
Message-ID: <3D2538AD.E255167C@mvista.com> (raw)
In-Reply-To: Pine.SOL.4.10.10207041109300.12365-100000@dogbert

Xinwen - Fu wrote:
> 
>         In fact I want a timer (either in user level or kernel level).
> This timer (hope it is a periodic timer) must expire at the interval that
> I specify. For example, if I
> want that the timer expires at 10ms, it should never be fired at
> 10.0000000001ms or
> 9.9999999999ms. That is the key part that I want!

10 nines!  Lots of luck.  You need to spend a LOT more money
than I have.  Cesium clocks may be able to do this, but not
computers...

But first, please define "fire".  If you mean that the
interrupt is generated at this rate, well we can do maybe  4
or 5 nines.  If, on the other hand you mean "your timer
function gets cpu cycles", I don't think you will find a
machine that can do much better than one or 2 nines.  Even
if the timer is the only interrupt, you still have interrupt
off times and cache indeterminism to contend with.

If the idea is to to "tickle" some hardware with this
signal, you will do better to not involve a computer in the
link.

The utime project had some software that would schedule a
timer tick early and then loop reading the TSC until the
"exact" time.  This still has the problems of interrupts and
cache misses, but it is probably the only way to approach
what you want.  Nothing magic, you just figure the worst
case latency and set your timer to expire early enough to be
ahead of the appointed time.  Then you loop on the TSC
waiting for your exact time.

-g
> 
>         Have an idea?
> 
>         Thanks!
> 
> Xinwen Fu
> 
> On Thu, 4 Jul 2002, george anzinger wrote:
> 
> > "Richard B. Johnson" wrote:
> > >
> > > On Wed, 3 Jul 2002, Xinwen - Fu wrote:
> > >
> > > > Hi, all,
> > > >       I'm curious that if a network card interrupt happens at the same
> > > > time as the kernel timer expires, what will happen?
> > > >
> > > >       It's said the kernel timer is guaranteed accurate. But if
> > > > interrupts are not masked off, the network interrupt also should get
> > > > response when a kernel timer expires. So I don't know who will preempt
> > > > who.
> > > >
> > > >       Thanks for information!
> > > >
> > > > Xinwen Fu
> > >
> > > The highest priority interrupt will get serviced first. It's the timer.
> > > Interrupts are serviced in priority-order. Hardware "remembers" which
> > > ones are pending so none are lost if some driver doesn't do something
> > > stupid.
> >
> > That is true as far as it goes, HOWEVER, timers are serviced
> > by bottom half code which is run at the end of the
> > interrupt, WITH THE INTERRUPT SYSTEM ON.  Therefore, timer
> > servicing can be interrupted by an interrupt and thus be
> > delayed.
> >
> > --
> > George Anzinger   george@mvista.com
> > High-res-timers:
> > http://sourceforge.net/projects/high-res-timers/
> > Real time sched:  http://sourceforge.net/projects/rtsched/
> > Preemption patch:
> > http://www.kernel.org/pub/linux/kernel/people/rml
> >

-- 
George Anzinger   george@mvista.com
High-res-timers: 
http://sourceforge.net/projects/high-res-timers/
Real time sched:  http://sourceforge.net/projects/rtsched/
Preemption patch:
http://www.kernel.org/pub/linux/kernel/people/rml

  parent reply	other threads:[~2002-07-05  6:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-03 18:12 kernel timers vs network card interrupt Xinwen - Fu
2002-07-03 18:35 ` Richard B. Johnson
2002-07-03 23:54   ` timer queue is still influenced by network load Xinwen - Fu
2002-07-08 12:27     ` Richard B. Johnson
2002-07-04  7:46   ` kernel timers vs network card interrupt george anzinger
2002-07-04 16:10     ` Xinwen - Fu
2002-07-04 18:30       ` Mark Hahn
2002-07-05  6:11       ` george anzinger [this message]
2002-07-05 18:50         ` Xinwen - Fu
2002-07-06  4:21       ` Bill Davidsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D2538AD.E255167C@mvista.com \
    --to=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    --cc=xinwenfu@cs.tamu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.