All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Fillod Stephane <stephane.fillod@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] native rt_timer questions
Date: Wed, 03 Sep 2008 12:16:57 +0200	[thread overview]
Message-ID: <48BE6419.2020706@domain.hid> (raw)
In-Reply-To: <0B45E93C5FF65740AEAE690BF3848B7AD38364@domain.hid>

Fillod Stephane wrote:
> Hi!
> 
> Why rt_timer functions, esp. rt_timer_tsc(), are not inlined in
> user-space 
> (with CONFIG_XENO_HW_DIRECT_TSC) ? Is it because some policy insists 
> that every library function must have an overridable symbol?
> Even a branch is worrisome when doing repetitive micro-measurements.
> What about a patch along the following? or an extern inline?
> 
> --- include/native/timer.h     15 May 2008 07:40:30 -0000
> +++ include/native/timer.h     3 Sep 2008 09:10:31 -0000
> @@ -46,7 +52,7 @@
>  extern "C" {
>  #endif
> -#if (defined(__KERNEL__)  || defined(__XENO_SIM__)) &&
> !defined(DOXYGEN_CPP)
> +#if (defined(__KERNEL__)  || defined(__XENO_SIM__) ||
> defined(__NATIVE_INLINE)) && !defined(DOXYGEN_CPP)
>  static inline SRTIME rt_timer_ns2tsc(SRTIME ns)
>  {
>         return xnarch_ns_to_tsc(ns);

I am afraid we do not want this on every architecture. On ARM where the
tsc is an emulation and contains a fair number of instructions using a
fair number of registers (still faster than a syscall, of course), I
think we do want an out of line function.

> 
> BTW, I had the bad surprise of rt_timer_read() doing a syscall, which
> is costly when doing fine measurement. Should it be documented?

I suggested once to use the tsc as well for the implementation of
clock_gettime(CLOCK_REALTIME) (the posix equivalent of rt_timer_read()),
but was told at the time that we may want, one day, to provide syscalls
to compensate for clock drifts, so reading the system clock should
remain a syscall.

-- 
                                                 Gilles.


  reply	other threads:[~2008-09-03 10:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-03  9:39 [Xenomai-core] native rt_timer questions Fillod Stephane
2008-09-03 10:16 ` Gilles Chanteperdrix [this message]
2008-09-21 18:10 ` Gilles Chanteperdrix

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=48BE6419.2020706@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=stephane.fillod@domain.hid \
    --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.