Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1447345 > unrolled thread

[PATCH] x86, fpu: do not BUG_ON() in early FPU code

Started byDave Hansen <dave@sr71.net>
First post2016-07-20 18:30 +0200
Last post2016-07-20 20:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86, fpu: do not BUG_ON() in early FPU code Dave Hansen <dave@sr71.net> - 2016-07-20 18:30 +0200
    Re: [PATCH] x86, fpu: do not BUG_ON() in early FPU code Ingo Molnar <mingo@kernel.org> - 2016-07-20 20:10 +0200

#1447345 — [PATCH] x86, fpu: do not BUG_ON() in early FPU code

FromDave Hansen <dave@sr71.net>
Date2016-07-20 18:30 +0200
Subject[PATCH] x86, fpu: do not BUG_ON() in early FPU code
Message-ID<rX2xI-3I2-11@gated-at.bofh.it>
From: Dave Hansen <dave.hansen@linux.intel.com>

I don't think it is really possible to have a system where CPUID
enumerates support for XSAVE but that it does not have FP/SSE
(they are "legacy" features and always present).

But, I did manage to hit this case in qemu when I enabled its
somewhat shaky XSAVE support.  The bummer is that the FPU is set
up before we parse the command-line or have *any* console support
including earlyprintk.

So a BUG() here is worthless.  All it does it guarantee that
if/when we hit this case we have an empty console.  So, remove
the BUG() and try to limp along by disabling XSAVE and trying to
continue.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---

 b/arch/x86/kernel/fpu/xstate.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN arch/x86/kernel/fpu/xstate.c~x86-fpu-do-not-BUG_ON-early arch/x86/kernel/fpu/xstate.c
--- a/arch/x86/kernel/fpu/xstate.c~x86-fpu-do-not-BUG_ON-early	2016-07-20 09:03:07.347941392 -0700
+++ b/arch/x86/kernel/fpu/xstate.c	2016-07-20 09:17:15.001309137 -0700
@@ -715,7 +715,8 @@ void __init fpu__init_system_xstate(void
 
 	if ((xfeatures_mask & XFEATURE_MASK_FPSSE) != XFEATURE_MASK_FPSSE) {
 		pr_err("x86/fpu: FP/SSE not present amongst the CPU's xstate features: 0x%llx.\n", xfeatures_mask);
-		BUG();
+		fpu__init_disable_system_xstate();
+		return;
 	}
 
 	xfeatures_mask &= fpu__get_supported_xfeatures_mask();
_

[toc] | [next] | [standalone]


#1447385

FromIngo Molnar <mingo@kernel.org>
Date2016-07-20 20:10 +0200
Message-ID<rX46t-4PK-1@gated-at.bofh.it>
In reply to#1447345
* Dave Hansen <dave@sr71.net> wrote:

> 
> From: Dave Hansen <dave.hansen@linux.intel.com>
> 
> I don't think it is really possible to have a system where CPUID
> enumerates support for XSAVE but that it does not have FP/SSE
> (they are "legacy" features and always present).
> 
> But, I did manage to hit this case in qemu when I enabled its
> somewhat shaky XSAVE support.  The bummer is that the FPU is set
> up before we parse the command-line or have *any* console support
> including earlyprintk.
> 
> So a BUG() here is worthless.  All it does it guarantee that
> if/when we hit this case we have an empty console.  So, remove
> the BUG() and try to limp along by disabling XSAVE and trying to
> continue.
> 
> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
> ---
> 
>  b/arch/x86/kernel/fpu/xstate.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff -puN arch/x86/kernel/fpu/xstate.c~x86-fpu-do-not-BUG_ON-early arch/x86/kernel/fpu/xstate.c
> --- a/arch/x86/kernel/fpu/xstate.c~x86-fpu-do-not-BUG_ON-early	2016-07-20 09:03:07.347941392 -0700
> +++ b/arch/x86/kernel/fpu/xstate.c	2016-07-20 09:17:15.001309137 -0700
> @@ -715,7 +715,8 @@ void __init fpu__init_system_xstate(void
>  
>  	if ((xfeatures_mask & XFEATURE_MASK_FPSSE) != XFEATURE_MASK_FPSSE) {
>  		pr_err("x86/fpu: FP/SSE not present amongst the CPU's xstate features: 0x%llx.\n", xfeatures_mask);
> -		BUG();
> +		fpu__init_disable_system_xstate();
> +		return;

Ok, but please put a comment there explaining why we are not stopping the system.

Thanks,

	Ingo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web