Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp506108imm; Fri, 12 Oct 2018 01:52:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV61ZkDb7sLNxDj5gLn86moZdw3DjqI3r60TCIgb6LPv6x7O7xzqmsfAFNOr9QtjYxmofqhnF X-Received: by 2002:a63:8543:: with SMTP id u64-v6mr4629443pgd.373.1539334327808; Fri, 12 Oct 2018 01:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539334327; cv=none; d=google.com; s=arc-20160816; b=mAIUebZ/i0Yxdoa6ESroaWeNu7DpYQwdwVLae1bRFKUTEZ1cs3IJaBHPwumVCs8QkB FjUjRT60kQ9rphNrX0MPikhXBM7prveacugsGGV9zL1Z5fgIHwM1bvIQFAysWze5wIVx Dw7WlHDSBwIQDwESh6DSNLkcCOZuVDnad6ey5VnZFlmGX9COt8QoWe13Ox3TFuJewBrJ nj4Dj066EIcWzlJZP4nVAmb4mPkmPceIf2knlr6yJltXJ/AKybqNY1Lv9f0rpvIFW0Kq vA0bcVUq5kLwRH3m4/M6d0ua9vkqeRazexhXNA6Yd3ope6trzMYJRHjjm1LieNbSR4+y QEQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=da5qbPsVmHzvRFbFy7Qe8gTM4mxcQa1sFQP7vxK3NEE=; b=snirKPgg+Y3sF+YlEXC915gQ39HhBANTimLBGHd6EZGn+HK4ILbSqRmzSSy6JOgmrx cRJpbpB9sLor0/ZU9RZCC4SdtNsO7BpQ2ZYxbeGMCa3V/yoKdZnQ6ukLyd6L7PBtZqTJ OSJTxxWq/c68Jj/cIHE1NbE6m896YgZVis6/R9HR3kuOduxSFkXphheTPvADYxvbgkDL sy17y+4Kg0eJvb4mEE52hBEwnF8VDh/4vVbe1igdzC05gG0ZLeavZUbSBFoHC7XTmiHF k7QkwsAwnmNdl3SaEHdKbXFnybllJsS23BdVCLDq5I6HgY8qM4bCKAQdgQ05aGePMGGh +2og== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6-v6si715106plg.84.2018.10.12.01.51.52; Fri, 12 Oct 2018 01:52:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728028AbeJLQVX (ORCPT + 99 others); Fri, 12 Oct 2018 12:21:23 -0400 Received: from 59-120-53-16.HINET-IP.hinet.net ([59.120.53.16]:45849 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726071AbeJLQVX (ORCPT ); Fri, 12 Oct 2018 12:21:23 -0400 Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id w9C8qADG034367; Fri, 12 Oct 2018 16:52:10 +0800 (GMT-8) (envelope-from vincentc@andestech.com) Received: from andestech.com (10.0.15.65) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.123.3; Fri, 12 Oct 2018 16:49:44 +0800 Date: Fri, 12 Oct 2018 16:49:45 +0800 From: Vincent Chen To: Arnd Bergmann CC: , , Subject: Re: [PATCH v2 1/5] nds32: nds32 FPU port Message-ID: <20181012084945.GB10286@andestech.com> References: <1539224450-19928-1-git-send-email-vincentc@andestech.com> <1539224450-19928-2-git-send-email-vincentc@andestech.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.0.15.65] X-DNSRBL: X-MAIL: ATCSQR.andestech.com w9C8qADG034367 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 11, 2018 at 03:30:30PM +0800, Arnd Bergmann wrote: > On Thu, Oct 11, 2018 at 4:56 AM Vincent Chen 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