Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2002377imm; Thu, 14 Jun 2018 07:17:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLR29FRQremSEVORxq5KdmL9e854BeD2IKM3Frx9KS8KM6r+p2HnjBHZgi7vO28wcnCAO89 X-Received: by 2002:a62:e506:: with SMTP id n6-v6mr9649598pff.116.1528985875759; Thu, 14 Jun 2018 07:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528985875; cv=none; d=google.com; s=arc-20160816; b=HIBXEVpoqN9yOOeHgXtDFffn6uKnu6yTCdtcmcikvW/i+d0WcDvzr8F5mdYyyEoSGl xrg/ayojSFXiV1jxewUy4GpmTvIEYlXkdjQUW64HlBONwPtHezlWfxz8shVZ1Exm9n1X XwdM/W/Sy9Rl1Wnc4npIbjUqrI89OBGHh1ZO2OmQEpBM0Vu+nuIrNRoggjHBOEymcoaT SWBAeu1AgM4EM1Fpu/eh7UKOVRo6pPkgVEaWPF18rsvOjxd3rutKM5JEO/tC9J24dbfp /0vyTgdHcxu/ryUM6GIjSGKbd+qx6WNij3IXJM38oBJdAxnw5312/ct+dRDTiwGgr+vf 6Hpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=z6yjxHXda1PXSUsI/VFhiF9QT1WZUGWCqtYN+8n9K1Q=; b=sFSB8Hu35Cmsz2gaMhXNezfPZd9imkbz7o4Li7mpcOfC5Jnm9kZu8AtCfIDtroxWOI 9FaDKk3Q86ocqYiEZpwFR6+6zXBu9aUzA7U4jtZ6UjM6kGVSh1W0h6eW+GHufaOd8EHK aYK0ShGcxoAGvEp3Uw/Np2aLTCbEqfUBYiiJOUUgoHfGTXIADgA18fjeioYfHCwaBFXz 2t7GDLpCqkfJ4nSteTa47nAuzBMoQfHc3vWxKpCFUCcHR1wTFEjlR3ZUH5qSNu5wMGmq Dj+qeimiE6cike6fNkDelqrHd2MNQOp9CZw6O9CtdjeJrbLjHCa1fQeUSIqvjRoXAMPQ euVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pRp5zzl2; 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 u9-v6si5469044pls.462.2018.06.14.07.17.41; Thu, 14 Jun 2018 07:17:55 -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; dkim=pass header.i=@kernel.org header.s=default header.b=pRp5zzl2; 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 S965960AbeFNOQO (ORCPT + 99 others); Thu, 14 Jun 2018 10:16:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:55236 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966288AbeFNONn (ORCPT ); Thu, 14 Jun 2018 10:13:43 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F58B208DB; Thu, 14 Jun 2018 14:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528985622; bh=VnP/QU/3ozkWCPgP8HQNUjF4F134O0gK6YhKoIvvjgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pRp5zzl2Gd5NRaN3mAjaPKsFu5p0y+18nNQxLL3TbPai6ktN4nUS8qfkIY9EpFVwf gYTNeI6JHEEol+WdNpRmvQIvNvHrLeuXWtXJZ/LDKSNX+MbELIIuAV6W0HnDN/CZ2n KM391dvH7qk9KSaJHDIypSGqIDtQWjGZnfex7xWI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Lutomirski , Andy Lutomirski , Borislav Petkov , Brian Gerst , Dave Hansen , Denys Vlasenko , Fenghua Yu , "H. Peter Anvin" , Linus Torvalds , Oleg Nesterov , Peter Zijlstra , Quentin Casasnovas , Sai Praneeth Prakhya , Thomas Gleixner , yu-cheng yu , Ingo Molnar Subject: [PATCH 4.4 07/24] x86/fpu: Fix no387 regression Date: Thu, 14 Jun 2018 16:05:02 +0200 Message-Id: <20180614132724.784717440@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180614132724.483802160@linuxfoundation.org> References: <20180614132724.483802160@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andy Lutomirski commit f363938c70a04e6bc99023a5e0c44ef7879b903f upstream. After fixing FPU option parsing, we now parse the 'no387' boot option too early: no387 clears X86_FEATURE_FPU before it's even probed, so the boot CPU promptly re-enables it. I suspect it gets even more confused on SMP. Fix the probing code to leave X86_FEATURE_FPU off if it's been disabled by setup_clear_cpu_cap(). Signed-off-by: Andy Lutomirski Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Hansen Cc: Denys Vlasenko Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Quentin Casasnovas Cc: Sai Praneeth Prakhya Cc: Thomas Gleixner Cc: yu-cheng yu Fixes: 4f81cbafcce2 ("x86/fpu: Fix early FPU command-line parsing") Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/fpu/init.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c @@ -78,13 +78,15 @@ static void fpu__init_system_early_gener cr0 &= ~(X86_CR0_TS | X86_CR0_EM); write_cr0(cr0); - asm volatile("fninit ; fnstsw %0 ; fnstcw %1" - : "+m" (fsw), "+m" (fcw)); + if (!test_bit(X86_FEATURE_FPU, (unsigned long *)cpu_caps_cleared)) { + asm volatile("fninit ; fnstsw %0 ; fnstcw %1" + : "+m" (fsw), "+m" (fcw)); - if (fsw == 0 && (fcw & 0x103f) == 0x003f) - set_cpu_cap(c, X86_FEATURE_FPU); - else - clear_cpu_cap(c, X86_FEATURE_FPU); + if (fsw == 0 && (fcw & 0x103f) == 0x003f) + set_cpu_cap(c, X86_FEATURE_FPU); + else + clear_cpu_cap(c, X86_FEATURE_FPU); + } #ifndef CONFIG_MATH_EMULATION if (!cpu_has_fpu) {