Re: [PATCH] x86/mm: fix _pgd_alloc() for Xen PV mode

From: Dave Hansen
Date: Thu Apr 17 2025 - 11:15:30 EST


On 4/17/25 07:48, Juergen Gross wrote:
> -#define PGD_ALLOCATION_ORDER 1
> +#define PGD_ALLOCATION_ORDER pgd_allocation_order
> +extern unsigned int pgd_allocation_order;
> #else
> #define PGD_ALLOCATION_ORDER 0
> #endif

Instead of hiding a variable behind a macro-looking name and a bunch of
#ifdefs, can we please fix this properly?

static inline pgd_allocation_order(void)
{
if (cpu_feature_enabled(X86_FEATURE_PTI))
return 1;
return 0;
}

and then s/PGD_ALLOCATION_ORDER/pgd_allocation_order()/.

Wouldn't that be a billion times better?