Re: arch/x86/mm/pat/memtype.c:128:39: error: use of undeclared identifier 'PG_arch_2'; did you mean 'PG_arch_1'?

From: Philip Li
Date: Fri Oct 11 2024 - 19:05:03 EST


On Sat, Oct 05, 2024 at 01:20:22PM +0100, Matthew Wilcox wrote:
> On Sat, Oct 05, 2024 at 06:11:14PM +0800, kernel test robot wrote:
> > commit: 7a87225ae2c6c317c7b80cf599e5cf0eee699196 x86: remove PG_uncached
> > date: 4 weeks ago
> > config: x86_64-randconfig-003-20241002 (https://download.01.org/0day-ci/archive/20241005/202410051828.Pb7a79Gu-lkp@xxxxxxxxx/config)
>
> Hum, works for me with both gcc and clang-17, but that shouldn't make a
> difference here. The config has ARCH_USES_PG_ARCH_2 selected.

Sorry for this false report, it can't be reproduced. We will look into
this to resolve the issue in the bot.

>
> > compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241005/202410051828.Pb7a79Gu-lkp@xxxxxxxxx/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202410051828.Pb7a79Gu-lkp@xxxxxxxxx/
> >
> > All errors (new ones prefixed by >>):
> >
> > >> arch/x86/mm/pat/memtype.c:128:39: error: use of undeclared identifier 'PG_arch_2'; did you mean 'PG_arch_1'?
> > 128 | unsigned long pg_flags = pg->flags & _PGMT_MASK;
> > | ^
> > arch/x86/mm/pat/memtype.c:123:29: note: expanded from macro '_PGMT_MASK'
> > 123 | #define _PGMT_MASK (1UL << PG_arch_2 | 1UL << PG_arch_1)
> > | ^
> > include/linux/page-flags.h:106:2: note: 'PG_arch_1' declared here
> > 106 | PG_arch_1,
> > | ^
> > arch/x86/mm/pat/memtype.c:134:23: error: use of undeclared identifier 'PG_arch_2'; did you mean 'PG_arch_1'?
> > 134 | else if (pg_flags == _PGMT_UC_MINUS)
> > | ^
> > arch/x86/mm/pat/memtype.c:121:33: note: expanded from macro '_PGMT_UC_MINUS'
> > 121 | #define _PGMT_UC_MINUS (1UL << PG_arch_2)
> > | ^
> > include/linux/page-flags.h:106:2: note: 'PG_arch_1' declared here
> > 106 | PG_arch_1,
> > | ^
> > arch/x86/mm/pat/memtype.c:152:19: error: use of undeclared identifier 'PG_arch_2'; did you mean 'PG_arch_1'?
> > 152 | memtype_flags = _PGMT_UC_MINUS;
> > | ^
> > arch/x86/mm/pat/memtype.c:121:33: note: expanded from macro '_PGMT_UC_MINUS'
> > 121 | #define _PGMT_UC_MINUS (1UL << PG_arch_2)
> > | ^
> > include/linux/page-flags.h:106:2: note: 'PG_arch_1' declared here
> > 106 | PG_arch_1,
> > | ^
> > arch/x86/mm/pat/memtype.c:155:19: error: use of undeclared identifier 'PG_arch_2'; did you mean 'PG_arch_1'?
> > 155 | memtype_flags = _PGMT_WT;
> > | ^
> > arch/x86/mm/pat/memtype.c:122:27: note: expanded from macro '_PGMT_WT'
> > 122 | #define _PGMT_WT (1UL << PG_arch_2 | 1UL << PG_arch_1)
> > | ^
> > include/linux/page-flags.h:106:2: note: 'PG_arch_1' declared here
> > 106 | PG_arch_1,
> > | ^
> > arch/x86/mm/pat/memtype.c:165:28: error: use of undeclared identifier 'PG_arch_2'; did you mean 'PG_arch_1'?
> > 165 | new_flags = (old_flags & _PGMT_CLEAR_MASK) | memtype_flags;
> > | ^
> > arch/x86/mm/pat/memtype.c:124:28: note: expanded from macro '_PGMT_CLEAR_MASK'
> > 124 | #define _PGMT_CLEAR_MASK (~_PGMT_MASK)
> > | ^
> > arch/x86/mm/pat/memtype.c:123:29: note: expanded from macro '_PGMT_MASK'
> > 123 | #define _PGMT_MASK (1UL << PG_arch_2 | 1UL << PG_arch_1)
> > | ^
> > include/linux/page-flags.h:106:2: note: 'PG_arch_1' declared here
> > 106 | PG_arch_1,
> > | ^
> > 5 errors generated.
> >
> >
> > vim +128 arch/x86/mm/pat/memtype.c
> >
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 125
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 126 static inline enum page_cache_mode get_page_memtype(struct page *pg)
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 127 {
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 @128 unsigned long pg_flags = pg->flags & _PGMT_MASK;
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 129
> > 35a5a10411d87e arch/x86/mm/pat.c Toshi Kani 2015-06-04 130 if (pg_flags == _PGMT_WB)
> > 35a5a10411d87e arch/x86/mm/pat.c Toshi Kani 2015-06-04 131 return _PAGE_CACHE_MODE_WB;
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 132 else if (pg_flags == _PGMT_WC)
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 133 return _PAGE_CACHE_MODE_WC;
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 134 else if (pg_flags == _PGMT_UC_MINUS)
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 135 return _PAGE_CACHE_MODE_UC_MINUS;
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 136 else
> > 35a5a10411d87e arch/x86/mm/pat.c Toshi Kani 2015-06-04 137 return _PAGE_CACHE_MODE_WT;
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 138 }
> > 0dbcae884779fd arch/x86/mm/pat.c Thomas Gleixner 2014-11-16 139
> >
> > :::::: The code at line 128 was first introduced by commit
> > :::::: 0dbcae884779fdf7e2239a97ac7488877f0693d9 x86: mm: Move PAT only functions to mm/pat.c
> >
> > :::::: TO: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > :::::: CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
>