From: Philippe Gerum <rpm@xenomai.org>
To: Fillod Stephane <stephane.fillod@domain.hid>
Cc: Wolfgang Grandegger <wolfgang.grandegger@domain.hid>,
rtai@domain.hid, adeos-main@gna.org
Subject: Re: [Adeos-main] RE: Interrupt Latency Question
Date: Thu, 14 Apr 2005 17:47:47 +0200 [thread overview]
Message-ID: <425E90A3.5050103@domain.hid> (raw)
In-Reply-To: <1CFEB358338412458B21FAA0D78FE86D4F0D3F@rennsmail02.eu.thmulti.com>
Fillod Stephane wrote:
> Wolfgang Grandegger wrote:
>
>>It's also my experience, that the large latencies are
>>due to TLB misses and cache refills, especially the
>>latter one. What helps is L2 cache or fast memory.
>>For example, on an MPC 5200 I get significately better
>>latencies with DDR-RAM than with SDRAM (which is ca.
>>20% slower).
>
>
> I keep on hearing people are having feeling that their latency
> can be caused by TLB misses/cache refills, but never seen proof.
> Is there some literature about that subject? Nobody in the RTAI
> community had curiosity to explain and fix this interesting problem?
>
AFAIC, the curiosity is there, and better understanding the caching
behaviour of the nucleus is planned before fusion turns 1.0; after all,
the core can run inside a regular Linux process so we could even use
cachegrind for this. The same goes for Adeos, except that cachegrind is
obviously out of reach, so the usual tough way is currently followed,
when time allows.
For instance, this explains why the CONFIG_ADEOS_NOTHREADS came into
play in recent Adeos releases, but with limited success, since the cost
of switching domain stacks on low-end machines (Pentium 90Mhz-based
slug, Geode/x86 266 and IceCube/ppc) was apparently not worth the effort
of coding up this mode. On mid-range to high-end boxen,
the perceived benefits so far are nil, except perhaps that you don't
have to fiddle
with non-Linux allocated stacks inside your interrupt handlers (e.g.
"current" determination hack for x86). Maybe other have had better
results trying a similar approach on other archs (Michael, with ARM?), I
don't know. OTOH, the cache issues that could be triggered by the layout
of the Adeos domain descriptor (adomain_t) still bother me, and have not
been checked in depth so far AFAIK.
> If not, what about showing (or not) that the large latencies are due
> to TLB misses/cache refills with a tool like Flushy?
>
> Using Flushy would be like using low-end hardware. It's far easier to
> make
> performance improvements on low-end hardware than high-end. It works as
> a
> magnifying glass. It reminds me a comment on Gnome mailing list, where
> an
> end-user wished that developers had high-end compile machine, but slow
> hardware to test with.
>
More precisely, we need fast compile machines, low-end testing platforms
and fat brains. Guess which one I'm personally missing right now... :o>
>
>>>Have a look at http://rtai.dk/cgi-bin/gratiswiki.pl?Latency_Killer
>>>To get real bad cases, try the Flushy module.
>>>You can try also to disable caches for better predictability, but it
>
> really
>
>>>hurts :*)
>>
>>I will try it on an embedded PowerPC platform a.s.a.p.
>
>
> After thought, there would be a better design for Flushy. Instead of
> an infinite loop in a separate module(process), we should instead call
> the TLB flush/cache invalidate right before entering the RT world
> from ADEOS. Therefore, we should get "predictable" worst case latencies
> wrt
> TLB/cache conditions.
>
> Where is the best place in ADEOS to do that?
I'd say arch/ppc/kernel/adeos.c:__adeos_sync_stage(), this is the
interrupt log syncer. You will find this pattern:
if (adp == adp_root) {
/* dispatching ISR to Linux */
} else {
/* dispatching ISR to non-root domains. This is where you likely
want to play with the cache, before calling the handler. */
}
> The earlier, the better. Tapping at the exception level would be the
> best, right before saving registers, but we need couple registers to
> call the
> TLB/cache flush.
> Any idea?
>
Only to interpose before the pipelining stuff comes into play, you could
hook __adeos_grab_irq(), still in arch/ppc/kernel/adeos.c. It's called
right after the address translation has been switch on by the exception
transfer block, so it's quite early already.
> I've Cc:'d the adeos-main list to reach some more gurus.
>
>
>>>Note: if it turns out this latency is due to cache misses, then
>
> solutions
>
>>>exist.
>>
>>Can you be more precise here.
>
>
> With reproducible latencies, we can then use OProfile (where available)
> to
> spot slow areas. We have to sort out whether TLB misses, I-cache misses
> or
> D-cache misses is the bigger culprit. Make your guess :-)
> Modern processors have cache control instructions, like prefetch for
> read,
> zero cache line, writeback flush, etc. With nice cpp macros, we can use
> them (where available) ahead of time in the previously spotted places,
> to render the memory access latency predictable.
>
> Do you think that will do it? Anybody has experience to share?
>
>
> Thanks
--
Philippe.
next prev parent reply other threads:[~2005-04-14 15:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-14 14:55 [Adeos-main] RE: Interrupt Latency Question Fillod Stephane
2005-04-14 15:47 ` Philippe Gerum [this message]
2005-04-14 20:20 ` Michael Neuhauser
2005-04-14 17:15 ` [Adeos-main] " Paolo Mantegazza
2005-04-19 18:35 ` Max Krasnyansky
2005-04-20 8:06 ` Paolo Mantegazza
2005-04-20 18:10 ` Max Krasnyansky
2005-04-17 9:32 ` Wolfgang Grandegger
2005-05-03 7:12 ` Der Herr Hofrat
2005-05-03 16:11 ` Wolfgang Grandegger
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=425E90A3.5050103@domain.hid \
--to=rpm@xenomai.org \
--cc=adeos-main@gna.org \
--cc=rtai@domain.hid \
--cc=stephane.fillod@domain.hid \
--cc=wolfgang.grandegger@domain.hid \
/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.