Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1771726imm; Sat, 23 Jun 2018 02:17:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJY2CSD6u2MlT5g5Gw7suJHSYcpcLcUybN8rtGz+hccLyF2l9KW2WZ9C0HPWiXjBrfc8MgS X-Received: by 2002:a17:902:8a95:: with SMTP id p21-v6mr4838609plo.91.1529745470914; Sat, 23 Jun 2018 02:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529745470; cv=none; d=google.com; s=arc-20160816; b=SQtmVnAbSKYB9p11EiwYr+BmGJ/54bOLRl+GekpmYeArCby5AW6Fpo0cU4p5dYL485 1a3jI5K/QzxgeNdP5gzEJE+FMcJm+DgvGW7UmYmZqwaEY6nR1iS5bVuyM7lwTIudOluO +ddoEwCfBQjuvLixIgpgNq4cXSzHn8epbIYpuwPHn7ofLqFt6YTmuU7THeZJPjvMtpfV dqLvl74DD7cNgUE6j0RAZzYGXkFNy2D7yGayaCUddz8G+f30uZTkL35P/0hDptuw2Zg2 H0JeWw5W7H5F9LZS7Zxz7zaGqJT59v0UKAjYOTVJgQD0hLU9AXKfbc2BRWMnTbOKkTn1 ASRA== 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:arc-authentication-results; bh=FH47gaBJzsVb2TidayzWsmITMDVCdSADv39VKLvlkgc=; b=EgPSr58Cv9RCSu18EuVfuYI/0KhowObWC7gPDHw6IvdO8QxQO0vMBnww10+fm/tUg2 xy7Kpo5x0C3nhO8e9RymJXxazT4F/RNI1mtVC+iQyuZiXBvqrEr+16tEB+3g46ttq11G m69+6dFgDK5K1e/iCblv9Md4XabuXpxnmhAO9RLDFEsyAPtgxaQlBV7jKIHeXFez4bj6 UzphbOBcxWp8lG+eC4owWvM8SRaqvKJQ3LaoopDwN78ZgegdXd8883gOjKAWKMshbd7C v1WKI2MZCP9YytNf30m+e4/fpm3Xft4h17fTuYVbyZSkrfpQjNABXbotPOmjI26PeIPg UH6A== 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 p23-v6si9478861plr.384.2018.06.23.02.17.35; Sat, 23 Jun 2018 02:17:50 -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 S1751800AbeFWJQ4 (ORCPT + 99 others); Sat, 23 Jun 2018 05:16:56 -0400 Received: from mail.skyhub.de ([5.9.137.197]:34154 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751766AbeFWJQy (ORCPT ); Sat, 23 Jun 2018 05:16:54 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id iJ2hPOTzVLit; Sat, 23 Jun 2018 11:16:53 +0200 (CEST) Received: from zn.tnic (p200300EC2BDC2300329C23FFFEA6A903.dip0.t-ipconnect.de [IPv6:2003:ec:2bdc:2300:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id E9BCC1EC0346; Sat, 23 Jun 2018 11:16:52 +0200 (CEST) Date: Sat, 23 Jun 2018 11:16:48 +0200 From: Borislav Petkov To: Pavel Tatashin Cc: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux@armlinux.org.uk, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, john.stultz@linaro.org, sboyd@codeaurora.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, douly.fnst@cn.fujitsu.com, peterz@infradead.org, prarit@redhat.com, feng.tang@intel.com, pmladek@suse.com, gnomes@lxorguk.ukuu.org.uk, linux-s390@vger.kernel.org Subject: Re: [PATCH v12 02/11] x86: initialize static branching early Message-ID: <20180623091648.GA29468@zn.tnic> References: <20180621212518.19914-1-pasha.tatashin@oracle.com> <20180621212518.19914-3-pasha.tatashin@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180621212518.19914-3-pasha.tatashin@oracle.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 21, 2018 at 05:25:09PM -0400, Pavel Tatashin wrote: > static branching is useful to hot-patch branches that are used in hot > path, but are infrequently changed. > > x86 clock framework is one example that uses static branches to setup > the best clock during boot and never change it again. > > Since we plan to enable clock early, we need static branching > functionality early as well. > > static branching requires patching nop instructions, thus, we need > arch_init_ideal_nops() to be called prior to jump_label_init() > > Here we do all the necessary steps to call arch_init_ideal_nops > after early_cpu_init(). > > Signed-off-by: Pavel Tatashin > Suggested-by: Peter Zijlstra > --- > arch/x86/kernel/cpu/amd.c | 13 +++++++----- > arch/x86/kernel/cpu/common.c | 38 +++++++++++++++++++----------------- > arch/x86/kernel/setup.c | 4 ++-- > 3 files changed, 30 insertions(+), 25 deletions(-) Looks ok to me. Reviewed-by: Borislav Petkov Also, please take the patch below into your queue and keep it a separate patch in case we have to revert it later. It should help in keeping the mess manageable and not let it go completely out of control before we've done the cleanup. Thx. --- From: Borislav Petkov Date: Sat, 23 Jun 2018 11:04:47 +0200 Subject: [PATCH] x86/CPU: Call detect_nopl() only on the BSP Make it use the setup_* variants and have it be called only on the BSP and drop the call in generic_identify() - X86_FEATURE_NOPL will be replicated to the APs through the forced caps. Helps keep the mess at a manageable level. Signed-off-by: Borislav Petkov --- arch/x86/kernel/cpu/common.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 952d31f75821..1b5edbd8f6db 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1021,12 +1021,12 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c) * unless we can find a reliable way to detect all the broken cases. * Enable it explicitly on 64-bit for non-constant inputs of cpu_has(). */ -static void detect_nopl(struct cpuinfo_x86 *c) +static void detect_nopl(void) { #ifdef CONFIG_X86_32 - clear_cpu_cap(c, X86_FEATURE_NOPL); + setup_clear_cpu_cap(X86_FEATURE_NOPL); #else - set_cpu_cap(c, X86_FEATURE_NOPL); + setup_force_cpu_cap(X86_FEATURE_NOPL); #endif } @@ -1105,7 +1105,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) if (!pgtable_l5_enabled()) setup_clear_cpu_cap(X86_FEATURE_LA57); - detect_nopl(c); + detect_nopl(); } void __init early_cpu_init(void) @@ -1203,8 +1203,6 @@ static void generic_identify(struct cpuinfo_x86 *c) get_model_name(c); /* Default name */ - detect_nopl(c); - detect_null_seg_behavior(c); /* -- 2.17.0.582.gccdcbd54c -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.