From: Jan Kiszka <jan.kiszka@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [RFC][PATCH 4/4] shorten overrun loops of periodic timers
Date: Thu, 03 Aug 2006 20:37:11 +0200 [thread overview]
Message-ID: <44D24257.10605@domain.hid> (raw)
In-Reply-To: <17618.12731.97405.118098@domain.hid>
[-- Attachment #1.1: Type: text/plain, Size: 1055 bytes --]
Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
> > A simple patch, just like suggested by Gilles, to avoid looping over
> > periodic xntimer handlers in case of overruns.
> >
> > It saves the current TSC on loop entry and uses this value later when
> > forwarding the timer. Is is the overhead of re-reading the TSC on all
> > archs negligible and should we rather go that way?
>
> >(...)
> > - xntimerh_date(&timer->aplink) +=
> > - nkpod->htimer.interval;
> > + while ((xntimerh_date(&timer->aplink) +=
> > + nkpod->htimer.interval) < now);
>
> I think you are patching the wrong addition, the one you are interested
> in is most probably the one at the bottom of xntimer_do_tick_aperiodic.
>
Ouch, indeed. Guess I should start reading what I patch. Here comes a
second try.
I'm still in favour of saving the TSC instead of re-reading it.
Otherwise we would have to pave the code with #ifdefs for the case
xnarch_get_cpu_tsc() is slow for a specific setup. Not that nice, is it?
Jan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: xntimer-handle-periodic-overrun-v2.patch --]
[-- Type: text/x-patch; name="xntimer-handle-periodic-overrun-v2.patch", Size: 1170 bytes --]
---
ksrc/nucleus/timer.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: xenomai/ksrc/nucleus/timer.c
===================================================================
--- xenomai.orig/ksrc/nucleus/timer.c
+++ xenomai/ksrc/nucleus/timer.c
@@ -200,12 +200,13 @@ static void xntimer_do_tick_aperiodic(vo
xntimerq_t *timerq = &sched->timerqueue;
xntimerh_t *holder;
xntimer_t *timer;
+ xnticks_t now;
while ((holder = xntimerq_head(timerq)) != NULL) {
timer = aplink2timer(holder);
- if (xntimerh_date(&timer->aplink) - nkschedlat >
- xnarch_get_cpu_tsc())
+ now = xnarch_get_cpu_tsc();
+ if (xntimerh_date(&timer->aplink) - nkschedlat > now)
/* No need to continue in aperiodic mode since timeout
dates are ordered by increasing values. */
break;
@@ -247,7 +248,7 @@ static void xntimer_do_tick_aperiodic(vo
translates into precious microsecs on low-end hw. */
__setbits(sched->status, XNHTICK);
- xntimerh_date(&timer->aplink) += timer->interval;
+ while ((xntimerh_date(&timer->aplink) += timer->interval) < now);
xntimer_enqueue_aperiodic(timer);
}
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]
next prev parent reply other threads:[~2006-08-03 18:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-03 7:01 [Xenomai-core] [RFC][PATCH 4/4] shorten overrun loops of periodic timers Jan Kiszka
2006-08-03 17:01 ` Philippe Gerum
2006-08-03 17:26 ` Gilles Chanteperdrix
2006-08-03 18:37 ` Jan Kiszka [this message]
2006-08-16 15:43 ` Gilles Chanteperdrix
2006-08-16 16:20 ` Jan Kiszka
2006-08-16 17:22 ` Gilles Chanteperdrix
2006-08-17 7:55 ` Jan Kiszka
2006-08-17 13:03 ` Gilles Chanteperdrix
2006-08-17 13:35 ` Jan Kiszka
2006-08-18 6:09 ` Jan Kiszka
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=44D24257.10605@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=xenomai@xenomai.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.