Re: [PATCH] m68k: Remove redefinitions of `PMD_SIZE`, `PMD_MASK`, etc.

From: twd2
Date: Mon Jul 26 2021 - 10:16:16 EST


On 2021/7/26 17:23, Geert Uytterhoeven wrote:
> Hi Wende,
>
> On Wed, Jul 21, 2021 at 12:44 PM Wende Tan <twd2.me@xxxxxxxxx> wrote:
>> Remove redefinitions of `PMD_SIZE`, `PMD_MASK`, `PTRS_PER_PMD`,
>> and `__PAGETABLE_PMD_FOLDED` when PGTABLE_LEVELS == 2 (i.e. SUN3 ||
>> COLDFIRE). They have already been defined in
>> `asm-generic/pgtable-nopmd.h`.
> Thanks for your patch!
>
>> See also https://lore.kernel.org/lkml/202107201907.lqC6B3dF-lkp@xxxxxxxxx/#t
> I'm a bit confused: is this a new issue introduced by the patch from
> the above thread, or is this a pre-existing issue?
> If the latter, do you know when it was introduced, and how to reproduce it?


I think this is a pre-existing issue, introduced in
commit 60e50f34b13e ("m68k: mm: use pgtable-nopXd instead of 4level-fixup") .
This commit replaced the usage of `4level-fixup.h` in `pgtable_mm.h` to
`pgtable-nop*d.h` and removed the redundent definition of `PMD_SHIFT` but
forgot to clean up other macros like `PMD_SIZE` (it should be moved into
the `#if` condition) [1].

And, GCC will not complain until two definitions of a macro with the same
name differ (as the above thread changes `1UL` to `_UL(1)`), hiding this
issue.

[1] https://github.com/torvalds/linux/commit/60e50f34b13e9e40763be12aa55f2144d8da514c#diff-9ec45948bad35c0e35d0c2d301a2a643336ff8fe2ee8ea3fff19d8f0bb948a46L34

Thanks.
Wende


>> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>> Signed-off-by: Wende Tan <twd2.me@xxxxxxxxx>
> Gr{oetje,eeting}s,
>
> Geert
>