Received: by 10.223.185.116 with SMTP id b49csp3204020wrg; Mon, 5 Mar 2018 16:29:07 -0800 (PST) X-Google-Smtp-Source: AG47ELu9VYXhlnoHa58Ao4L+0OjCsP5IuoW/deYuwxz6QThRyOZXpArf/4rh24kGtLcB53A4rEuw X-Received: by 10.98.32.28 with SMTP id g28mr17180037pfg.182.1520296147025; Mon, 05 Mar 2018 16:29:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520296146; cv=none; d=google.com; s=arc-20160816; b=zZEajeDKI/X0KQfsT8fMOSTmOLiNpV6HOPbS5mQyHyIoAfudmnUTylXM9H0I52XQSQ v1Ixk6EojG//qHkx871CKIiB75KwBnYq7XviLaLrB2r5/tjUE1+p9MoAvwT95/MOEc5P nY6HDMTeMvUhZA0yGlTCSnIHuP7Bge1fYs1Ueq9pka8anEgTLWT/gCpL0AiEtETZBwLV n4s9leUnJpItrwzsRZWFwIZrlot8ZvLrAT3HfJyIGw7js7wD4ijjHSv7f3MM5PhtiKkv UvBQkmMmW82NgRP++81dpf3HgJhfcrzZbR7Fl37YTAg7VvrXdsWitgEE0bWYtizx8eqt 9P7w== 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=U66QPEXpCGVww41zgajJgDJZTQsz73FWdDkSbwjNl8M=; b=RM9H+y1a/gT9cctjTW5HLoEG4naDZ6ZuvikJI//MIE3+zDnEinz5qdY6sh9hKizurz 6FebjfO/W0HBbIHfIQD+Gt7lBPSUkAGLiyEJFV1vvwrCZYrcBmcsrzIWA5tj4InXVRFH xMI7YXzdHSVnhNPGLWKQTD86AM3nlXn0gXvHMA3GeDguMYHGOOTz6OV3+1X0GEjefxBJ InR/aAEaDyzoGyLHgYbJSj4PcPZtGFDrQONdQUnOmjz196O5H4H1LeKtZhN39t5IIww2 4RTGJQl5mNa6I1lBhDf+hWWg9Rj8pn3ypyDd+TstRaym7VZQs3f4T1XGUQGDsMTLEFXI UNUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=KgrR82CI; 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 w2si7249375pgm.458.2018.03.05.16.28.53; Mon, 05 Mar 2018 16:29:06 -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=KgrR82CI; 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 S933558AbeCFA1C (ORCPT + 99 others); Mon, 5 Mar 2018 19:27:02 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:35250 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933324AbeCFA06 (ORCPT ); Mon, 5 Mar 2018 19:26:58 -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 w260Qtem118169; Tue, 6 Mar 2018 00:26:55 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=U66QPEXpCGVww41zgajJgDJZTQsz73FWdDkSbwjNl8M=; b=KgrR82CIJNfuSFDNNu1/zjmV1xsCmYKqjh8Ov76o1xqtTR1jafj5ak0uc+0TLmrEu4cW VvlF9M1FzxymJfAXqoyCwyQ4wJ6s0Q/kxrsTxCQhuoYhePrj/CuhRgB3qShXGS8DmFfA OJRsfII9KCfwFbFGVgeN4OSuKJNp08kdytLGWpH0ClA+mdq1GhiAQkrpoEOt2TeVX5y9 UWjDAYS8Yl0k+MTrgAwW8KcNB9P6LcOy1KyOMRhlGpwqYcq5JPXUijmBnhRNIz+chZVh vrnfpRzhu+3VgXi77PK8bUOH9KWTYXlUtX0fn58j4VgllctWj+efL+Cpd03SorsnwJrF pQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2ghdxf8k60-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 00:26:54 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w260QqYa024551 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 00:26:53 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w260QqBQ025284; Tue, 6 Mar 2018 00:26:52 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Mar 2018 16:26:51 -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 59/65] x86/kaiser: Move feature detection up Date: Mon, 5 Mar 2018 19:25:32 -0500 Message-Id: <20180306002538.1761-60-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-1803060005 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov ... before the first use of kaiser_enabled as otherwise funky things happen: about to get started... (XEN) d0v0 Unhandled page fault fault/trap [#14, ec=0000] (XEN) Pagetable walk from ffff88022a449090: (XEN) L4[0x110] = 0000000229e0e067 0000000000001e0e (XEN) L3[0x008] = 0000000000000000 ffffffffffffffff (XEN) domain_crash_sync called from entry.S: fault at ffff82d08033fd08 entry.o#create_bounce_frame+0x135/0x14d (XEN) Domain 0 (vcpu#0) crashed on cpu#0: (XEN) ----[ Xen-4.9.1_02-3.21 x86_64 debug=n Not tainted ]---- (XEN) CPU: 0 (XEN) RIP: e033:[] (XEN) RFLAGS: 0000000000000286 EM: 1 CONTEXT: pv guest (d0v0) Signed-off-by: Borislav Petkov Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 7f79599df9c4a36130f7a4f6778b334a97632477) Signed-off-by: Pavel Tatashin Conflicts: arch/x86/kernel/setup.c --- arch/x86/include/asm/kaiser.h | 2 ++ arch/x86/kernel/setup.c | 7 +++++++ arch/x86/mm/kaiser.c | 2 -- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/kaiser.h b/arch/x86/include/asm/kaiser.h index 906150d6094e..b5e46aa683f4 100644 --- a/arch/x86/include/asm/kaiser.h +++ b/arch/x86/include/asm/kaiser.h @@ -96,8 +96,10 @@ DECLARE_PER_CPU(unsigned long, x86_cr3_pcid_user); extern char __per_cpu_user_mapped_start[], __per_cpu_user_mapped_end[]; extern int kaiser_enabled; +extern void __init kaiser_check_boottime_disable(void); #else #define kaiser_enabled 0 +static inline void __init kaiser_check_boottime_disable(void) {} #endif /* CONFIG_KAISER */ /* diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 1473a02e6ccb..1adaca0050b0 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -111,6 +111,7 @@ #include #include #include +#include /* * max_low_pfn_mapped: highest direct mapped pfn under 4GB @@ -1034,6 +1035,12 @@ void __init setup_arch(char **cmdline_p) */ init_hypervisor_platform(); + /* + * This needs to happen right after XENPV is set on xen and + * kaiser_enabled is checked below in cleanup_highmap(). + */ + kaiser_check_boottime_disable(); + x86_init.resources.probe_roms(); /* after parse_early_param, so could debug it */ diff --git a/arch/x86/mm/kaiser.c b/arch/x86/mm/kaiser.c index 9d6b7517fca5..50783ad4861d 100644 --- a/arch/x86/mm/kaiser.c +++ b/arch/x86/mm/kaiser.c @@ -306,8 +306,6 @@ void __init kaiser_init(void) { int cpu; - kaiser_check_boottime_disable(); - if (!kaiser_enabled) return; -- 2.16.2