Received: by 10.223.185.116 with SMTP id b49csp3211512wrg; Mon, 5 Mar 2018 16:38:54 -0800 (PST) X-Google-Smtp-Source: AG47ELvSGFcz02yioiOlsPcXrIiQikFz9G2GgrLk6psXRk4tqjVfxuINj7gFM2ixcxFGCxwLgU98 X-Received: by 10.99.105.70 with SMTP id e67mr13583568pgc.342.1520296734307; Mon, 05 Mar 2018 16:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520296734; cv=none; d=google.com; s=arc-20160816; b=PhNyF/moQ/hb1RaJGKNm9hbSRQliC78jrKSkIwM+lU4s3QlDmiMDECMafGgsDJSyzF 5cvb3rSvkpNohAi4a6k9U8By/L76mL8AxIFfqFRsMLSucKsszeDImVZb5U+0q7duG2M9 xCzKJSqEWyVioP1O7n9MedxKURQjLNjWfg5ZOUKzKZMZcRQndhyc7sGVVbx0Mp5j9v7a Rl6j1Qjl1IKc89thLnDiqqTeM51/uJdyhmUPJK0u9CoNLx+LPeR11d+4qbk4PXdVUqJQ 9qRz2Jxcfm5lVeB6IlLwIgdNZfkeVJFvUDXMfHGl4WAO6eouUzd5nN4Q+Rq5/AlYZBkN n/0g== 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=bflzpeXFpNqWHPyV3zPVoIV2aLKx8l09W8kggEjg3tU=; b=QGJHSD6L5zOJOgwknHkHKLaJq2Gm2RJbRFcvxQ1Ewcv/urr5bHMGFDHzCk7XsXIkry Nr/orUqbXfk3mb6YqZiDYbG3tmsYkUpyPWVnwXP8AxqLJhgG3fx7aMU9eHiSpdalSzoh zwnfeer+y6E9fUdmuexxuQnkZdnG15Q+wSTwNPI+OzDWZDZEgswrPlBFS+eJ2w3eAXBg G77iizmS3tw32kXFH0iZMZY8+HFmxkco0s5AMCNuAEIJxU3nsgcYOQ5juGSPPQb5ua/S I0JvIL6gRmBpND+TM366rrYVrnOjl1Uzc3SIitE9GlHrjtJBxtAlPMqpdQ2ORaaVIUfZ HeRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=idxSpNcV; 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 p10si9079682pgr.426.2018.03.05.16.38.40; Mon, 05 Mar 2018 16:38:54 -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=idxSpNcV; 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 S933155AbeCFA0Z (ORCPT + 99 others); Mon, 5 Mar 2018 19:26:25 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:34868 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933101AbeCFA0V (ORCPT ); Mon, 5 Mar 2018 19:26:21 -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 w260LlI0115094; Tue, 6 Mar 2018 00:26:17 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=bflzpeXFpNqWHPyV3zPVoIV2aLKx8l09W8kggEjg3tU=; b=idxSpNcV/QZK+mXrz7zu7njI27sIxCjf5/51WRI8XsToDxVO8GEEzwU9VwVO8CDvSVlm ETLFoJsjpJ4aX9Iod8qKDTE8HuBfrTen6JnWN5Olu+iEoVr5vtGIAyXB9VPxZd1dQIeq Nvp3prhP9c2m6HA5RY9PoNpGBldMfhcv/ZGU5Dq8r0XhlZbvzF58zwO/mmUzGVLHlmxB eMpkLb24ck1MPrnXHVCSoaUFBCgUiiS7YKfIPvbC6/u4X+HTJuwnsRXRCxYOBI58pdKc ZCinSUSe8ytQ91DhY2EJn90xKnyt52+qqYz9I8F6NPxWxW9jvWq56o6Lk+OJ42tJ7zzx 4g== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2ghdxf8k4u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 00:26:17 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w260QHKv030097 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 00:26:17 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w260QGbY022058; Tue, 6 Mar 2018 00:26:16 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Mar 2018 16:26:16 -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 21/65] x86/mm/64: Fix reboot interaction with CR4.PCIDE Date: Mon, 5 Mar 2018 19:24:54 -0500 Message-Id: <20180306002538.1761-22-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 924c6b900cfdf376b07bccfd80e62b21914f8a5a upstream. Trying to reboot via real mode fails with PCID on: long mode cannot be exited while CR4.PCIDE is set. (No, I have no idea why, but the SDM and actual CPUs are in agreement here.) The result is a GPF and a hang instead of a reboot. I didn't catch this in testing because neither my computer nor my VM reboots this way. I can trigger it with reboot=bios, though. Fixes: 660da7c9228f ("x86/mm: Enable CR4.PCIDE on supported systems") Reported-and-tested-by: Steven Rostedt (VMware) Signed-off-by: Andy Lutomirski Signed-off-by: Thomas Gleixner Cc: Borislav Petkov Link: https://lkml.kernel.org/r/f1e7d965998018450a7a70c2823873686a8b21c0.1507524746.git.luto@kernel.org Cc: Hugh Dickins Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 6c4db09c291a19da66512f99c4bcb378a862f9e6) Signed-off-by: Pavel Tatashin --- arch/x86/kernel/reboot.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 0549ae3cb332..d9ea27ec9dbd 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -93,6 +93,10 @@ void __noreturn machine_real_restart(unsigned int type) load_cr3(initial_page_table); #else write_cr3(real_mode_header->trampoline_pgd); + + /* Exiting long mode will fail if CR4.PCIDE is set. */ + if (static_cpu_has(X86_FEATURE_PCID)) + cr4_clear_bits(X86_CR4_PCIDE); #endif /* Jump to the identity-mapped low memory code */ -- 2.16.2