public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vincent Chen <vincentc@andestech.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: <deanbo422@gmail.com>, <linux-kernel@vger.kernel.org>,
	<green.hu@gmail.com>
Subject: Re: [PATCH v2 1/5] nds32: nds32 FPU port
Date: Fri, 12 Oct 2018 16:49:45 +0800	[thread overview]
Message-ID: <20181012084945.GB10286@andestech.com> (raw)
In-Reply-To: <CAK8P3a2U_-EmBf5r4wELddwTYF-S_GKPBcwPiqhV0cp-Cb44gA@mail.gmail.com>

On Thu, Oct 11, 2018 at 03:30:30PM +0800, Arnd Bergmann wrote:
> On Thu, Oct 11, 2018 at 4:56 AM Vincent Chen <vincentc@andestech.com> wrote:
> >
> > This commit contains basic components for nds32 FPU support such as
> > FPU exception handler and context switch for FPU register.
> >
> > diff --git a/arch/nds32/Kconfig.cpu b/arch/nds32/Kconfig.cpu
> > index b8c8984..7ee4e19 100644
> > --- a/arch/nds32/Kconfig.cpu
> > +++ b/arch/nds32/Kconfig.cpu
> > @@ -7,6 +7,28 @@ config CPU_LITTLE_ENDIAN
> >         bool "Little endian"
> >         default y
> >
> > +config FPU
> > +       bool "FPU support"
> > +       default n
> > +       help
> > +         If FPU ISA is used in user space, this configure shall be Y to make
> > +         the fpu context switch and fpu exception handler is enabled in kernel.
> > +         Lazy FPU is the default scheme for fpu context switch. If user wants
> > +         to disable Lazy FPU scheme, please enable CONFIG_UNLAZY_FPU.
> > +
> > +         If no FPU ISA is used in user space, say N.
> 
> There was a long discussion on RISC-V about what happens when
> FPU support is enabled or disabled, you may have seen that as well.
> 
> Can you confirm that:
> 
> a) A kernel with FPU support enabled running on a CPU without an FPU
>     will behave the same as a kernel without FPU support, and in particular
>     not crash while trying to access the FPU
> b) A kernel with FPU support disabled running on a CPU with an FPU
>     prevents user space from accessing the FPU, to avoid corrupting
>     FPU registers during a task switch when a process accidentally contains
>     FPU access

In this patch user program will be terminated when accessing FPU register
if the FPU support is disabled on kernel. Hence, condition b) is promised.
Condition a) is unsupported in this patch. I will add this support in
the next version patch.
 
> > +config UNLAZY_FPU
> > +       bool "Unlazy FPU support"
> > +       depends on FPU
> > +       default n
> > +       help
> > +         Say Y here to disable lazy FPU scheme. Disable lazy FPU scheme causes
> > +         some performance loss because the fpu register are loaded and stored
> > +         in each context switch.
> > +
> > +         For nomal case, say N.
> 
> I prefer Kconfig symbols to avoid using negatives, as this easily gets
> confusing. Why not do it like
> 
> config LAZY_FPU_SWITCHING
>            bool "Lazy FPU switching"
>            depends on FPU
>            default y
> 
>       Arnd

OK, I will modify it in the next version patch.

Thanks for your comments.


Regards
Vincent


  reply	other threads:[~2018-10-12  8:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11  2:20 [PATCH v2 0/5] nds32 FPU port Vincent Chen
2018-10-11  2:20 ` [PATCH v2 1/5] nds32: " Vincent Chen
2018-10-11  7:30   ` Arnd Bergmann
2018-10-12  8:49     ` Vincent Chen [this message]
2018-10-12  9:22       ` Arnd Bergmann
2018-10-11  2:20 ` [PATCH v2 2/5] nds32: Support FP emulation Vincent Chen
2018-10-11  2:20 ` [PATCH v2 3/5] nds32: support denormalized result through FP emulator Vincent Chen
2018-10-11  2:20 ` [PATCH v2 4/5] math-emu/op-2.h: Use statement expressions to prevent negative constant shift Vincent Chen
2018-10-11  2:20 ` [PATCH v2 5/5] math-emu/soft-fp.h: (_FP_ROUND_ZERO) cast 0 to void to fix warning Vincent Chen

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=20181012084945.GB10286@andestech.com \
    --to=vincentc@andestech.com \
    --cc=arnd@arndb.de \
    --cc=deanbo422@gmail.com \
    --cc=green.hu@gmail.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox