From: Steven Rostedt <rostedt@goodmis.org>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: tim.bird@am.sony.com, oleg@tv-sign.ru, hch@infradead.org,
paulmck@us.ibm.com, johnstul@us.ibm.com,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@osdl.org>,
Thomas Gleixner <tglx@linutronix.de>,
George Anzinger <george@mvista.com>
Subject: Re: [PATCH] ktimers subsystem 2.6.14-rc2-kt5
Date: Fri, 28 Oct 2005 00:52:10 -0400 [thread overview]
Message-ID: <1130475130.9574.47.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.61.0510250114100.1386@scrub.home>
On Thu, 2005-10-27 at 22:23 +0200, Roman Zippel wrote:
>
> Next question would be what happens if timer and clock resolution differs?
> For example if the clock has a resolution of 1us and the timer runs every
> 1ms. For relative timer this would mean we can keep the error within
> 1.001ms and for absolute timer within 1ms. Do we really have to force an
> error larger than really necessary?
>
> Interesting is now that Thomas doesn't take the clock resolution into
> account at all. Let's say clock and timer resolution are 1ms (or HZ=1000).
> If we program a normal kernel timer, we do something like this:
>
> timer->expires = jiffies + 1 + usecs_to_jiffies(timeout);
>
> Thomas does now basically this:
>
> timer->expires = jiffies * res + round(timeout, res);
>
> IOW if the clock resolution is larger than the interrupt delay, the timer
> may expire early.
Roman, I think I know what you are trying to say here. Although it took
me several readings of what you wrote and then really just looking at
Thomas' code.
It's the old problem with:
1 2 3 4
+----------+----------+----------+---------->>
^ ^
| |
Start End
Asking for 2 ms (with both clock and res the same at 1ms). We start the
clock at 1 but it really is 1.7 and we get the interrupt and return at 3
but really 3.2, so instead of receiving a wait of 2ms, we return with
3.2 - 1.7 = 1.5ms
Currently, this is not a problem when the clock is at a higher
frequency, (like the tsc). So the base->get_time works now since the
clock is at a higher frequency, but if the get_time returned jiffies,
this would fail. And the clock used is also much faster that the delay
it takes to get back to the calling process (which is much more than a
nanosecond today).
Is that what you were trying to say Roman?
Interesting though, I tried to force this scenario, by changing the
base->get_time to return jiffies. I have a jitter test and ran this
several times, and I could never get it to expire early. I even changed
HZ back to 100.
Then I looked at run_ktimer_queue. And here we have the compare:
timer = list_entry(base->pending.next, struct ktimer, list);
if (ktime_cmp(now, <=, timer->expires))
break;
So, the timer does _not_ get processed if it is after or _equal_ to the
current time. So although the timer may go off early, the expired queue
does not get executed. So the above example would not go off at 3.2,
but some time in the 4 category.
So the function will _not_ be executed early, although this could mean
that the timer could actually go off early (in the HRT case), but I
haven't taken a look there. That is to say the interrupt goes off
early, not the function being executed.
-- Steve
next prev parent reply other threads:[~2005-10-28 4:52 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
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 [this message]
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=1130475130.9574.47.camel@localhost.localdomain \
--to=rostedt@goodmis.org \
--cc=akpm@osdl.org \
--cc=george@mvista.com \
--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.