Received: by 10.223.185.116 with SMTP id b49csp3207597wrg; Mon, 5 Mar 2018 16:33:29 -0800 (PST) X-Google-Smtp-Source: AG47ELseYjcKv1YHf8SQKbgTsPc5u6gRGG+zUDkeUTGDPueuUAnceKL+PeVwzF73zPxEfcPZPseV X-Received: by 10.98.17.147 with SMTP id 19mr16871968pfr.160.1520296409208; Mon, 05 Mar 2018 16:33:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520296409; cv=none; d=google.com; s=arc-20160816; b=gID96+r74mubiUM2TXewjj0/y0J6WhIUHOIMkfY9Mumdh7UK5qLiWsIWgA3/pimU2R rsCgipvJodRK936xsXvfdEmXcuVtMTK1FV8TR0/DtzdAdWK3WikfS522lSGqPB6+PfyP MAPp6jAWQfVYQfJ9fPfQRkWtO8oAmQidaRd2bVpyh8eu+L6oZ2Y1P0UYYGXvASWdHXIJ 4OEA/WQ9CrBrxMaXHps9Gn8TwgjkJUK7zF4yL12sKoR361AQLE92/X9WGcE6tVEk7lRL q6dwx7XQ3WXf7uD4DVrdUvf4r2qyfidkgIxrFayS0UPXvk3fNkRlo1SKWqdo35E8mNei bCOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=ubGaHsHeebIW5YMsXMACLxnvLv09X8RIxqEyqzJe3BQ=; b=qwg84TZCXgiY9Zw47LW02GRP1uEvnl/sK8O+uLjViQIagOcJRDLKAXM4RNDahV5+mu 4vmCsQoSMwkcmItmA/HH962jRtFGPxG4B4BF+8dgjRmdNu1QmZ16Ngqc2UiMara+jJJ4 puHXYwaGsdskAikODoRmKWGBmzVDFiOViZz8PEMzWLnkMynXS6St2VTUBS8oys+kmwbI oPQXaFuHSNJ4UlTkHRaPVOAWucuT3PY0GL/uuKGG2FSFK+pAx6xH1tBKSn+KcpyECSlP lZNTBTpmB7C0D7K0xXIczftN2OBOp5Kk/VdMqYzCGFXciVifS4seSxq8KX50I7ej/PTs uKNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=ixtwzHbE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si10853475pfh.84.2018.03.05.16.33.14; Mon, 05 Mar 2018 16:33:29 -0800 (PST) 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=@oracle.com header.s=corp-2017-10-26 header.b=ixtwzHbE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933586AbeCFAbU (ORCPT + 99 others); Mon, 5 Mar 2018 19:31:20 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40912 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933163AbeCFA0s (ORCPT ); Mon, 5 Mar 2018 19:26:48 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w260LTpb187154; Tue, 6 Mar 2018 00:26:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=ubGaHsHeebIW5YMsXMACLxnvLv09X8RIxqEyqzJe3BQ=; b=ixtwzHbEQYLIwaXuSFui5xNQV3uEOVvSZjZvAbY+iudEWjRfbXGJMEWZIBNSsaWVSnMb qZ1FLPxhouQMKMtfkwVfi5fLULI9Xeo+tAghRtrI4QfcB7WscNFkpAjFiaGfVeum8Akw 52ryAHOl6R2F56MsW1SP/GehqzK/H7EtnES/JwiEnVviE9O8sUkZT/ZZo9940Oq2jZpr dZM4R2gHYkVRVSabKrvpgRGMssKGJd3uy/1j9W+BTvwXRBAjniLtcSBTPEOnuK5AT4Cx 7oewBujCAoTBH1oq/NaJOz2PbMRnahaUv5bYiIYL19rr2kWL6wFvSfg9ptiyl4WILUnn 7Q== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2ghdxf8jrw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 00:26:44 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w260QhMA011962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 00:26:44 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w260QhWq000518; Tue, 6 Mar 2018 00:26:43 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Mar 2018 16:26:43 -0800 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, Alexander.Levin@microsoft.com, dan.j.williams@intel.com, sathyanarayanan.kuppuswamy@intel.com, pankaj.laxminarayan.bharadiya@intel.com, akuster@mvista.com, cminyard@mvista.com, pasha.tatashin@oracle.com, gregkh@linuxfoundation.org, stable@vger.kernel.org Subject: [PATCH 4.1 50/65] kaiser: add "nokaiser" boot option, using ALTERNATIVE Date: Mon, 5 Mar 2018 19:25:23 -0500 Message-Id: <20180306002538.1761-51-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180306002538.1761-1-pasha.tatashin@oracle.com> References: <20180306002538.1761-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8823 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803060003 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hugh Dickins Added "nokaiser" boot option: an early param like "noinvpcid". Most places now check int kaiser_enabled (#defined 0 when not CONFIG_KAISER) instead of #ifdef CONFIG_KAISER; but entry_64.S and entry_64_compat.S are using the ALTERNATIVE technique, which patches in the preferred instructions at runtime. That technique is tied to x86 cpu features, so X86_FEATURE_KAISER is fabricated. Prior to "nokaiser", Kaiser #defined _PAGE_GLOBAL 0: revert that, but be careful with both _PAGE_GLOBAL and CR4.PGE: setting them when nokaiser like when !CONFIG_KAISER, but not setting either when kaiser - neither matters on its own, but it's hard to be sure that _PAGE_GLOBAL won't get set in some obscure corner, or something add PGE into CR4. By omitting _PAGE_GLOBAL from __supported_pte_mask when kaiser_enabled, all page table setup which uses pte_pfn() masks it out of the ptes. It's slightly shameful that the same declaration versus definition of kaiser_enabled appears in not one, not two, but in three header files (asm/kaiser.h, asm/pgtable.h, asm/tlbflush.h). I felt safer that way, than with #including any of those in any of the others; and did not feel it worth an asm/kaiser_enabled.h - kernel/cpu/common.c includes them all, so we shall hear about it if they get out of synch. Cleanups while in the area: removed the silly #ifdef CONFIG_KAISER from kaiser.c; removed the unused native_get_normal_pgd(); removed the spurious reg clutter from SWITCH_*_CR3 macro stubs; corrected some comments. But more interestingly, set CR4.PSE in secondary_startup_64: the manual is clear that it does not matter whether it's 0 or 1 when 4-level-pts are enabled, but I was distracted to find cr4 different on BSP and auxiliaries - BSP alone was adding PSE, in probe_page_size_mask(). Signed-off-by: Hugh Dickins Acked-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman (cherry picked from commit e345dcc9481543edf4a0a5df4c4c2f9597b0a997) Signed-off-by: Pavel Tatashin Conflicts: arch/x86/entry/entry_64.S (not in this tree) arch/x86/kernel/entry_64.S (patched instead of that) --- arch/x86/include/asm/cpufeature.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index b62f5b1a4361..8effe086de27 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -201,6 +201,9 @@ /* Because the ALTERNATIVE scheme is for members of the X86_FEATURE club... */ #define X86_FEATURE_KAISER ( 7*32+31) /* CONFIG_KAISER w/o nokaiser */ +/* Because the ALTERNATIVE scheme is for members of the X86_FEATURE club... */ +#define X86_FEATURE_KAISER ( 7*32+31) /* CONFIG_KAISER w/o nokaiser */ + /* Virtualization flags: Linux defined, word 8 */ #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ #define X86_FEATURE_VNMI ( 8*32+ 1) /* Intel Virtual NMI */ -- 2.16.2