Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4825630imb; Thu, 7 Mar 2019 01:12:00 -0800 (PST) X-Google-Smtp-Source: APXvYqzmJzHaLE//cJBTSU1KXRy9jnKrrTTlsM4DUx3ea96PSwtBtOtV6wlHf5q4LmR64t+NEvnu X-Received: by 2002:a63:f648:: with SMTP id u8mr10231489pgj.91.1551949920198; Thu, 07 Mar 2019 01:12:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551949920; cv=none; d=google.com; s=arc-20160816; b=sYbl14G/9y1F85iE5zAvqKXpm1cj8aXwprZHqUc0Wb4tyIOg+XhlScC8Lw9bwQHrWf HthDpdWJZRX3ukrO7AO9kfjfNFtN75XxsRvBxMNWxz3MRC+CPm6j8tSkW4PzSGDR2eqb mr2i0d1wTQKdQLsi6pgdVLYV3X5VPsYVwE/607j7MiENaIp+i7cBm3+IdoLxElgwHj3V vl1X0KAKho48y+LwOWZKTZP/2ggi59PhrKYlv1H6u5IyhgJ6OaRE2geEQdSolDV0jDJo eWChOA6QZEZ9n4/qyPIprC9iRT2nAaE3PwJ+ZKPVxSIe5bMuqfHX8iwO4PpgkCO4Bpn0 cNHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=yZapANaQV6hQOlslwf2xg6U7a3TEUuVRqAIOycL/L6c=; b=y2Iv5ZLNxA1YsOxWkNAk45Bns/4t4ztXMa/4NmXX2O0+zAciP+ncFhGv5mScK8MpTe 0kgwEVZjDPfd9Qffd9GccpIXYbi1ZjmrsyNSfgEzk5nWv3zQGGMjs8QDPa9A0STFjVte qOTPcTcCKmZuULWmwd8s068DLyEJLyYznIfogn1TgJ5Nbysdff3mIcXp2NI+NtCed7FD skfhNl6Eu+JgfJmFoKi7A9wHMhed7UqkM+lbdPL5zDdbDwnCIFX5p/LvXGM/7bJcEYI4 oSlKrJPSlH3+qIQ1r8jEMG1LqQSsTJwqtuccv4ZxdIrY7+XBVZGHJCaHJ70TzRcbX/fQ Y/Ww== ARC-Authentication-Results: i=1; mx.google.com; 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 25si3529588pgz.309.2019.03.07.01.11.44; Thu, 07 Mar 2019 01:12:00 -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; 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 S1726159AbfCGJLY (ORCPT + 99 others); Thu, 7 Mar 2019 04:11:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:44550 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725795AbfCGJLY (ORCPT ); Thu, 7 Mar 2019 04:11:24 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6CFA5B67F; Thu, 7 Mar 2019 09:11:22 +0000 (UTC) From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org Cc: boris.ostrovsky@oracle.com, sstabellini@kernel.org, hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, Juergen Gross Subject: [PATCH] xen: fix dom0 boot on huge systems Date: Thu, 7 Mar 2019 10:11:19 +0100 Message-Id: <20190307091119.6700-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") Signed-off-by: Juergen Gross --- arch/x86/xen/mmu_pv.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index 0f4fe206dcc2..20701977e6c0 100644 --- 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; -- 2.16.4