From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Dmitriy Cherkasov <dmitriy@mperpetuo.com>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] xenomai/ipipe arm64 port
Date: Fri, 25 Sep 2015 17:02:48 +0200 [thread overview]
Message-ID: <20150925150248.GE1332@hermes.click-hack.org> (raw)
In-Reply-To: <5604517A.2000602@mperpetuo.com>
On Thu, Sep 24, 2015 at 12:39:38PM -0700, Dmitriy Cherkasov wrote:
> Hello,
>
> I've added some basic FPU support. It does not do lazy switching, since
> this is not supported in the arm64 kernel yet.
Xenomai only does lazy switching for the first use of FPU by a task,
but then switches eagerly: a user-space task is always created
without the XNFPU bit. Its first use of FPU causes a fault, which
then switches FPU context, and set the XNFPU bit. Starting from
there, every context switch to this tasks switches the FPU context.
> I've tested it
> successfully with switchtest. Below is a pull request if you guys are
> interested in picking this up.
>
> -Dmitriy
>
> The following changes since commit 17095784c6d3d44dc7f1512ffab9bb957e298466:
>
> cobalt/arm64: leave mm tracking to the pipeline (2015-09-17 15:08:34
> +0200)
>
> are available in the git repository at:
>
> http://gitlab.mperpetuo.com/it/xenomai-3.git arm64-fp
>
> for you to fetch changes up to 4825d1c170b773e82f90dd15409dde489447301e:
>
> cobalt/arm64: add basic FPU support (2015-09-24 12:04:42 -0700)
Just had a look. It looks fine, except that:
- you should not set the XNFPU bit in xnarch_init_shadow_tcb,
this has been done by the upper layers
(kernel/cobalt/posix/thread.c, function pthread_create) for user
threads, and some kernel threads do not set the XNFPU bit when they
do not use the FPU
- you do not need to set it in xnarch_switch_fpu either:
xnarch_switch_fpu is only called for tasks which have the XNFPU bit
set (kernel/cobalt/thread.c function xnthread_switch_fpu).
- the context switch should set or clear a hardware bit somewhere to
cause any use of the FPU to cause a trap: some threads do not have
the XNFPU bit (some kernel threads), and you want any FPU use by
these threads to cause a trap rather than clobbering the fpu
context. Note that switchtest does not allow to test this case. This
bit should be flipped when loading the FPU context for a thread
which has the XNFPU bit.
Note that the last point requires modifying the I-pipe for arm64 to
emit I-pipe events when entering a fault caused by any FPU use. But
this modification is mandatory anyway, you also need it to handle
gracefully the FPU exceptions (div by zero, etc...).
And once you have that modification done, modifying the code to do
lazy switching for the first fault is not hard.
If you agree, I can propose patches for I-pipe and Xenomai to do
that, and let you test if it works.
--
Gilles.
https://click-hack.org
next prev parent reply other threads:[~2015-09-25 15:02 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 0:13 [Xenomai] xenomai/ipipe arm64 port Don Mahurin
2015-08-25 14:08 ` Philippe Gerum
2015-08-25 15:20 ` Jorge Ramirez Ortiz
2015-08-25 16:13 ` Jan Kiszka
2015-08-25 17:07 ` Jorge Ramirez Ortiz
2015-08-25 17:34 ` Jorge Ramirez Ortiz
2015-08-25 17:36 ` Jan Kiszka
2015-08-25 17:54 ` Jorge Ramirez Ortiz
2015-08-25 18:03 ` Jan Kiszka
2015-08-25 17:34 ` Jan Kiszka
2015-08-25 18:02 ` Jorge Ramirez Ortiz
2015-08-25 18:05 ` Don Mahurin
2015-08-25 18:34 ` Jorge Ramirez Ortiz
2015-08-25 18:36 ` Jan Kiszka
2015-08-25 18:43 ` Philippe Gerum
2015-08-25 18:52 ` Gilles Chanteperdrix
2015-08-26 14:40 ` Jorge Ramirez Ortiz
2015-08-26 16:30 ` Don Mahurin
2015-08-27 17:07 ` Jorge Ramirez Ortiz
2015-08-27 21:56 ` Don Mahurin
2015-09-01 17:45 ` Jorge Ramirez Ortiz
[not found] ` <CAPuu0=jX6ig5L7SJrmPVOhCmOm=gwxEmTafTpOqzE85hOji8CA@mail.gmail.com>
2015-09-01 19:11 ` Jorge Ramirez Ortiz
2015-09-01 19:24 ` Philippe Gerum
2015-09-01 20:14 ` Jorge Ramirez Ortiz
2015-09-01 21:02 ` Hongfei Cheng
2015-09-02 0:43 ` Don Mahurin
2015-09-07 16:03 ` Philippe Gerum
2015-09-24 19:39 ` Dmitriy Cherkasov
2015-09-25 15:02 ` Gilles Chanteperdrix [this message]
2015-09-25 17:14 ` Dmitriy Cherkasov
2015-09-25 18:01 ` Gilles Chanteperdrix
2015-09-26 11:24 ` Gilles Chanteperdrix
2015-09-28 23:57 ` Dmitriy Cherkasov
2015-09-29 0:12 ` Gilles Chanteperdrix
2015-09-29 12:54 ` Jorge Ramirez Ortiz
2015-09-29 17:31 ` Dmitriy Cherkasov
2015-09-29 17:47 ` Gilles Chanteperdrix
2015-09-29 20:17 ` Jorge Ramirez Ortiz
2015-09-29 17:05 ` Don Mahurin
2015-09-29 14:14 ` Lennart Sorensen
2015-09-29 20:49 ` Gilles Chanteperdrix
2015-10-01 23:51 ` Dmitriy Cherkasov
2015-10-02 10:01 ` Gilles Chanteperdrix
2015-10-02 11:55 ` Gilles Chanteperdrix
2015-10-02 20:18 ` Dmitriy Cherkasov
2015-10-03 9:53 ` Philippe Gerum
2015-10-03 10:01 ` Philippe Gerum
2015-10-03 10:05 ` Philippe Gerum
2015-09-01 19:30 ` Philippe Gerum
2015-09-01 20:47 ` Jorge Ramirez Ortiz
2015-09-01 19:44 ` 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=20150925150248.GE1332@hermes.click-hack.org \
--to=gilles.chanteperdrix@xenomai.org \
--cc=dmitriy@mperpetuo.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.