From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] T_FPU without effect
Date: Sat, 15 Apr 2006 17:02:44 +0200 [thread overview]
Message-ID: <17473.2836.45267.504758@domain.hid> (raw)
In-Reply-To: <4440C19C.2000302@domain.hid>
Jan Kiszka wrote:
> > thread in primary mode uses FPU for the first time on x86, the FPU
> > hardware is initialized in the fault handler, this is the expected
> > behaviour. This allow the nucleus to not switch FPU context for
> > user-space threads that never use the FPU.
>
> But doesn't this lazy scheme introduce the risk of unexpected latencies
> for the first FPU usage of a RT task?
It does.
> I mean, there is already the
> information available if a task is going to use the FPU (via the flag),
> then why not make use of it?
In the current situation, all user-space tasks have the XNFPU bit set,
because non real-time user-space tasks (including user-space real-time
tasks in secondary mode) may be preempted at a point where their FPU
context was used, so it must be switched when switching to another task
that has the XNFPU bit set. At nucleus level, FPU is switched
eagerly. At the lower, architecture dependent, level, where the XNFPU
bit is not available, switches for the user-space tasks that never used
FPU are avoided, at least for the x86 architecture.
What we could imagine, is to allow shadows to set or not the XNFPU bit,
meaning that the task would be allowed to use the FPU in primary mode,
whereas in secondary mode, it would always be allowed to use it. The
initialization of the FPU context would take place in xnshadow_map if
the XNFPU bit is set. But is it really meaningful for a task that is
always allowed to use FPU in secondary mode to be forbidden to use it in
primary mode ?
Besides, before such a change, I think we should improve the testsuite
by adding some context switching test, with an optional FPU switching
test. This is something I would like to do, once I get latency -t 1 to
work on SMP, I mean.
>
> >
> > In case of an abnormal FPU fault, the message "invalid use of FPU" is
> > printed on console.
> >
>
> Yeah, I got this unfortunately only once: full alarm, both via kernel
> message and SIGXCPU. So far I failed to reproduce it. I tested that
> "normal" FPU usage for the first time does not trigger that warnings.
> What may have caused this?
If a kernel task use the FPU without the XNFPU bit set, this error is
triggered. Every time this error was triggered in other cases, as of
today, there was a real bug.
--
Gilles Chanteperdrix.
prev parent reply other threads:[~2006-04-15 15:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-14 8:31 [Xenomai-core] T_FPU without effect Jan Kiszka
2006-04-14 13:35 ` Gilles Chanteperdrix
2006-04-15 9:49 ` Jan Kiszka
2006-04-15 15:02 ` 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=17473.2836.45267.504758@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=jan.kiszka@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.