Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp619250img; Fri, 22 Mar 2019 05:17:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYZW+5iFdNj0zSl6sA58OfWx/PKLZAxpNU2850diL7wNPUCwxkRJUpD87M1IpDGNiF26Ml X-Received: by 2002:a62:1c4:: with SMTP id 187mr8820502pfb.256.1553257025666; Fri, 22 Mar 2019 05:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553257025; cv=none; d=google.com; s=arc-20160816; b=AMjr1bFVXvaLFTU/sUJBXAr/V4hjft9aZedrVkF/zzFeYFiWDtvV4FemHdzuiAbo6V I8/BWyM0bvmDXuLe9TroWVgDJFwcfmhMhoWEEk68Vv8n89N2Z9hnAICoYKO2snvzbIks vG7fI2RJ3XEDnvR4zdY3bm4Wqc07q1HNGtl047FfjP0eY1WigdtwYumehH/pnep1+Mb2 whK9m8XUxWs699RsmYs3ufaTwy7tN6NHO+T5pwXpZtuIl9rkDLAytimfEEwiTkV+4slV 1qwM3ayU+ldhNiMz9LWGdz2bKd5WDDO819Uj45UduF7srm7nnLz5+4qlV/GQJEUVjE8e eBFQ== 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=ACmcn2RGtzK6Kl7bZCG8h4toXEZ1KwF2ChoQnTTmV50=; b=ZsciycmpYfvJG5qcEnK/RFA2LCYa4udYbbKDcSD9vs7dqiM5MU3uIjD1WpNJVYwYIF YBHK7jKyQx+uGfQ1ZTT8eP9oL1G9JXzoeyZajpmMeNUvQY3vR0hjkUU2uUyA7nue39zB napWrEuiegdjTN606XJJTY5ZH9MRSvsgNiLSFMQp5w8rYr14ixffu2d9n0fbsqgnM0ac UOTXTGzfUmEbH4Ve989fJ1R1nTKKeRD9gfrEU5q5AkYnRWOVQpZ+DrTV46BPoz/sJWpj ryJ2qUPb2SCT6GjKWWyDsoiF1GewlU7CJJs273rRg2cyHZkyr0QDv06VHjRhiH/zmOxM uE6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Wz5q16h5; 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 m22si6463140pgv.562.2019.03.22.05.16.50; Fri, 22 Mar 2019 05:17:05 -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=Wz5q16h5; 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 S2390164AbfCVMQH (ORCPT + 99 others); Fri, 22 Mar 2019 08:16:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:54716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390156AbfCVMQG (ORCPT ); Fri, 22 Mar 2019 08:16:06 -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 80B312082C; Fri, 22 Mar 2019 12:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553256966; bh=8szNcTeJio2r3SL2amIAoDQyQc3tXk/7XlnW1hKmTDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wz5q16h5f6/NBXeLc7mPH4srL1ZvNL1JMg5xbR0FJjEs4VSnV1DF0e8dofhhfNaCB X8WO/MnzADRQTNG89NZSYsqVe8HrZIoKsolEiHVwmkSYjXKBfisSOy/VzlJIyW3VXI v73C9+kbP6Ly3UvVgvUtAngocTqwad+1fm8esOuA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Jan Beulich Subject: [PATCH 5.0 060/238] xen: fix dom0 boot on huge systems Date: Fri, 22 Mar 2019 12:14:39 +0100 Message-Id: <20190322111302.090966053@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111258.383569278@linuxfoundation.org> References: <20190322111258.383569278@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 5.0-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 @@ -2114,10 +2114,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; @@ -2125,8 +2125,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; @@ -2134,7 +2133,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;