From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Andrey Nechypurenko <andreynech@domain.hid>
Cc: Xenomai help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] PWM generation with GPIO
Date: Thu, 08 Sep 2011 12:06:43 +0200 [thread overview]
Message-ID: <4E6893B3.2070004@domain.hid> (raw)
In-Reply-To: <CAOiXNkBjaSMRt1GO51hQUrU52PjQHZB9SfJXZzmAx72sYzyfMw@domain.hid>
On 09/08/2011 11:30 AM, Andrey Nechypurenko wrote:
>> If I understand correctly, the difference is that Bob proposes you to
>> dedicate a hardware timer to the PWM, whereas I propose you to use the
>> software timers, which ultimately, also depend on a dmtimer. I would not
>> expect big differences between the two approaches, neither in terms of
>> jitter, nor in terms of code.
>
> I see. Thanks for the explanations.
>
>> As suggested in the previous mail I sent you, compare the differences in
>> latencies with latency -t 2 between user-space task and kernel-space
>> timer. You will see that a timer handler has much less jitter.
>
> It is clear for me that there is a difference. I am trying to
> understand what is the reason for the difference. I thought that as
> soon as Xenomai task is created (does not matter from user or kernel
> space) it is managed by Xenomai in the similar way and correspondingly
> the results should be also similar (which is obviously no the case).
xenomai provides user-space threads and kernel-space threads, which work
much like linux user-space and kernel-space threads.
>
>> Switch to user-space, and context switch time explain the difference.
>
> So is it the only reason for the differences or there are some other
> factors influencing the results?
It is the only reason.
With latency -t 2. As soon as the timer interrupt happens, the timer
handler, which runs in irq context, measures the jitter.
With latency -t 0. When the timer interrupt happens, we need to switch
to the kernel-space task associated with the user-space sampling task,
in the worst case, the currently running task was not in the same memory
space, so, a switch of the mmu context is needed. Then we need to return
to user-space, as a return to the "rt_task_wait_period" syscall at which
point the jitter is measured.
All this involves longer code paths and greater opportunities for cache
effects.
This difference between kernel-space and user-space explains why we
advise people to split their application between application and driver,
the really critical part using the RTDM skin, in kernel-space, much like
you would do with linux.
--
Gilles.
next prev parent reply other threads:[~2011-09-08 10:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-08 2:03 [Xenomai-help] PWM generation with GPIO Bob Feretich
2011-09-08 8:21 ` Andrey Nechypurenko
2011-09-08 9:13 ` Gilles Chanteperdrix
[not found] ` <CAOiXNkBjaSMRt1GO51hQUrU52PjQHZB9SfJXZzmAx72sYzyfMw@domain.hid>
2011-09-08 10:06 ` Gilles Chanteperdrix [this message]
2011-09-08 10:20 ` Philippe Gerum
2011-09-09 3:33 ` Bob Feretich
2011-09-09 11:41 ` Gilles Chanteperdrix
-- strict thread matches above, loose matches on Subject: below --
2011-09-05 19:53 Andrey Nechypurenko
2011-09-05 20:02 ` Gilles Chanteperdrix
2011-09-05 20:14 ` Andrey Nechypurenko
2011-09-06 7:29 ` 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=4E6893B3.2070004@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=andreynech@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.