Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp610646img; Fri, 22 Mar 2019 05:07:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJlNUqKBoi20Q+9QqTQk3eOXttco76ol8HpSljOrGmci7lU7Gv7pCfQQbhgINNIS7hNxi4 X-Received: by 2002:a63:4a4d:: with SMTP id j13mr8457635pgl.16.1553256454082; Fri, 22 Mar 2019 05:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553256454; cv=none; d=google.com; s=arc-20160816; b=TgYN7BHljYTKf1AMW4LxL7iZS+KoO/fqliJenGN//uO4U4gZUdK7LTWgVNJG45pBIZ jg7zHB3uu3l8kBOTpu3sliWlFkzaK9za054YT2jg1K66/Qarg+XTKVabPwe8TOCVKPH5 au2UujHBne7m/5Pv3hFctpxblRWtfvZB4nVle0nweYX1wfOR2eApXfyxLxHZy3w3AJby w/5giGmreEshDIbo56ENMc/yw2SQ1lKvsZDKY5874yJIr3CDKSQVHQdePdcbICqrNIEX 4FBvU5ChYjfCe2XNDdPb/EeWP80gARhqqC011ONZwfel/ilIrG98Ds9DsgjKLDf1gVuV swSQ== 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=2G4OPz4vI1/TAn7IO1vNjCyHYQ/dWnwRQo8c/FEJx9E=; b=fIztkQBmQdakUe/TwkolLktBc8zTKuoL4IrF/7bO0cDHO6jo4xtGLZ8uFYTAQTyEx9 epJX+S5L7u47Zd7g6Y7U1SQ2HVBRT/3DAdvXnPJ5M+jD+MQwFXVfFt+AHdGgei7x8Utv RyzYBG94UHzdHU/HG+QmEgtfDXYN2teRJ/i7qLOGO0WPCcNSg7BP4H3XuCOJXMdujfg/ AAc1CZb1ckIH6jgX35vvDHaDZdmqDOD4rVwh+M/btVEzcZsmnb+EsiTIhMLbrttCBiL3 dGQrToOe8yVPfCoHWeMcgyr1wqDo8sI3fdYr6x2e1mKDdKche357OC2WztIN5WSQlokj XpuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a7hienFy; 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 r15si6179531pgv.389.2019.03.22.05.07.18; Fri, 22 Mar 2019 05:07:34 -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=a7hienFy; 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 S2388221AbfCVMEz (ORCPT + 99 others); Fri, 22 Mar 2019 08:04:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:43294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388723AbfCVMEw (ORCPT ); Fri, 22 Mar 2019 08:04:52 -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 4A9812192D; Fri, 22 Mar 2019 12:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553256291; bh=SVyvQgEaS2n3edZ7nZf9yc8X9rgzTjRrdjVgXqGD66k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a7hienFyIY9jGnEjZJ1YNpGLrO1VmXnrkUh8y7u3lpzNTRBv+pS+1sL/NpZ8FFw2o yGfgUSHp7TxrhDs/LnsIXoKbyV8n6ZR4+oqFxPKpwZfO7v31dUGl8YTSb2u4HWxpge wZHzMQX4GELljPLgWhR+Jkiv26Vcg/4nWxVA90uk= 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.19 143/280] xen: fix dom0 boot on huge systems Date: Fri, 22 Mar 2019 12:14:56 +0100 Message-Id: <20190322111318.730430506@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111306.356185024@linuxfoundation.org> References: <20190322111306.356185024@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.19-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 @@ -2106,10 +2106,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; @@ -2117,8 +2117,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; @@ -2126,7 +2125,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;