From: Jan Kiszka <jan.kiszka@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] High latencies on ARM.
Date: Tue, 22 Jan 2008 22:46:37 +0100 [thread overview]
Message-ID: <4796643D.7010208@domain.hid> (raw)
In-Reply-To: <18326.21459.333811.155772@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 3847 bytes --]
Gilles Chanteperdrix wrote:
> Gilles Chanteperdrix wrote:
> > Hi,
> >
> > after some (unsuccessful) time trying to instrument the code in a way
> > that does not change the latency results completely, I found the
> > reason for the high latency with latency -t 1 and latency -t 2 on ARM.
> > So, here comes an update on this issue. The culprit is the user-space
> > context switch, which flushes the processor cache with the nklock
> > locked, irqs off.
> >
> > There are two things we could do:
> > - arrange for the ARM cache flush to happen with the nklock unlocked
> > and irqs enabled. This will improve interrupt latency (latency -t 2)
> > but obviously not scheduling latency (latency -t 1). If we go that
> > way, there are several problems we should solve:
> >
> > we do not want interrupt handlers to reenter xnpod_schedule(), for
> > this we can use the XNLOCK bit, set on whatever is
> > xnpod_current_thread() when the cache flush occurs
> >
> > since the interrupt handler may modify the rescheduling bits, we need
> > to test these bits in xnpod_schedule() epilogue and restart
> > xnpod_schedule() if need be
> >
> > we do not want xnpod_delete_thread() to delete one of the two threads
> > involved in the context switch, for this the only solution I found is
> > to add a bit to the thread mask meaning that the thread is currently
> > switching, and to (re)test the XNZOMBIE bit in xnpod_schedule epilogue
> > to delete whatever thread was marked for deletion
> >
> > in case of migration with xnpod_migrate_thread, we do not want
> > xnpod_schedule() on the target CPU to switch to the migrated thread
> > before the context switch on the source CPU is finished, for this we
> > can avoid setting the resched bit in xnpod_migrate_thread(), detect
> > the condition in xnpod_schedule() epilogue and set the rescheduling
> > bits so that xnpod_schedule is restarted and send the IPI to the
> > target CPU.
>
> Please find attached a patch implementing these ideas. This adds some
> clutter, which I would be happy to reduce. Better ideas are welcome.
>
I tried to cross-read the patch (-p would have been nice) but failed -
this needs to be applied on some tree. Does the patch improve ARM
latencies already?
>
> >
> > - avoid using user-space real-time tasks when running latency
> > kernel-space benches, i.e. at least in the latency -t 1 and latency -t
> > 2 case. This means that we should change the timerbench driver. There
> > are at least two ways of doing this:
> > use an rt_pipe
> > modify the timerbench driver to implement only the nrt ioctl, using
> > vanilla linux services such as wait_event and wake_up.
> >
> > What do you think ?
>
> So, what do you thing is the best way to change the timerbench driver,
> * use an rt_pipe ? Pros: allows to run latency -t 1 and latency -t 2 even
> if Xenomai is compiled with CONFIG_XENO_OPT_PERVASIVE off; cons: make
> the timerbench non portable on other implementations of rtdm, eg. rtdm
> over rtai or the version of rtdm which runs over vanilla linux
> * modify the timerbecn driver to implement only nrt ioctls ? Pros:
> better driver portability; cons: latency would still need
> CONFIG_XENO_OPT_PERVASIVE to run latency -t 1 and latency -t 2.
I'm still voting for my third approach:
-> Write latency as kernel application (klatency) against the
timerbench device
-> Call NRT IOCTLs of timerbench during module init/cleanup
-> Use module parameters for customization
-> Setup a low-prio kernel-based RT task to issue the RT IOCTLs
-> Format the results nicely (similar to userland latency) in that RT
task and stuff them into some rtpipe
-> Use "cat /dev/rtpipeX" to display the results
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
next prev parent reply other threads:[~2008-01-22 21:46 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-02 10:31 [Xenomai-core] High latencies on ARM Gilles Chanteperdrix
2008-01-17 10:42 ` Jan Kiszka
2008-01-17 10:47 ` Gilles Chanteperdrix
2008-01-17 11:55 ` Jan Kiszka
2008-01-17 13:59 ` Gilles Chanteperdrix
2008-01-17 14:16 ` Jan Kiszka
2008-01-17 14:18 ` Jan Kiszka
2008-01-17 14:20 ` Gilles Chanteperdrix
2008-01-17 14:22 ` Jan Kiszka
2008-01-17 15:37 ` Gilles Chanteperdrix
2008-01-31 7:43 ` Gilles Chanteperdrix
2008-01-21 21:55 ` Gilles Chanteperdrix
2008-01-22 20:36 ` Gilles Chanteperdrix
2008-01-22 21:46 ` Jan Kiszka [this message]
2008-01-22 22:13 ` Gilles Chanteperdrix
2008-01-22 22:22 ` Gilles Chanteperdrix
[not found] ` <18315.63245.160672.547658@domain.hid>
2008-01-22 20:36 ` Gilles Chanteperdrix
2008-01-23 17:48 ` Philippe Gerum
2008-01-23 17:53 ` Gilles Chanteperdrix
2008-01-23 18:34 ` Philippe Gerum
2008-01-23 18:39 ` Gilles Chanteperdrix
2008-01-23 22:38 ` Gilles Chanteperdrix
2008-01-24 10:18 ` Gilles Chanteperdrix
2008-01-26 18:17 ` Philippe Gerum
2008-01-26 18:43 ` Gilles Chanteperdrix
2008-01-27 0:19 ` Philippe Gerum
[not found] ` <18333.3277.36164.63798@domain.hid>
2008-01-27 23:34 ` Philippe Gerum
2008-01-28 11:02 ` Gilles Chanteperdrix
2008-01-28 12:18 ` 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=4796643D.7010208@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.