Message ID | 1657098456-29244-1-git-send-email-zhanghongchen@loongson.cn (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | MIPS: fix pmd_mkinvalid | expand |
Hi Hongchen,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.19-rc5 next-20220706]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Hongchen-Zhang/MIPS-fix-pmd_mkinvalid/20220706-171327
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e35e5b6f695d241ffb1d223207da58a1fbcdff4b
config: mips-maltaaprp_defconfig (https://download.01.org/0day-ci/archive/20220707/202207070340.HGbiEUlO-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project f553287b588916de09c66e3e32bf75e5060f967f)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mipsel-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/cc17741b8218515ea05dd64f5db2402a67e7a821
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Hongchen-Zhang/MIPS-fix-pmd_mkinvalid/20220706-171327
git checkout cc17741b8218515ea05dd64f5db2402a67e7a821
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
arch/mips/mm/init.c:60:6: warning: no previous prototype for function 'setup_zero_pages' [-Wmissing-prototypes]
void setup_zero_pages(void)
^
arch/mips/mm/init.c:60:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void setup_zero_pages(void)
^
static
>> arch/mips/mm/init.c:454:2: error: call to __compiletime_assert_347 declared with 'error' attribute: BUILD_BUG_ON failed: IS_ENABLED(CONFIG_32BIT) && (_PFN_SHIFT > PAGE_SHIFT)
BUILD_BUG_ON(IS_ENABLED(CONFIG_32BIT) && (_PFN_SHIFT > PAGE_SHIFT));
^
include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:354:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:342:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:335:4: note: expanded from macro '__compiletime_assert'
prefix ## suffix(); \
^
<scratch space>:174:1: note: expanded from here
__compiletime_assert_347
^
1 warning and 1 error generated.
vim +/error +454 arch/mips/mm/init.c
1132137e87898d Jiang Liu 2013-07-03 447
1132137e87898d Jiang Liu 2013-07-03 448 void __init mem_init(void)
1132137e87898d Jiang Liu 2013-07-03 449 {
05d013a0366d50 Paul Burton 2019-09-18 450 /*
05d013a0366d50 Paul Burton 2019-09-18 451 * When _PFN_SHIFT is greater than PAGE_SHIFT we won't have enough PTE
05d013a0366d50 Paul Burton 2019-09-18 452 * bits to hold a full 32b physical address on MIPS32 systems.
05d013a0366d50 Paul Burton 2019-09-18 453 */
05d013a0366d50 Paul Burton 2019-09-18 @454 BUILD_BUG_ON(IS_ENABLED(CONFIG_32BIT) && (_PFN_SHIFT > PAGE_SHIFT));
05d013a0366d50 Paul Burton 2019-09-18 455
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index 41921ac..1c5ef41 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -265,7 +265,7 @@ static inline int pmd_present(pmd_t pmd) { #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT if (unlikely(pmd_val(pmd) & _PAGE_HUGE)) - return pmd_val(pmd) & _PAGE_PRESENT; + return pmd_val(pmd) & (_PAGE_PRESENT | _PAGE_PRESENT_INVALID); #endif return pmd_val(pmd) != (unsigned long) invalid_pte_table; diff --git a/arch/mips/include/asm/pgtable-bits.h b/arch/mips/include/asm/pgtable-bits.h index 2362842..3c176a1e 100644 --- a/arch/mips/include/asm/pgtable-bits.h +++ b/arch/mips/include/asm/pgtable-bits.h @@ -49,6 +49,7 @@ enum pgtable_bits { /* Used only by software (masked out before writing EntryLo*) */ _PAGE_PRESENT_SHIFT = 24, + _PAGE_PRESENT_INVALID_SHIFT, _PAGE_WRITE_SHIFT, _PAGE_ACCESSED_SHIFT, _PAGE_MODIFIED_SHIFT, @@ -80,6 +81,7 @@ enum pgtable_bits { /* Used only by software (masked out before writing EntryLo*) */ _PAGE_PRESENT_SHIFT = _CACHE_SHIFT + 3, + _PAGE_PRESENT_INVALID_SHIFT, _PAGE_NO_READ_SHIFT, _PAGE_WRITE_SHIFT, _PAGE_ACCESSED_SHIFT, @@ -98,6 +100,7 @@ enum pgtable_bits { enum pgtable_bits { /* Used only by software (writes to EntryLo ignored) */ _PAGE_PRESENT_SHIFT, + _PAGE_PRESENT_INVALID_SHIFT, _PAGE_NO_READ_SHIFT, _PAGE_WRITE_SHIFT, _PAGE_ACCESSED_SHIFT, @@ -122,6 +125,7 @@ enum pgtable_bits { enum pgtable_bits { /* Used only by software (masked out before writing EntryLo*) */ _PAGE_PRESENT_SHIFT, + _PAGE_PRESENT_INVALID_SHIFT, #if !defined(CONFIG_CPU_HAS_RIXI) _PAGE_NO_READ_SHIFT, #endif @@ -152,6 +156,7 @@ enum pgtable_bits { /* Used only by software */ #define _PAGE_PRESENT (1 << _PAGE_PRESENT_SHIFT) +#define _PAGE_PRESENT_INVALID (1 << _PAGE_PRESENT_INVALID_SHIFT) #define _PAGE_WRITE (1 << _PAGE_WRITE_SHIFT) #define _PAGE_ACCESSED (1 << _PAGE_ACCESSED_SHIFT) #define _PAGE_MODIFIED (1 << _PAGE_MODIFIED_SHIFT) diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 374c632..cc80211 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -698,7 +698,8 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) static inline pmd_t pmd_mkinvalid(pmd_t pmd) { - pmd_val(pmd) &= ~(_PAGE_PRESENT | _PAGE_VALID | _PAGE_DIRTY); + pmd_val(pmd) |= _PAGE_PRESENT_INVALID; + pmd_val(pmd) &= ~(_PAGE_PRESENT | _PAGE_VALID); return pmd; }
When a pmd entry is invalidated by pmd_mkinvalid,pmd_present should return true. So introduce a _PAGE_PRESENT_INVALID_SHIFT bit to check if a pmd is present but invalidated by pmd_mkinvalid. Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn> --- arch/mips/include/asm/pgtable-64.h | 2 +- arch/mips/include/asm/pgtable-bits.h | 5 +++++ arch/mips/include/asm/pgtable.h | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-)