Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752375AbcC2M2q (ORCPT ); Tue, 29 Mar 2016 08:28:46 -0400 Received: from terminus.zytor.com ([198.137.202.10]:49044 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751453AbcC2M2o (ORCPT ); Tue, 29 Mar 2016 08:28:44 -0400 Date: Tue, 29 Mar 2016 05:28:04 -0700 From: tip-bot for Borislav Petkov Message-ID: Cc: bp@suse.de, mingo@kernel.org, luto@amacapital.net, hpa@zytor.com, luto@kernel.org, torvalds@linux-foundation.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org Reply-To: luto@kernel.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, bp@suse.de, mingo@kernel.org, hpa@zytor.com, luto@amacapital.net In-Reply-To: <1458130769-24963-1-git-send-email-bp@alien8.de> References: <1458130769-24963-1-git-send-email-bp@alien8.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/cpu: Do the feature test first in enable_sep_cpu() Git-Commit-ID: b3edfda4382ffaef5e5c1cffb25a33b3b9ef4546 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1642 Lines: 53 Commit-ID: b3edfda4382ffaef5e5c1cffb25a33b3b9ef4546 Gitweb: http://git.kernel.org/tip/b3edfda4382ffaef5e5c1cffb25a33b3b9ef4546 Author: Borislav Petkov AuthorDate: Wed, 16 Mar 2016 13:19:29 +0100 Committer: Ingo Molnar CommitDate: Tue, 29 Mar 2016 12:57:12 +0200 x86/cpu: Do the feature test first in enable_sep_cpu() ... before assigning local vars. Kill out label too and simplify. No functionality change. Signed-off-by: Borislav Petkov Acked-by: Andy Lutomirski Cc: Andy Lutomirski Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1458130769-24963-1-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar --- arch/x86/kernel/cpu/common.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 8394b3d..7fea407 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1076,12 +1076,12 @@ void enable_sep_cpu(void) struct tss_struct *tss; int cpu; + if (!boot_cpu_has(X86_FEATURE_SEP)) + return; + cpu = get_cpu(); tss = &per_cpu(cpu_tss, cpu); - if (!boot_cpu_has(X86_FEATURE_SEP)) - goto out; - /* * We cache MSR_IA32_SYSENTER_CS's value in the TSS's ss1 field -- * see the big comment in struct x86_hw_tss's definition. @@ -1096,7 +1096,6 @@ void enable_sep_cpu(void) wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)entry_SYSENTER_32, 0); -out: put_cpu(); } #endif