All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [RFC][PATCH 2/2] Uninline tsc/ns conversions
Date: Tue, 10 Apr 2007 00:00:46 +0200	[thread overview]
Message-ID: <461AB78E.10408@domain.hid> (raw)

[-- Attachment #1: Type: text/plain, Size: 8700 bytes --]

Another pending patch from my repos (don't think I already posted this,
did I?). This one uninlines xnarch_tsc_to_ns() and xnarch_ns_to_tsc().
Both functions are fairly heavy right now, and uninlining can save
a few kilobyte code. Some stats on my Pentium M box:

[Before]
   text    data     bss     dec     hex filename
  15714     844      28   16586    40ca drivers/xenomai/can/xeno_can.ko
   6625     824       4    7453    1d1d drivers/xenomai/testing/xeno_timerbench.ko
  12736     984     260   13980    369c drivers/xenomai/serial/xeno_16550A.ko
  10304     664    1196   12164    2f84 kernel/xenomai/skins/rtai/xeno_rtai.ko
  19809     936     564   21309    533d kernel/xenomai/skins/rtdm/xeno_rtdm.ko
  27172    1376    1184   29732    7424 kernel/xenomai/skins/vrtx/xeno_vrtx.ko
  58869    1312   42624  102805   19195 kernel/xenomai/skins/posix/xeno_posix.ko
  27791    1144     136   29071    718f kernel/xenomai/skins/psos+/xeno_psos.ko
  47891    1696     160   49747    c253 kernel/xenomai/skins/native/xeno_native.ko
  24465    1136     132   25733    6485 kernel/xenomai/skins/vxworks/xeno_vxworks.ko
  73963    1536   50140  125639   1eac7 kernel/xenomai/nucleus/xeno_nucleus.ko
                         ------
                         434219

[After]
   text    data     bss     dec     hex filename
  15518     844      28   16390    4006 drivers/xenomai/can/xeno_can.ko
   5445     824       4    6273    1881 drivers/xenomai/testing/xeno_timerbench.ko
  12552     984     260   13796    35e4 drivers/xenomai/serial/xeno_16550A.ko
   9696     664    1196   11556    2d24 kernel/xenomai/skins/rtai/xeno_rtai.ko
  19561     936     564   21061    5245 kernel/xenomai/skins/rtdm/xeno_rtdm.ko
  26604    1376    1184   29164    71ec kernel/xenomai/skins/vrtx/xeno_vrtx.ko
  54741    1312   42624   98677   18175 kernel/xenomai/skins/posix/xeno_posix.ko
  27191    1144     136   28471    6f37 kernel/xenomai/skins/psos+/xeno_psos.ko
  46615    1696     160   48471    bd57 kernel/xenomai/skins/native/xeno_native.ko
  24277    1136     132   25545    63c9 kernel/xenomai/skins/vxworks/xeno_vxworks.ko
  71663    1536   50140  123339   1e1cb kernel/xenomai/nucleus/xeno_nucleus.ko
                         ------
                         422743

Means a win of 11k. Does anyone expect noticeable latency regressions?

We may reconsider this uninlining for xnarch_tsc_to_ns() when we switch
to scaled math for that function. But my feeling is that even then the
function size will still demand a dedicated function.

Jan


---
 include/asm-arm/bits/timer.h      |    2 +
 include/asm-blackfin/bits/timer.h |    2 +
 include/asm-generic/bits/timer.h  |   41 ++++++++++++++++++++++++++++++++++++++
 include/asm-generic/system.h      |   11 +---------
 include/asm-i386/bits/timer.h     |    2 +
 include/asm-ia64/bits/timer.h     |    2 +
 include/asm-powerpc/bits/timer.h  |    2 +
 include/asm-sim/bits/timer.h      |    2 +
 include/asm-x86_64/bits/timer.h   |    2 +
 9 files changed, 57 insertions(+), 9 deletions(-)

Index: xenomai/include/asm-generic/system.h
===================================================================
--- xenomai.orig/include/asm-generic/system.h
+++ xenomai/include/asm-generic/system.h
@@ -180,15 +180,8 @@ typedef struct xnarch_heapcb {
 extern "C" {
 #endif
 
-static inline long long xnarch_tsc_to_ns(long long ts)
-{
-    return xnarch_llimd(ts,1000000000,RTHAL_CPU_FREQ);
-}
-
-static inline long long xnarch_ns_to_tsc(long long ns)
-{
-    return xnarch_llimd(ns,RTHAL_CPU_FREQ,1000000000);
-}
+long long xnarch_tsc_to_ns(long long ts);
+long long xnarch_ns_to_tsc(long long ns);
 
 static inline unsigned long long xnarch_get_cpu_time(void)
 {
Index: xenomai/include/asm-arm/bits/timer.h
===================================================================
--- xenomai.orig/include/asm-arm/bits/timer.h
+++ xenomai/include/asm-arm/bits/timer.h
@@ -27,6 +27,8 @@
 #error "Pure kernel header included from user-space!"
 #endif
 
+#include <asm-generic/xenomai/bits/timer.h>
+
 static inline void xnarch_program_timer_shot(unsigned long delay)
 {
 	rthal_timer_program_shot(rthal_imuldiv
Index: xenomai/include/asm-blackfin/bits/timer.h
===================================================================
--- xenomai.orig/include/asm-blackfin/bits/timer.h
+++ xenomai/include/asm-blackfin/bits/timer.h
@@ -24,6 +24,8 @@
 #error "Pure kernel header included from user-space!"
 #endif
 
+#include <asm-generic/xenomai/bits/timer.h>
+
 static inline void xnarch_program_timer_shot(unsigned long delay)
 {
 	/* The core timer runs at the core clock rate -- therefore no
Index: xenomai/include/asm-generic/bits/timer.h
===================================================================
--- /dev/null
+++ xenomai/include/asm-generic/bits/timer.h
@@ -0,0 +1,41 @@
+/*

+ * Copyright (C) 2001-2007 Philippe Gerum <rpm@xenomai.org>.

+ *

+ * Xenomai is free software; you can redistribute it and/or modify it

+ * under the terms of the GNU General Public License as published by

+ * the Free Software Foundation; either version 2 of the License, or

+ * (at your option) any later version.

+ *

+ * Xenomai is distributed in the hope that it will be useful, but

+ * WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

+ * General Public License for more details.

+ *

+ * You should have received a copy of the GNU General Public License

+ * along with Xenomai; if not, write to the Free Software

+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA

+ * 02111-1307, USA.

+ */

+

+#ifndef _XENO_ASM_GENERIC_BITS_TIMER_H

+#define _XENO_ASM_GENERIC_BITS_TIMER_H

+

+#ifndef __KERNEL__

+#error "Pure kernel header included from user-space!"

+#endif

+

+long long xnarch_tsc_to_ns(long long ts)

+{

+    return xnarch_llimd(ts,1000000000,RTHAL_CPU_FREQ);

+}

+

+EXPORT_SYMBOL(xnarch_tsc_to_ns);

+

+long long xnarch_ns_to_tsc(long long ns)

+{

+    return xnarch_llimd(ns,RTHAL_CPU_FREQ,1000000000);

+}

+

+EXPORT_SYMBOL(xnarch_ns_to_tsc);

+

+#endif /* !_XENO_ASM_GENERIC_BITS_TIMER_H */

Index: xenomai/include/asm-i386/bits/timer.h
===================================================================
--- xenomai.orig/include/asm-i386/bits/timer.h
+++ xenomai/include/asm-i386/bits/timer.h
@@ -24,6 +24,8 @@
 #error "Pure kernel header included from user-space!"
 #endif
 
+#include <asm-generic/xenomai/bits/timer.h>
+
 static inline void xnarch_program_timer_shot(unsigned long delay)
 {
 	/* Even though some architectures may use a 64 bits delay here, we
Index: xenomai/include/asm-ia64/bits/timer.h
===================================================================
--- xenomai.orig/include/asm-ia64/bits/timer.h
+++ xenomai/include/asm-ia64/bits/timer.h
@@ -24,6 +24,8 @@
 #error "Pure kernel header included from user-space!"
 #endif
 
+#include <asm-generic/xenomai/bits/timer.h>
+
 static inline void xnarch_program_timer_shot(unsigned long delay)
 {
 	rthal_timer_program_shot(delay);
Index: xenomai/include/asm-powerpc/bits/timer.h
===================================================================
--- xenomai.orig/include/asm-powerpc/bits/timer.h
+++ xenomai/include/asm-powerpc/bits/timer.h
@@ -27,6 +27,8 @@
 #error "Pure kernel header included from user-space!"
 #endif
 
+#include <asm-generic/xenomai/bits/timer.h>
+
 static inline void xnarch_program_timer_shot(unsigned long delay)
 {
 	/* Even though some architectures may use a 64 bits delay here, we
Index: xenomai/include/asm-sim/bits/timer.h
===================================================================
--- xenomai.orig/include/asm-sim/bits/timer.h
+++ xenomai/include/asm-sim/bits/timer.h
@@ -19,6 +19,8 @@
 #ifndef _XENO_ASM_SIM_BITS_TIMER_H
 #define _XENO_ASM_SIM_BITS_TIMER_H
 
+#include <asm-generic/xenomai/bits/timer.h>
+
 static inline void xnarch_program_timer_shot (unsigned long delay)
 {
     /* 1 tsc unit of the virtual CPU == 1 ns. */
Index: xenomai/include/asm-x86_64/bits/timer.h
===================================================================
--- xenomai.orig/include/asm-x86_64/bits/timer.h
+++ xenomai/include/asm-x86_64/bits/timer.h
@@ -24,6 +24,8 @@
 #error "Pure kernel header included from user-space!"
 #endif
 
+#include <asm-generic/xenomai/bits/timer.h>
+
 static inline void xnarch_program_timer_shot(unsigned long delay)
 {
 	rthal_timer_program_shot(rthal_imuldiv


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

                 reply	other threads:[~2007-04-09 22:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=461AB78E.10408@domain.hid \
    --to=jan.kiszka@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.