All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Xenomai <xenomai@xenomai.org>
Subject: Re: [Xenomai] ipipe/x86: do not restore during context switch
Date: Wed, 06 Feb 2013 21:20:54 +0100	[thread overview]
Message-ID: <5112BB26.5020809@xenomai.org> (raw)
In-Reply-To: <5112BA45.1090106@siemens.com>

On 02/06/2013 09:17 PM, Jan Kiszka wrote:

> On 2013-02-06 21:03, Gilles Chanteperdrix wrote:
>> On 02/06/2013 08:55 PM, Jan Kiszka wrote:
>>
>>>> To the contrary, the overhead is the cost of the fault (with the
>>>> user/kernel and kernel/user switches), so, the larger the context
>>>> switch, the smaller the overhead in proportion.
>>>
>>> Yes, continuously faulting in FPU states of heavy Linux users is the
>>> problem. That must be changed.
>>
>>
>> We are talking x86 here, so, the cost of the FPU fault is not that heavy.
>>
>>>>> Instead of always doing stts for the new task, we could do the restore
>>>>> later, after the hard_local_irq_enable of __ipipe_switch_tail. That
>>>>> should allow the eager model for Linux as well without making
>>>>> save+restore of Linux-Linux switches atomic.
>>>>
>>>>
>>>> That could be done, but it is probably simpler to implement unlocked
>>>> context switch, and split __switch_to into several atomic sections.
>>>
>>> Yep, indeed.
>>>
>>>> Anyway, any change in this area will probably break the work done for
>>>> kthreads on -forge, so, can't we postpone this?
>>>
>>> For how long? What are the dependencies?
>>
>>
>> For the time it takes to validate FPU on kthreads with -forge.
>>
>>> I thought unlocked context
>>> switches already exit for other archs.
>>
>>
>> That is not an issue, indeed.
>>
>>>
>>> At least I will need to look into this internally - we are using less
>>> than 10% of our CPUs for RT, the rest wants high performance.
>>
>>
>> Are you sure this is not a priori optimization of something which is not
>> really an issue?
> 
> Of course, it depends on the context switch rate. We have to measure,
> but I wouldn't be surprised to see high numbers. And the FPU is used by
> everything today.
> 
> My colleague recently measured that (on an older standard kernel)
> accelerated disk encryption was slightly slower than unaccelerated one -
> due to the overhead of FPU context switches. I suppose we have a nice
> benchmark in that scenario (dd on an encrypted disk)...


You are talking kernel_fpu_begin()/kernel_fpu_end() here, this is a
completely different issue. If Xenomai interrupts Linux in the middle of
such a section, the FPU context is restored eagerly when switching back
to Linux, so there is absolutely nothing more we can do in this area.

-- 
                                                                Gilles.


      reply	other threads:[~2013-02-06 20:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06 17:03 [Xenomai] ipipe/x86: do not restore during context switch Jan Kiszka
2013-02-06 17:09 ` Gilles Chanteperdrix
2013-02-06 17:33   ` Jan Kiszka
2013-02-06 17:35     ` Gilles Chanteperdrix
2013-02-06 17:40       ` Jan Kiszka
2013-02-06 17:44         ` Gilles Chanteperdrix
2013-02-06 17:47           ` Jan Kiszka
2013-02-06 17:51             ` Gilles Chanteperdrix
2013-02-06 18:26               ` Jan Kiszka
2013-02-06 18:31                 ` Gilles Chanteperdrix
2013-02-06 18:35                   ` Jan Kiszka
2013-02-06 18:40                     ` Gilles Chanteperdrix
2013-02-06 19:22                       ` Jan Kiszka
2013-02-06 19:30                         ` Gilles Chanteperdrix
2013-02-06 19:55                           ` Jan Kiszka
2013-02-06 20:03                             ` Gilles Chanteperdrix
2013-02-06 20:17                               ` Jan Kiszka
2013-02-06 20:20                                 ` Gilles Chanteperdrix [this message]

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=5112BB26.5020809@xenomai.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=jan.kiszka@siemens.com \
    --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.