From 4fcd42a9583f4bad4baa66a28b82dd5ea80947c6 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 11 Sep 2026 08:52:40 +0200 Subject: [PATCH] x86/mm: pagetable_dying() is HVM+SHADOW_PAGING only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The referenced commit didn't go far enough, leaving a Misra rule 2.1 (unreachable code) violation: The function lacks "noreturn" in this configuration. Since with SHADOW_PAGING=n paging_mode_shadow() is compile- time-constant false, the compiler can DCE the call site. Hence we can avoid building the function itself altogether. No functional change. Fixes: 2fb2dee1ac62 ("x86/mm: pagetable_dying() is HVM-only") Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- xen/arch/x86/mm/paging.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index 14ab7defd8..4bb8d169de 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -872,22 +872,18 @@ int paging_enable(struct domain *d, u32 mode) } #endif -#ifdef CONFIG_HVM +#if defined(CONFIG_HVM) && defined(CONFIG_SHADOW_PAGING) /* Called from the guest to indicate that a process is being torn down * and therefore its pagetables will soon be discarded */ void pagetable_dying(paddr_t gpa) { -#ifdef CONFIG_SHADOW_PAGING struct vcpu *curr = current; ASSERT(paging_mode_shadow(curr->domain)); curr->arch.paging.mode->shadow.pagetable_dying(gpa); -#else - BUG(); -#endif } -#endif /* CONFIG_HVM */ +#endif /* HVM && SHADOW_PAGING */ /* Print paging-assistance info to the console */ void paging_dump_domain_info(struct domain *d)