All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Anzinger <george@mvista.com>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, johnstul@us.ibm.com,
	paulmck@us.ibm.com, hch@infradead.org, oleg@tv-sign.ru,
	tim.bird@am.sony.com
Subject: Re: [PATCH]  ktimers subsystem 2.6.14-rc2-kt5
Date: Mon, 17 Oct 2005 18:03:24 -0700	[thread overview]
Message-ID: <435449DC.8070109@mvista.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0510180032420.1386@scrub.home>

Roman Zippel wrote:
> Hi,
> 
> On Mon, 17 Oct 2005, Thomas Gleixner wrote:
> 
> 
>>On Mon, 2005-10-17 at 18:25 +0200, Roman Zippel wrote:
>>
~
>>interval, overrun:
>>Interval holds the converted interval value for itimers. The overrun
>>member is used by the rearm code so the caller can figure out the number
>>of missed events. 
>>
>>The cleanup I pointed out for the posix timer interval timers is pretty
>>obvious. It makes use of interval and overrun and removes two members of
>>the posix timer structure.
> 
> 
> Where I think it's possible to separate the timer from the interval 
> functionality to get a simpler timer base implementation.

They are required fields for the POSIX timer.  I think you are saying that they should be there and 
not in the ktime struct, which is part of the POSIX timer struct.  Is that right?

Along this line, I have a bit of a problem with the ktimer code doing the timer repeat stuff.  This 
is NOT used by POSIX timers because we want to wait for the user to pick up the signal before 
starting the next interval.  This is key to avoiding timer storms and I would think that puting the 
repeat stuff in ktimer code opens it to the possibility of other users starting a timer storm via 
this.  I think the itimer code should also use the signal call back to start the next interval, and 
for the same reason.
> 
> 
~
>>>- resolution handling: at what resolution should/does the kernel work and 
>>>what do we report to user space. The spec allows multiple interpretations 
>>>and I have a hard time to get at least one coherent interpretation out of 
>>>Thomas.
>>
>>I interpret the spec in the way I do for following reasons:
>>
>>1. It is _usual practice_ to return the "timer" resolution for
>>clock_res() and to return clock values with as much resolution as
>>possible. In no case should the actual clock resolution be less than
>>what clock_res() returns.
>>- George Anzinger in this thread. Similar opinions can be found via
>>Google. I came to the same conclusion and saw no reason to repeat
>>Georges statement. I thought a simple pointer would be sufficient.
> 
> 
> In this case you don't interpret the spec, you ignore the spec. (I'll 
> leave it open whether that's a good or bad thing.)

Eh?  Granted we don't truncate the time on settime, but how else is it ignored?
> 
> 
>>2. The rounding to the resolution value is explicitly required by the
>>standard.
> 
> 
> It doesn't explicitly specify which resolution (see the previous mail).
> It doesn't explicitly specify how this rounding has to be implemented.

In the timer_settime() call there is only one possible resolution refered to, that of the specified 
clock.  The standard says(http://www.opengroup.org/onlinepubs/009695399/functions/timer_settime.html):

Time values that are between two consecutive non-negative integer multiples of the resolution of the 
specified timer shall be rounded up to the larger multiple of the resolution. Quantization error 
shall not cause the timer to expire earlier than the rounded time value.

This says a) round to the next resolution, and b) don't allow the resulting timer to expire early. 
The implication is that timers are to expire on resolution boundries so we need to round such that 
the expire happens _after_ the rounded time.

Am I missing something here?

The assumption, that I think you made, that we can let the hardware do the rounding runs contrary to 
one of the main reasons for resolution, i.e. to group timers so that we can reduce the system 
overhead.  Just because we have timer hardware with microsecond resolution is not reason enough to 
offer it to the user as handling an interrupt every micro second is way too much overhead, and, in 
most cases, the user doesn't even want to such a fine resolution.
> 
> 
>>3. It makes a lot of sense to do what (1.) describes, due to the fact
>>that we actually want to restrict the timer resolution to avoid
>>interrupt and reprogramming floods in very short intervals. This in fact
>>is the default behaviour in a jiffy driven environment. Pretending a
>>real nsec resolution and doing no rounding at all is violating (2.).
>>>From an application programmers view it makes sense to return the timer
>>resolution so he actually can adjust the program behaviour on the
>>provided resolution and not rely on wild guess assumptions about what
>>might be there. Applications need to be able to verify whether the
>>system can handle the required intervals or not.
> 
> 
> A portable application simply cannot make this assumption.

POSIX clocks and timers are part of the REAL TIME POSIX extension.  Arguing that real time apps need 
to be portable is, I think, rather beside the point.  At the same time, if rounding follows the 
rules, one can set up a timer_settime() timer_gettime() sequence to get the resolution, even with 
the itimer one can do this.  So resolution is available to the user in one way or another.  What he 
does with it is up to him, but at least some RT apps. set up timer to expire early and after expiry, 
busy wait until the "appointed" time.  Knowing the resolution helps to know how to set this up...
~
-- 
George Anzinger   george@mvista.com
HRT (High-res-timers):  http://sourceforge.net/projects/high-res-timers/

  reply	other threads:[~2005-10-18  1:04 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-28 20:43 [PATCH] ktimers subsystem 2.6.14-rc2-kt5 tglx
2005-09-28 23:59 ` Frank Sorenson
2005-09-29  0:50   ` Frank Sorenson
2005-09-29  0:56     ` john stultz
2005-09-29  1:05       ` Frank Sorenson
2005-09-29  1:10 ` john stultz
2005-09-29  6:53   ` Thomas Gleixner
2005-09-30 15:58     ` Frank Sorenson
2005-09-29 19:57 ` George Anzinger
2005-10-01  1:03 ` Roman Zippel
2005-10-01 11:22   ` Ingo Molnar
2005-10-04  1:59     ` George Anzinger
2005-10-04  5:51       ` Ingo Molnar
2005-10-10 12:42     ` Roman Zippel
2005-10-10 14:04       ` Ingo Molnar
2005-10-01 12:05   ` Thomas Gleixner
2005-10-10 17:22     ` Roman Zippel
2005-10-11  7:42       ` Thomas Gleixner
2005-10-12 22:36         ` Roman Zippel
2005-10-12 23:46           ` George Anzinger
2005-10-16 16:34             ` Roman Zippel
2005-10-16 19:26               ` Thomas Gleixner
2005-10-16 23:03                 ` Roman Zippel
2005-10-17  7:59                   ` Ingo Molnar
2005-10-17  8:26                     ` Steven Rostedt
2005-10-17  9:29                     ` Roman Zippel
2005-10-17  9:41                       ` Ingo Molnar
2005-10-17  9:56                         ` Andrew Morton
2005-10-17 11:00                           ` Ingo Molnar
2005-10-17 16:25                           ` Roman Zippel
2005-10-17 16:49                             ` Tim Bird
2005-10-17 17:26                               ` Steven Rostedt
2005-10-17 18:49                               ` Roman Zippel
2005-10-17 19:19                                 ` Tim Bird
2005-10-17 19:48                                   ` Roman Zippel
2005-10-17 20:13                                     ` Ingo Molnar
2005-10-17 20:31                                       ` Roman Zippel
2005-10-18  8:46                                         ` Ingo Molnar
2005-10-18 23:52                                           ` Tim Bird
2005-10-19  0:03                                             ` George Anzinger
2005-10-19  1:58                                           ` Roman Zippel
2005-10-19  6:46                                             ` Ingo Molnar
2005-10-19 10:49                                             ` kernel/timer.c design (was: Re: ktimers subsystem) Ingo Molnar
2005-10-19 17:48                                               ` kernel/timer.c design Tim Bird
2005-10-19 18:00                                               ` Tim Bird
2005-10-19 19:04                                                 ` Thomas Gleixner
2005-10-19 22:12                                               ` kernel/timer.c design (was: Re: ktimers subsystem) Roman Zippel
2005-10-19 11:40                                             ` [PATCH] ktimers subsystem 2.6.14-rc2-kt5 Ingo Molnar
2005-10-19 11:58                                             ` Ingo Molnar
2005-10-19 22:24                                               ` Roman Zippel
2005-10-17 20:09                                 ` Ingo Molnar
2005-10-17 20:55                             ` Thomas Gleixner
2005-10-18  0:07                               ` Roman Zippel
2005-10-18  1:03                                 ` George Anzinger [this message]
2005-10-19  1:26                                   ` Roman Zippel
2005-10-19  2:52                                     ` George Anzinger
2005-10-21 16:22                                       ` Roman Zippel
2005-10-23 18:17                                         ` George Anzinger
2005-10-27 20:23                                           ` Roman Zippel
2005-10-28  4:52                                             ` Steven Rostedt
2005-10-28 16:06                                               ` Roman Zippel
2005-10-17 16:33                         ` Roman Zippel
2005-10-17 16:39                           ` Ingo Molnar
2005-10-17 16:54                             ` Roman Zippel
2005-10-17 17:35                               ` Ingo Molnar
2005-10-17  9:54                       ` Steven Rostedt
2005-10-04  1:55   ` George Anzinger
  -- strict thread matches above, loose matches on Subject: below --
2005-10-17 18:38 linux
2005-10-17 19:04 ` Roman Zippel
2005-10-17 22:41   ` linux

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=435449DC.8070109@mvista.com \
    --to=george@mvista.com \
    --cc=akpm@osdl.org \
    --cc=hch@infradead.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=paulmck@us.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=tim.bird@am.sony.com \
    --cc=zippel@linux-m68k.org \
    /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.