arch/x86/kvm/mmu/mmu.c:686:18: sparse: sparse: cast to non-scalar

From: kernel test robot
Date: Thu Jul 23 2020 - 22:09:18 EST


Hi Paolo,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d15be546031cf65a0fc34879beca02fd90fe7ac7
commit: c50d8ae3a1274f32c9033bbb0e1c5b3115da2112 KVM: x86: create mmu/ subdirectory
date: 8 months ago
config: i386-randconfig-s002-20200724 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-93-g4c6cbe55-dirty
git checkout c50d8ae3a1274f32c9033bbb0e1c5b3115da2112
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386

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


sparse warnings: (new ones prefixed by >>)

>> arch/x86/kvm/mmu/mmu.c:686:18: sparse: sparse: cast to non-scalar
arch/x86/kvm/mmu/mmu.c:705:18: sparse: sparse: cast to non-scalar
arch/x86/kvm/mmu/mmu.c:724:18: sparse: sparse: cast to non-scalar
arch/x86/kvm/mmu/mmu.c:4759:57: sparse: sparse: cast truncates bits from constant value (ffffff33 becomes 33)
arch/x86/kvm/mmu/mmu.c:4761:56: sparse: sparse: cast truncates bits from constant value (ffffff0f becomes f)
arch/x86/kvm/mmu/mmu.c:4763:57: sparse: sparse: cast truncates bits from constant value (ffffff55 becomes 55)

vim +686 arch/x86/kvm/mmu/mmu.c

c2a2ac2b563ccc3 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 680
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 681 static void __set_spte(u64 *sptep, u64 spte)
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 682 {
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 683 union split_spte *ssptep, sspte;
a9221dd5ec125fb arch/x86/kvm/mmu.c Avi Kivity 2010-06-06 684
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 685 ssptep = (union split_spte *)sptep;
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 @686 sspte = (union split_spte)spte;
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 687
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 688 ssptep->spte_high = sspte.spte_high;
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 689
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 690 /*
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 691 * If we map the spte from nonpresent to present, We should store
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 692 * the high bits firstly, then set present bit, so cpu can not
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 693 * fetch this spte while we are setting the spte.
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 694 */
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 695 smp_wmb();
603e0651cfc8562 arch/x86/kvm/mmu.c Xiao Guangrong 2011-07-12 696
b19ee2ff3b287fe arch/x86/kvm/mmu.c Nadav Amit 2016-05-11 697 WRITE_ONCE(ssptep->spte_low, sspte.spte_low);
a9221dd5ec125fb arch/x86/kvm/mmu.c Avi Kivity 2010-06-06 698 }
a9221dd5ec125fb arch/x86/kvm/mmu.c Avi Kivity 2010-06-06 699

:::::: The code at line 686 was first introduced by commit
:::::: 603e0651cfc8562b103454d7ded71f3ad1eb3a37 KVM: MMU: do not need atomicly to set/clear spte

:::::: TO: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxx>
:::::: CC: Avi Kivity <avi@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip