Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/xen: Fix Xen PV guest boot

A recent patch moving the call of sparse_init() to common mm code
broke booting as a Xen PV guest.

Reason is that the Xen PV specific boot code relied on struct page area
being accessible rather early, but this changed by the move of the call
of sparse_init().

Fortunately the fix is rather easy: there is a static branch available
indicating whether struct page contents are usable by Xen. This static
branch just needs to be tested in some places for avoiding the access
of struct page.

Fixes: 4267739cabb8 ("arch, mm: consolidate initialization of SPARSE memory model")
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20260214135035.119357-1-jgross@suse.com>

+5 -1
+5 -1
arch/x86/xen/mmu_pv.c
··· 509 509 unsigned offset = pgd - pgd_page; 510 510 pgd_t *user_ptr = NULL; 511 511 512 + if (!static_branch_likely(&xen_struct_pages_ready)) 513 + return NULL; 514 + 512 515 if (offset < pgd_index(USER_LIMIT)) { 513 516 struct page *page = virt_to_page(pgd_page); 514 517 user_ptr = (pgd_t *)page->private; ··· 1101 1098 1102 1099 if (unpin) 1103 1100 pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(pa)); 1104 - ClearPagePinned(virt_to_page(__va(pa))); 1101 + if (static_branch_likely(&xen_struct_pages_ready)) 1102 + ClearPagePinned(virt_to_page(__va(pa))); 1105 1103 xen_free_ro_pages(pa, PAGE_SIZE); 1106 1104 } 1107 1105