From: alankao@andestech.com (Alan Kao)
To: linux-riscv@lists.infradead.org
Subject: On Supporting no-FPU machines
Date: Thu, 14 Jun 2018 08:25:22 +0800 [thread overview]
Message-ID: <20180614002522.GB14518@andestech.com> (raw)
In-Reply-To: <CAK8P3a1F0zYX_v6KDkO-DT9+Ud13Vmt9aWa7vF=K1AHJxVMp8g@mail.gmail.com>
On Wed, Jun 13, 2018 at 02:29:45PM +0200, Arnd Bergmann wrote:
> On Wed, Jun 13, 2018 at 9:20 AM, Christoph Hellwig <hch@infradead.org> wrote:
> > On Wed, Jun 13, 2018 at 12:20:12AM -0700, Christoph Hellwig wrote:
> >> On Wed, Jun 13, 2018 at 08:47:00AM +0200, Arnd Bergmann wrote:
> >> > > A separate CONFIG_FPU to not build the FPU code sounds fine to me
> >> > > as long as it defaults to on.
> >> >
> >> > If we do this, that option must also take care to disable the FPU hardware
> >> > if it exists. Otherwise you might run into the situation of having a system
> >> > intended to run without FPU access but a task uses FPU registers anyway
> >> > (e.g. because the compiler decides it is faster that way on the
> >> > microarchitecture it is optimizing for) and we fail to save/restore the FPU
> >> > state between task switches.
> >>
> >> I'm not sure we can force this. It would require a write to misa,
> >> which requires M-mode privileges.
>
> That also means we can't have lazy save/restore of the FPU context,
> trapping on the first access to an FPU register from a user space
> task before swapping out the previous task's state, right?
>
The lazy FP context feature trades initial performance for flexibility, and
requires changes to both M- and S-mode software.
> > [send too early]
> >
> > Instead we should just refuse to boot a !CONFIG_FPU kernel on a system
> > with a FPU.
>
> Sure, that would work.
>
> Arnd
It seems to me that a CONFIG_FPU option to compile/ignore all the floating-point
relative routines is acceptable from this discussion. Besides, there should be
a mechanism that refuses to boot a !CONFIG_FPU kernel on a system with F or D,
and also refuses to boot a CONFIG_FPU kernel on a system lacking both.
In this way, we can eliminate unnecessary codes to the maximum and keep the
modifications small for RISC-V machines without FPU.
Thanks for all your opinions. If there is no more suggestions, we will be ready
soon to send a patch for this.
Alan
next prev parent reply other threads:[~2018-06-14 0:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-13 6:26 On Supporting no-FPU machines Alan Kao
2018-06-13 6:32 ` Christoph Hellwig
2018-06-13 6:47 ` Arnd Bergmann
2018-06-13 7:20 ` Christoph Hellwig
2018-06-13 7:20 ` Christoph Hellwig
2018-06-13 12:29 ` Arnd Bergmann
2018-06-13 16:49 ` Darius Rad
2018-06-14 0:25 ` Alan Kao [this message]
2018-06-15 20:38 ` Palmer Dabbelt
2018-06-15 23:42 ` Andrew Waterman
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=20180614002522.GB14518@andestech.com \
--to=alankao@andestech.com \
--cc=linux-riscv@lists.infradead.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.