All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: Xenomai <Xenomai@xenomai.org>
Subject: Re: [Xenomai] IO-APIC latencies
Date: Mon, 17 Sep 2012 20:54:02 +0200	[thread overview]
Message-ID: <505771CA.50205@siemens.com> (raw)
In-Reply-To: <50576DDB.2010709@xenomai.org>

On 2012-09-17 20:37, Gilles Chanteperdrix wrote:
> On 09/17/2012 08:29 PM, Jan Kiszka wrote:
> 
>> On 2012-09-17 20:18, Gilles Chanteperdrix wrote:
>>> On 09/17/2012 08:15 PM, Jan Kiszka wrote:
>>>
>>>> On 2012-09-17 20:12, Jan Kiszka wrote:
>>>>> On 2012-09-17 20:08, Gilles Chanteperdrix wrote:
>>>>>> On 09/17/2012 08:05 PM, Jan Kiszka wrote:
>>>>>>
>>>>>>> On 2012-09-17 19:46, Gilles Chanteperdrix wrote:
>>>>>>>> ipipe_end is a nop when called from primary domain, yes, but this is not
>>>>>>>> very different from edge irqs. Also, fasteoi become a bit like MSI: in
>>>>>>>> the same way as we can not mask MSI from primary domain, we should not
>>>>>>>> mask IO-APIC fasteoi irqs, because the cost is too prohibitive. If we
>>>>>>>> can live with MSI without masking them in primary mode, I guess we can
>>>>>>>> do the same with fasteoi irqs.
>>>>>>>
>>>>>>> MSIs are edge triggered, fasteois are still level-based. They require
>>>>>>> masking at the point you defer them - what we do and what Linux may even
>>>>>>> extend beyond that. If you mask them by raising the task priority, you
>>>>>>> have to keep it raised until Linux finally handled the IRQ.
>>>>>>
>>>>>>
>>>>>> Yes.
>>>>>>
>>>>>>> Or you
>>>>>>> decide to mask it at IO-APIC level again.
>>>>>>
>>>>>>
>>>>>> We do not want that.
>>>>>>
>>>>>>> If you keep the TPR raised,
>>>>>>> you will block more than what Linux wants to block.
>>>>>>
>>>>>>
>>>>>> The point is that if the TPR keeps raised, it means that primary domain
>>>>>> has preempted Linux, so, we want it to keep that way. Otherwise the TPR
>>>>>> gets lowered when Linux has handled the interrupt.
>>>>>>
>>>>>> A week-end of testing made me sure of one thing: it works. I assure you.
>>>>>
>>>>> Probably, in the absence of IRQF_ONESHOT Linux interrupts. No longer if
>>>>> you face threaded IRQs - I assure you.
>>>>
>>>> Well, it may work (if mask/unmask callbacks work as native) but the
>>>> benefit is gone: masking at IO-APIC level will be done again. Given that
>>>> threaded IRQs become increasingly popular, it will also be hard to avoid
>>>> them in common setups.
>>>
>>>
>>> The thing is, if we no longer use the IO-APIC spinlock from primary
>>> domain, we may not have to turn it into an ipipe_spinlock, and may be
>>> able to preempt the IO-APIC masking.
>>
>> That might be true - but is the latency related to the lock or the
>> hardware access? In the latter case, you will still stall the CPU on it
>> and have to isolate the load on a non-RT CPU again.
>>
>> BTW, the task priority for the RT domain is a quite important parameter.
>> If you put it too low, Linux can run out of vectors. If you put it too
>> high, the same may happen to Xenomai - on bigger boxes.
> 
> 
> Yes, and there are only 16 levels. But Xenomai does not need to many levels.

How is telling you this? It's part of the system setup. And that may
lean toward RT or toward non-RT. This level should be adjusted according
to the current allocation of Linux and the RT domain for a particular
CPU, not hard-coded or compile-time defined.

> 
>>
>> On the other hand, it may be useful as a complete mask for Linux, ie.
>> when applied unconditionally on entry to the RT domain and released on
>> exit or fasteoi ending. Already played with that model? That would have
>> a value beyond IO-APICs.
> 
> 
> Yes, that is exactly what I did. We call this "PIC muting" on other
> architectures, I simply implemented it on x86 with the APIC TRR (that is
> the second curve in the plot posted at the beginning of this thread),
> but it does not solve the problem when the APIC timer interrupt happens
> while the I-pipe is busy acking an IO-APIC fasteoi. Which is why I
> implemented the second solution (third curve in the graph), which is
> exactly what you describe and corresponds the code I posted a few
> messages ago.

I would still refrain from directing non-RT IRQs to RT CPUs. But if
IO-APIC latency reductions comes as a byproduct of Linux IRQ muting,
then it might be worth the additional maintenance pain (shuffling
vectors around will cause pain, be assured).

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux


  reply	other threads:[~2012-09-17 18:54 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17  6:30 [Xenomai] IO-APIC latencies Gilles Chanteperdrix
2012-09-17  7:43 ` Jan Kiszka
2012-09-17  8:07   ` Gilles Chanteperdrix
2012-09-17  8:18     ` Jan Kiszka
2012-09-17  8:32       ` Gilles Chanteperdrix
2012-09-17  9:07         ` Jan Kiszka
2012-09-17  9:29           ` Gilles Chanteperdrix
2012-09-17  9:42             ` Jan Kiszka
2012-09-17 10:00               ` Gilles Chanteperdrix
2012-09-17 10:39                 ` Henri Roosen
2012-09-17 11:14                   ` Gilles Chanteperdrix
2012-09-17 12:15                     ` Henri Roosen
2012-09-17 12:27                       ` Jan Kiszka
2012-09-17 13:46                         ` Gilles Chanteperdrix
2012-09-17 13:54                           ` Jan Kiszka
2012-09-17 14:02                             ` Gilles Chanteperdrix
2012-09-17 14:35                               ` Jan Kiszka
2012-09-17 17:46                                 ` Gilles Chanteperdrix
2012-09-17 18:05                                   ` Jan Kiszka
2012-09-17 18:08                                     ` Gilles Chanteperdrix
2012-09-17 18:12                                       ` Jan Kiszka
2012-09-17 18:13                                         ` Gilles Chanteperdrix
2012-09-17 18:15                                         ` Jan Kiszka
2012-09-17 18:16                                           ` Gilles Chanteperdrix
2012-09-17 18:18                                             ` Jan Kiszka
2012-09-17 18:18                                           ` Gilles Chanteperdrix
2012-09-17 18:22                                             ` Gilles Chanteperdrix
2012-09-17 18:29                                             ` Jan Kiszka
2012-09-17 18:37                                               ` Gilles Chanteperdrix
2012-09-17 18:54                                                 ` Jan Kiszka [this message]
2012-09-17 21:50                                                   ` Gilles Chanteperdrix
2012-09-18  8:48                                                     ` Jan Kiszka
2012-09-18  9:06                                                       ` Gilles Chanteperdrix
2012-09-18  9:12                                                         ` Gilles Chanteperdrix
2012-09-18  9:30                                                         ` Jan Kiszka
2012-09-18  9:36                                                           ` Gilles Chanteperdrix
2012-09-17 18:15                                         ` Gilles Chanteperdrix
2012-09-17 12:12                 ` Richard Cochran
2012-09-17 12:21       ` Gilles Chanteperdrix
2012-09-17 12:27         ` Jan Kiszka

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=505771CA.50205@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=Xenomai@xenomai.org \
    --cc=gilles.chanteperdrix@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.