Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp597941img; Fri, 22 Mar 2019 04:52:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwY+HTl2OVxVjaCf1urdBNFwEQSpokqhqxdDD4lKDZ8DCvp01S6+M85J/A8Jnh9msYa0V+U X-Received: by 2002:a65:6203:: with SMTP id d3mr8514482pgv.109.1553255569603; Fri, 22 Mar 2019 04:52:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553255569; cv=none; d=google.com; s=arc-20160816; b=mpWDw5i45dx3VDg91VOqRWitDfpplOnSX+MJS6+iGrqFMF6kRBrLryUyzF41Lj6EHa 6i0WAJcqr8q8SXBTLfTZOAMfjm4Ozls7ZjxcROdThGUz2SOprbgPLsWrW13Qs0XJUARm 0YThPcaQdCYrtQ7KbK+ubfCqWJTwD6TZxCXj4QRrDhbo8pUScYEAgAgY5+SCONPQ/41v vR+TfQPpvEatis8b/hSwWF8P7bVl5agB0+t/rwR4vJtPwfnJYHPpROenAAYiTLiixDe7 s2Ms3m5TKHqHikiroTRLhWp3LmeoaHhGZOF7MoSl7wGn698P6hA0kRCHKUvwU//+Twvi M/eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+bfMPvTmgQZGI4p/uzgrvTeg6OUPWxXFFOCSJAUax+A=; b=CpkcU81BiF1Urd/AoW1ggIxbqed9wDy4AgyvW8quIAv5C4Xs9C0mh9mJORi76xwCR8 btdy8KhOTs6A3ufiKk4tFujXgmKT+6CG29/jtWQVCdFrktPLs2GpdPWa0ZBRCibS0S2y UUZep7myk8uyE66+RQqi34VwzVlzwHQ45YPGHohzdaPORtCplHekuYyfv+AL0j5mgcbX MTVpXIAMBHVLUdkssVHmJC6ACbqR00/JStlPPnBRn81yyYZ2xBx1C09tpKDzRztPMg9i bEH64RscWVYPJNHtDvgAD9YxHDu7uY4VOgoeEjkVcFXmCp3IEgUXMHf7DaoeB1Aq6ViR pfbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I39N5yk6; 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 75si6438876pgb.230.2019.03.22.04.52.32; Fri, 22 Mar 2019 04:52:49 -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; dkim=pass header.i=@kernel.org header.s=default header.b=I39N5yk6; 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 S1729563AbfCVLuS (ORCPT + 99 others); Fri, 22 Mar 2019 07:50:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:53984 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732367AbfCVLuM (ORCPT ); Fri, 22 Mar 2019 07:50:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5A7FB21934; Fri, 22 Mar 2019 11:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553255411; bh=KGAOO2H1XnXUTiWsNMLxZxzA55guJYY5sxe1fEtn5pQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I39N5yk6WGQK/mfj5FQzHbW/NOuoDSGb/pZ4hN8khnEMgtkNOydRN8/9tYcwJGXkl 0MUwxM8w43GNxjRVeCB/FohzG7n+lQLsh6+/9QQQIrI2vzUTQ4xZxcWKrzsIAVg48i a3vwI282s8KS5sOTgu1kWCmwMrnVQR1IIZQUYi3c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Jan Beulich Subject: [PATCH 4.14 083/183] xen: fix dom0 boot on huge systems Date: Fri, 22 Mar 2019 12:15:11 +0100 Message-Id: <20190322111247.746833813@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111241.819468003@linuxfoundation.org> References: <20190322111241.819468003@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Juergen Gross commit 01bd2ac2f55a1916d81dace12fa8d7ae1c79b5ea upstream. Commit f7c90c2aa40048 ("x86/xen: don't write ptes directly in 32-bit PV guests") introduced a regression for booting dom0 on huge systems with lots of RAM (in the TB range). Reason is that on those hosts the p2m list needs to be moved early in the boot process and this requires temporary page tables to be created. Said commit modified xen_set_pte_init() to use a hypercall for writing a PTE, but this requires the page table being in the direct mapped area, which is not the case for the temporary page tables used in xen_relocate_p2m(). As the page tables are completely written before being linked to the actual address space instead of set_pte() a plain write to memory can be used in xen_relocate_p2m(). Fixes: f7c90c2aa40048 ("x86/xen: don't write ptes directly in 32-bit PV guests") Cc: stable@vger.kernel.org Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- arch/x86/xen/mmu_pv.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -2080,10 +2080,10 @@ void __init xen_relocate_p2m(void) pt = early_memremap(pt_phys, PAGE_SIZE); clear_page(pt); for (idx_pte = 0; - idx_pte < min(n_pte, PTRS_PER_PTE); - idx_pte++) { - set_pte(pt + idx_pte, - pfn_pte(p2m_pfn, PAGE_KERNEL)); + idx_pte < min(n_pte, PTRS_PER_PTE); + idx_pte++) { + pt[idx_pte] = pfn_pte(p2m_pfn, + PAGE_KERNEL); p2m_pfn++; } n_pte -= PTRS_PER_PTE; @@ -2091,8 +2091,7 @@ void __init xen_relocate_p2m(void) make_lowmem_page_readonly(__va(pt_phys)); pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, PFN_DOWN(pt_phys)); - set_pmd(pmd + idx_pt, - __pmd(_PAGE_TABLE | pt_phys)); + pmd[idx_pt] = __pmd(_PAGE_TABLE | pt_phys); pt_phys += PAGE_SIZE; } n_pt -= PTRS_PER_PMD; @@ -2100,7 +2099,7 @@ void __init xen_relocate_p2m(void) make_lowmem_page_readonly(__va(pmd_phys)); pin_pagetable_pfn(MMUEXT_PIN_L2_TABLE, PFN_DOWN(pmd_phys)); - set_pud(pud + idx_pmd, __pud(_PAGE_TABLE | pmd_phys)); + pud[idx_pmd] = __pud(_PAGE_TABLE | pmd_phys); pmd_phys += PAGE_SIZE; } n_pmd -= PTRS_PER_PUD;