All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Schlägl Manfred jun." <manfred.schlaegl@domain.hid>
To: xenomai-help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] Adeos/Xenomai Arm Port
Date: Wed, 18 Oct 2006 09:52:34 +0200	[thread overview]
Message-ID: <1161157955.5093.3.camel@domain.hid> (raw)
In-Reply-To: <1161099585.5024.48.camel@domain.hid>

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

On Tue, 2006-10-17 at 17:39 +0200, Schlägl Manfred jun. wrote:

> 5. latency
> 
> For periodic user-mode task i need very high periods > 1000us.
> 
> 
> Here are the latency-checks with printk's of the ioctls:
> 
> -sh-3.00# ./run -- -t 1
> *
> *
> * Type ^C to stop this application.
> *
> *
> == Sampling period: 100 us
> == Test mode: in-kernel periodic task
> == All results in microseconds
> [42949519.180000] rt_tmbench_ioctl_rt: request 1076364816 -> ret =
> -ENOTTY(-25)
> latency: failed to start in-kernel timer benchmark, code -25
> [42949523.000000] rt_tmbench_ioctl_nrt: request -1071118831 -> ret =
> -ENOTTY(-25)
> ---|------------|------------|------------|--------|-------------------------
> RTS|-1096532.504|       0.001|      93.252|   93340|
> 00:00:03/00:00:03
> 
> -sh-3.00# ./run -- -t 2
> *
> *
> * Type ^C to stop this application.
> *
> *
> == Sampling period: 100 us
> == Test mode: in-kernel timer handler
> == All results in microseconds
> [42949529.090000] rt_tmbench_ioctl_rt: request 1076364816 -> ret =
> -ENOTTY(-25)
> latency: failed to start in-kernel timer benchmark, code -25
> [42949534.680000] rt_tmbench_ioctl_nrt: request -1071118831 -> ret =
> -ENOTTY(-25)
> ---|------------|------------|------------|--------|-------------------------
> RTS|-1093751.320|       0.001|      93.252|   93340|
> 00:00:04/00:00:04
> 
> 
> Userspace-codes differ from kernelspace-codes, I think...



Yes it does!!!



#define RTTST_RTIOC_TMBENCH_START \
    _IOW(RTIOC_TYPE_TESTING, 0x10, struct rttst_tmbench_config) 

two different results in kernel-/user-space

sizeof(struct rttst_tmbench_config) 
-> kernel 	32
-> user		40


typedef struct rttst_tmbench_config {
    int                     mode;
    uint64_t                period;
    int                     priority;
    int                     warmup_loops;
    int                     histogram_size;
    int                     histogram_bucketsize;
    int                     freeze_max;
} rttst_tmbench_config_t;

sizeof(struct rttst_tmbench_config_t)
-> kernel	32	(uses packed-structure)
-> user		40	(uses unpacked-structure)

sizeof(uint64_t)
-> kernel	8
-> user		8

sizeof(int)
-> kernel	4
-> user		4


Difference has something to do with the internal structure of
rttst_tmbench_config.


Solution 1: Force userspace-app and kernel to use packed structure
--------------
typedef struct rttst_tmbench_config {
    int                     mode;
    uint64_t                period;
    int                     priority;
    int                     warmup_loops;
    int                     histogram_size;
    int                     histogram_bucketsize;
    int                     freeze_max;
} __attribute__((packed)) rttst_tmbench_config_t;

sizeof(struct rttst_tmbench_config_t)
-> kernel	32	(uses packed-structure)
-> user		32	(uses packed-structure)

Has to be done to all structures! (compiler-flag -fpack-struct)

Problems: 
 * problems with libs (see
http://gcc.gnu.org/ml/gcc-help/2005-01/msg00257.html)
 * possibly problems with typedef ????


Solution 2: Force userspace-app and kernel to use unpacked structure
--------------
typedef struct rttst_tmbench_config {
    int                     mode;
    uint64_t                period;
    int                     priority;
    int                     warmup_loops;
    int                     histogram_size;
    int                     histogram_bucketsize;
    int                     freeze_max;
} __attribute__((unpacked)) rttst_tmbench_config_t;


Kernel ignores the attribute!

Theoretically:
sizeof(struct rttst_tmbench_config_t)
-> kernel	40	(uses unpacked-structure)
-> user		40	(uses unpacked-structure)

Has to be done to all structures! 




Solution 3:
--------------
change kernel-configuration to use unpacked structures by default.



	- Manfred Schlaegl


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2006-10-18  7:52 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-17 15:39 [Xenomai-help] Adeos/Xenomai Arm Port Schlägl Manfred jun.
2006-10-18  7:52 ` Schlägl Manfred jun. [this message]
2006-10-18 10:35   ` Jan Kiszka
2006-10-18 12:24     ` Schlägl Manfred jun.
2006-10-18 12:33       ` Jan Kiszka
2006-10-18 12:48         ` Gilles Chanteperdrix
2006-10-21 14:56       ` Schlägl Manfred jun.
2006-10-21 16:44         ` Jan Kiszka
2006-10-25  8:03           ` Schlägl Manfred jun.
2006-10-18 10:25 ` Philippe Gerum
2006-10-18 12:05   ` Gilles Chanteperdrix
  -- strict thread matches above, loose matches on Subject: below --
2006-10-18 15:16 Schlägl Manfred jun.
2006-10-18 15:27 ` Jan Kiszka
2006-10-18 15:56   ` Schlägl Manfred jun.
2006-10-19  5:52     ` Jan Kiszka
2006-10-21 12:11   ` Schlägl Manfred jun.
2006-10-17  9:23 Schlägl Manfred jun.
2006-10-17  9:37 ` Jan Kiszka
2006-10-16 15:48 Schlägl Manfred jun.
2006-10-16 16:24 ` Jan Kiszka
2006-10-16 18:20 ` Gilles Chanteperdrix
2006-10-16 21:30 ` Philippe Gerum
2006-10-17  8:15   ` Gilles Chanteperdrix
2006-10-17  8:38     ` Gilles Chanteperdrix
2006-10-17  9:54       ` Philippe Gerum
2006-10-17 10:04     ` Philippe Gerum
2006-10-17 12:05       ` 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=1161157955.5093.3.camel@domain.hid \
    --to=manfred.schlaegl@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.