From dcf050af29bc1c6bd38ba7f173dc18bb7c5629e1 Mon Sep 17 00:00:00 2001 From: Robert Mustacchi Date: Mon, 22 Sep 2014 16:17:03 -0700 Subject: 5192 cpuid_pass2 incorrectly asserts when disabling xsave Reviewed by: Richard Lowe Reviewed by: Hans Rosenfeld Reviewed by: Garrett D'Amore Reviewed by: Josef 'Jeff' Sipek Approved by: Gordon Ross --- usr/src/uts/i86pc/os/cpuid.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/usr/src/uts/i86pc/os/cpuid.c b/usr/src/uts/i86pc/os/cpuid.c index a9b4428347..67f2127620 100644 --- a/usr/src/uts/i86pc/os/cpuid.c +++ b/usr/src/uts/i86pc/os/cpuid.c @@ -32,7 +32,7 @@ * Portions Copyright 2009 Advanced Micro Devices, Inc. */ /* - * Copyright (c) 2012, Joyent, Inc. All rights reserved. + * Copyright (c) 2014, Joyent, Inc. All rights reserved. */ /* * Various routines to handle identification @@ -1946,16 +1946,28 @@ cpuid_pass2(cpu_t *cpu) "continue.", cpu->cpu_id); } else { /* - * Must be from boot CPU, OK to disable XSAVE. + * If we reached here on the boot CPU, it's also + * almost certain that we'll reach here on the + * non-boot CPUs. When we're here on a boot CPU + * we should disable the feature, on a non-boot + * CPU we need to confirm that we have. */ - ASSERT(cpu->cpu_id == 0); - remove_x86_feature(x86_featureset, - X86FSET_XSAVE); - remove_x86_feature(x86_featureset, X86FSET_AVX); - CPI_FEATURES_ECX(cpi) &= ~CPUID_INTC_ECX_XSAVE; - CPI_FEATURES_ECX(cpi) &= ~CPUID_INTC_ECX_AVX; - CPI_FEATURES_ECX(cpi) &= ~CPUID_INTC_ECX_F16C; - xsave_force_disable = B_TRUE; + if (cpu->cpu_id == 0) { + remove_x86_feature(x86_featureset, + X86FSET_XSAVE); + remove_x86_feature(x86_featureset, + X86FSET_AVX); + CPI_FEATURES_ECX(cpi) &= + ~CPUID_INTC_ECX_XSAVE; + CPI_FEATURES_ECX(cpi) &= + ~CPUID_INTC_ECX_AVX; + CPI_FEATURES_ECX(cpi) &= + ~CPUID_INTC_ECX_F16C; + xsave_force_disable = B_TRUE; + } else { + VERIFY(is_x86_feature(x86_featureset, + X86FSET_XSAVE) == B_FALSE); + } } } } -- cgit v1.2.3