Received: by 10.223.185.116 with SMTP id b49csp3212724wrg; Mon, 5 Mar 2018 16:40:48 -0800 (PST) X-Google-Smtp-Source: AG47ELtfIdaM40Y3jqudMqr7RthIAYXE4Shwe3bvVOnE4YmnG5Vjqzhrc+ZS9UdOVEDeBOAOWNMO X-Received: by 2002:a17:902:7445:: with SMTP id e5-v6mr14782621plt.204.1520296848661; Mon, 05 Mar 2018 16:40:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520296848; cv=none; d=google.com; s=arc-20160816; b=Wle3F8VA6JtkOk+eXSiLZg+MJKLruqcvtJA/zP6nsaLPJjIR4WfyvY8QQsJMfjrn26 K3YHqMBQY5gkj8dGJxS3sZbH7ecTN6ISQgXSjMA5oal75yc5qRrBF5k5Wo9yqHU35SpC Ey0Cu5DnV6k6fjeY7IQmgBMkPOq97nUYfoRQLcMmQRZmGHMyeREwJ8lRc8InyJuve5Mb FWonRddnleg+im8goGAUkw2G7BSSXoqn3O5yyRf/VOfejK/dvTjI+zPr2N2z7gmmrlVW amajbtm1/Zgpv5GsUidT37BNYQvv/ItnCftGx9zQxq81Ly36niAJE1FuUik0qcOLwTVi PhLQ== 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=mU51MuW1ll1fZko7UYoFvY0CElTeAURomXpb4XjeBtw=; b=OhCizzDw4SoXXmZ022zmYcF3j+ZKfmZ3hFdU6fUhlF1GoqPlRRwhjLgj+HJekQ8CMb nvRyyMwY97ww9ERyufYFfuIunvSI0VojswkwLegi2cs4ezVx4R2FdkW7lDhWHKqhDZb6 UkKzI2+jV9/Ir4qZubjUsA4CE1LR/owGij3xAR0j2qIJ4G+QHckSVc0lVnEYXcUQiUoE 3jXwNjGYNPOQDfsqYrDHbncAAHIPkiUagNrgOwAOc0b+0RYEqrzsQ3qZ2W7n7IL0NPOK a0yEgKq/DWJWb9Ipl4vV0B+1JhCAtVf0zTD1ntXZfHW0fUss6/woV5SxOqrg5k52CxU2 of1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=oTFTJD1a; 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 b8si1859145pgt.710.2018.03.05.16.40.34; Mon, 05 Mar 2018 16:40:48 -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=oTFTJD1a; 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 S933265AbeCFAiv (ORCPT + 99 others); Mon, 5 Mar 2018 19:38:51 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:34852 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932961AbeCFA0T (ORCPT ); Mon, 5 Mar 2018 19:26:19 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w260MSX2115535; Tue, 6 Mar 2018 00:26:15 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=mU51MuW1ll1fZko7UYoFvY0CElTeAURomXpb4XjeBtw=; b=oTFTJD1aC2dXkkf+iVvDIo95hxebRwRXAVOWYHeWY+dYVP5BHeYF4BmcpDXdKT5U/b7K UtM7PdZg6m7duCK0PPssnDQu0VoKWM5/RkzGB/oNuXx4GNxu4ip7bKbh6Xw+tedbZ9fu NpeC8kKJATIF4X1xkbp8LdRndfVHmXU5uV3HxzX28z3vj7KubZNUmc6f615ESYj8ekN1 VW7P+FejkYof7Z0tg5+ONb5lYgRP9tGgjpenfZpq+3Ywk03GyguaP0DDXD1i6cpjUBCe GnAcK0rNqNlL82tJXn7CCNogVDa5bq1xERBusOuEaEjQOeLYRvuSQga+O1SbIEFr/kTA iw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2ghdxf8k4q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 00:26:15 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w260QEhN025020 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 00:26:14 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 w260QEL5000306; Tue, 6 Mar 2018 00:26:14 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Mar 2018 16:26:13 -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 18/65] x86/mm: Disable PCID on 32-bit kernels Date: Mon, 5 Mar 2018 19:24:51 -0500 Message-Id: <20180306002538.1761-19-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: Andy Lutomirski commit cba4671af7550e008f7a7835f06df0763825bf3e upstream. 32-bit kernels on new hardware will see PCID in CPUID, but PCID can only be used in 64-bit mode. Rather than making all PCID code conditional, just disable the feature on 32-bit builds. Signed-off-by: Andy Lutomirski Reviewed-by: Nadav Amit Reviewed-by: Borislav Petkov Reviewed-by: Thomas Gleixner Cc: Andrew Morton Cc: Arjan van de Ven Cc: Borislav Petkov Cc: Dave Hansen Cc: Linus Torvalds Cc: Mel Gorman Cc: Peter Zijlstra Cc: Rik van Riel Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/2e391769192a4d31b808410c383c6bf0734bc6ea.1498751203.git.luto@kernel.org Signed-off-by: Ingo Molnar Cc: Hugh Dickins Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 78043e5b6fb2921d836b31f23e89e52925191153) Signed-off-by: Pavel Tatashin --- arch/x86/include/asm/disabled-features.h | 4 +++- arch/x86/kernel/cpu/bugs.c | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h index f226df064660..8b17c2ad1048 100644 --- a/arch/x86/include/asm/disabled-features.h +++ b/arch/x86/include/asm/disabled-features.h @@ -21,11 +21,13 @@ # define DISABLE_K6_MTRR (1<<(X86_FEATURE_K6_MTRR & 31)) # define DISABLE_CYRIX_ARR (1<<(X86_FEATURE_CYRIX_ARR & 31)) # define DISABLE_CENTAUR_MCR (1<<(X86_FEATURE_CENTAUR_MCR & 31)) +# define DISABLE_PCID 0 #else # define DISABLE_VME 0 # define DISABLE_K6_MTRR 0 # define DISABLE_CYRIX_ARR 0 # define DISABLE_CENTAUR_MCR 0 +# define DISABLE_PCID (1<<(X86_FEATURE_PCID & 31)) #endif /* CONFIG_X86_64 */ /* @@ -35,7 +37,7 @@ #define DISABLED_MASK1 0 #define DISABLED_MASK2 0 #define DISABLED_MASK3 (DISABLE_CYRIX_ARR|DISABLE_CENTAUR_MCR|DISABLE_K6_MTRR) -#define DISABLED_MASK4 0 +#define DISABLED_MASK4 (DISABLE_PCID) #define DISABLED_MASK5 0 #define DISABLED_MASK6 0 #define DISABLED_MASK7 0 diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 03445346ee0a..4c7dd836304a 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -65,6 +65,14 @@ static void __init check_fpu(void) void __init check_bugs(void) { +#ifdef CONFIG_X86_32 + /* + * Regardless of whether PCID is enumerated, the SDM says + * that it can't be enabled in 32-bit mode. + */ + setup_clear_cpu_cap(X86_FEATURE_PCID); +#endif + identify_boot_cpu(); #ifndef CONFIG_SMP pr_info("CPU: "); -- 2.16.2