]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
xen: fix dom0 boot on huge systems
authorJuergen Gross <jgross@suse.com>
Thu, 7 Mar 2019 09:11:19 +0000 (10:11 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1837952
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 <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/x86/xen/mmu_pv.c

index b9d921d2b153ba98cddd2101252622bfc1df697d..0903514da00185a936a5a094e3c9b10ac6142004 100644 (file)
@@ -2078,10 +2078,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;
@@ -2089,8 +2089,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;
@@ -2098,7 +2097,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;