Re: [PATCH v1 1/1] x86/mm: Check if PTRS_PER_PMD is defined before use
From: Dave Hansen
Date: Mon Feb 24 2025 - 13:00:31 EST
On 2/24/25 09:39, Andy Shevchenko wrote:
> Compiler is not happy about PTRS_PER_PMD being undefined
>
> In file included from arch/x86/kernel/head_32.S:29:
> arch/x86/include/asm/pgtable_32.h:59:5: error: "PTRS_PER_PMD" is not defined, evaluates to 0 [-Werror=undef]
> 59 | #if PTRS_PER_PMD > 1
>
> Add a check to make sure PTRS_PER_PMD is defined before use.
Hi Andy,
>From reading the "Closes:" link, it appears this is a new issue that
originates from a new compile flag. So it doesn't seem like it's worth
backporting.
Also, the _behavior_ of "#if PTRS_PER_PMD > 1" was fine, right? It
didn't cause the logic to go backwards from what was intended, does it?
This:
https://gcc.gnu.org/onlinedocs/gcc-3.0.2/cpp_4.html
says: "Identifiers that are not macros, which are all considered to be
the number zero."
Which would yield the correct behavior.
So I think this is purely a fix for new warning in new kernels. We
shouldn't need to backport this anywhere at all.