On Fri, Aug 29, 2025, Aqib Faruqui wrote: > Prevent PAGE_SIZE redefinition warnings that can occur due to namespace > pollution from included headers. > > Add an #ifndef directive before defining PAGE_SIZE to avoid redefinition > conflicts.
Please provide more details on what is causing the conflicts. Blindly using a PAGE_SIZE without _knowing_ it's aligned with PAGE_SHIFT and PHYSICAL_PAGE_MASK is far from ideal. > Signed-off-by: Aqib Faruqui <aqi...@amazon.com> > --- > tools/testing/selftests/kvm/include/x86/processor.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/testing/selftests/kvm/include/x86/processor.h > b/tools/testing/selftests/kvm/include/x86/processor.h > index 2efb05c2f..3f93d1b4f 100644 > --- a/tools/testing/selftests/kvm/include/x86/processor.h > +++ b/tools/testing/selftests/kvm/include/x86/processor.h > @@ -368,7 +368,9 @@ static inline unsigned int x86_model(unsigned int eax) > #define PHYSICAL_PAGE_MASK GENMASK_ULL(51, 12) > > #define PAGE_SHIFT 12 > +#ifndef PAGE_SIZE > #define PAGE_SIZE (1ULL << PAGE_SHIFT) > +#endif > #define PAGE_MASK (~(PAGE_SIZE-1) & PHYSICAL_PAGE_MASK) > > #define HUGEPAGE_SHIFT(x) (PAGE_SHIFT + (((x) - 1) * 9)) > -- > 2.47.3 >