[intel-tdx:kvm-upstream-workaround 155/162] arch/x86/kvm/mmu/tdp_mmu.c:774:32: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first

From: kernel test robot
Date: Tue Jan 25 2022 - 03:46:29 EST


tree: https://github.com/intel/tdx.git kvm-upstream-workaround
head: 9ba9d8e36b0fa25f5f20109a0ae61619a421f550
commit: 6d8632a26d7060510bfe4fbb3011c2d6e2d2f079 [155/162] KVM, x86/tdp_mmu: optimize remote tlb flush
config: x86_64-randconfig-a015-20220124 (https://download.01.org/0day-ci/archive/20220125/202201251603.34lAUK9o-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 997e128e2a78f5a5434fc75997441ae1ee76f8a4)
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
# https://github.com/intel/tdx/commit/6d8632a26d7060510bfe4fbb3011c2d6e2d2f079
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx kvm-upstream-workaround
git checkout 6d8632a26d7060510bfe4fbb3011c2d6e2d2f079
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/kvm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> arch/x86/kvm/mmu/tdp_mmu.c:774:32: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first [-Wbitwise-conditional-parentheses]
is_large_pte(iter->old_spte) ? PT_PAGE_SIZE_MASK : 0;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
arch/x86/kvm/mmu/tdp_mmu.c:774:32: note: place parentheses around the '|' expression to silence this warning
is_large_pte(iter->old_spte) ? PT_PAGE_SIZE_MASK : 0;
^
)
arch/x86/kvm/mmu/tdp_mmu.c:774:32: note: place parentheses around the '?:' expression to evaluate it first
is_large_pte(iter->old_spte) ? PT_PAGE_SIZE_MASK : 0;
^
( )
1 warning generated.


vim +774 arch/x86/kvm/mmu/tdp_mmu.c

745
746 #define tdp_root_for_each_pte(_iter, _root, _start, _end) \
747 for_each_tdp_pte(_iter, _root->spt, _root->role.level, _start, _end)
748
749 /*
750 * Note temporarily blocked private SPTE is consider as valid leaf,
751 * although !is_shadow_present_pte() returns true for it, since the
752 * target page (which the mapping maps to ) is still there.
753 */
754 #define tdp_root_for_each_leaf_pte(_iter, _root, _start, _end) \
755 tdp_root_for_each_pte(_iter, _root, _start, _end) \
756 if ((!is_shadow_present_pte(_iter.old_spte) && \
757 !is_zapped_private_pte(_iter.old_spte)) || \
758 !is_last_spte(_iter.old_spte, _iter.level)) \
759 continue; \
760 else
761
762 #define tdp_mmu_for_each_pte(_iter, _mmu, _private, _start, _end) \
763 for_each_tdp_pte(_iter, \
764 __va((_private) ? _mmu->private_root_hpa : _mmu->root_hpa), \
765 _mmu->shadow_root_level, _start, _end)
766
767 static u64 zapped_private_spte(struct kvm *kvm, const struct tdp_iter *iter)
768 {
769 if (!kvm_gfn_stolen_mask(kvm))
770 return shadow_init_value;
771
772 return shadow_init_value | SPTE_PRIVATE_ZAPPED |
773 (spte_to_pfn(iter->old_spte) << PAGE_SHIFT) |
> 774 is_large_pte(iter->old_spte) ? PT_PAGE_SIZE_MASK : 0;
775 }
776

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx