Messages in this thread | | | From | Ben Gardon <> | Date | Mon, 1 Mar 2021 09:22:15 -0800 | Subject | Re: arch/x86/kvm/mmu/tdp_mmu.c:533:9: sparse: sparse: cast removes address space '__rcu' of expression |
| |
It looks like the __rcu tags aren't being propagated around to all the different references to PT memory. I'll look into what it would take to fix this. I don't believe these kernel test warnings indicate a correctness issue in the kernel, but propagating the __rcu annotations will be helpful for developers in the future.
On Sat, Feb 27, 2021 at 3:48 PM kernel test robot <lkp@intel.com> wrote: > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > head: 5695e51619745d4fe3ec2506a2f0cd982c5e27a4 > commit: 08f07c800e9d35b59d0c8346333f189160bd67d4 KVM: x86/mmu: Flush TLBs after zap in TDP MMU PF handler > date: 3 weeks ago > config: x86_64-randconfig-s022-20210228 (attached as .config) > compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 > reproduce: > # apt-get install sparse > # sparse version: v0.6.3-241-geaceeafa-dirty > # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=08f07c800e9d35b59d0c8346333f189160bd67d4 > git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > git fetch --no-tags linus master > git checkout 08f07c800e9d35b59d0c8346333f189160bd67d4 > # save the attached .config to linux build tree > make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > > "sparse warnings: (new ones prefixed by >>)" > arch/x86/kvm/mmu/tdp_mmu.c:459:49: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long long [usertype] *pt @@ got unsigned long long [noderef] [usertype] __rcu * @@ > arch/x86/kvm/mmu/tdp_mmu.c:459:49: sparse: expected unsigned long long [usertype] *pt > arch/x86/kvm/mmu/tdp_mmu.c:459:49: sparse: got unsigned long long [noderef] [usertype] __rcu * > arch/x86/kvm/mmu/tdp_mmu.c:291:9: sparse: sparse: context imbalance in 'tdp_mmu_link_page' - different lock contexts for basic block > arch/x86/kvm/mmu/tdp_mmu.c:316:9: sparse: sparse: context imbalance in 'tdp_mmu_unlink_page' - different lock contexts for basic block > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long long [usertype] *root_pt @@ got unsigned long long [noderef] [usertype] __rcu * @@ > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: expected unsigned long long [usertype] *root_pt > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: got unsigned long long [noderef] [usertype] __rcu * > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned long long [usertype] *sptep @@ got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@ > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: expected unsigned long long [usertype] *sptep > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt > arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned long long [usertype] *root_pt @@ got unsigned long long [noderef] [usertype] __rcu * @@ > arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: expected unsigned long long [usertype] *root_pt > arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: got unsigned long long [noderef] [usertype] __rcu * > >> arch/x86/kvm/mmu/tdp_mmu.c:533:9: sparse: sparse: cast removes address space '__rcu' of expression > arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned long long [usertype] *root_pt @@ got unsigned long long [noderef] [usertype] __rcu * @@ > arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: expected unsigned long long [usertype] *root_pt > arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: got unsigned long long [noderef] [usertype] __rcu * > arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned long long [usertype] *root_pt @@ got unsigned long long [noderef] [usertype] __rcu * @@ > arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: expected unsigned long long [usertype] *root_pt > arch/x86/kvm/mmu/tdp_mmu.c:487:40: sparse: got unsigned long long [noderef] [usertype] __rcu * > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned long long [usertype] *sptep @@ got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@ > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: expected unsigned long long [usertype] *sptep > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned long long [usertype] *sptep @@ got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@ > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: expected unsigned long long [usertype] *sptep > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned long long [usertype] *sptep @@ got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@ > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: expected unsigned long long [usertype] *sptep > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long long [usertype] *root_pt @@ got unsigned long long [noderef] [usertype] __rcu * @@ > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: expected unsigned long long [usertype] *root_pt > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: got unsigned long long [noderef] [usertype] __rcu * > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned long long [usertype] *sptep @@ got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@ > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: expected unsigned long long [usertype] *sptep > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long long [usertype] *root_pt @@ got unsigned long long [noderef] [usertype] __rcu * @@ > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: expected unsigned long long [usertype] *root_pt > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: got unsigned long long [noderef] [usertype] __rcu * > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned long long [usertype] *sptep @@ got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@ > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: expected unsigned long long [usertype] *sptep > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned long long [usertype] *sptep @@ got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@ > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: expected unsigned long long [usertype] *sptep > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long long [usertype] *root_pt @@ got unsigned long long [noderef] [usertype] __rcu * @@ > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: expected unsigned long long [usertype] *root_pt > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: got unsigned long long [noderef] [usertype] __rcu * > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned long long [usertype] *sptep @@ got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@ > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: expected unsigned long long [usertype] *sptep > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected unsigned long long [usertype] *root_pt @@ got unsigned long long [noderef] [usertype] __rcu * @@ > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: expected unsigned long long [usertype] *root_pt > arch/x86/kvm/mmu/tdp_mmu.c:654:51: sparse: got unsigned long long [noderef] [usertype] __rcu * > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned long long [usertype] *sptep @@ got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@ > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: expected unsigned long long [usertype] *sptep > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected unsigned long long [usertype] *sptep @@ got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt @@ > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: expected unsigned long long [usertype] *sptep > arch/x86/kvm/mmu/tdp_mmu.c:560:49: sparse: got unsigned long long [noderef] [usertype] __rcu *[usertype] root_pt > > vim +/__rcu +533 arch/x86/kvm/mmu/tdp_mmu.c > > 509 > 510 static inline bool tdp_mmu_zap_spte_atomic(struct kvm *kvm, > 511 struct tdp_iter *iter) > 512 { > 513 /* > 514 * Freeze the SPTE by setting it to a special, > 515 * non-present value. This will stop other threads from > 516 * immediately installing a present entry in its place > 517 * before the TLBs are flushed. > 518 */ > 519 if (!tdp_mmu_set_spte_atomic(kvm, iter, REMOVED_SPTE)) > 520 return false; > 521 > 522 kvm_flush_remote_tlbs_with_address(kvm, iter->gfn, > 523 KVM_PAGES_PER_HPAGE(iter->level)); > 524 > 525 /* > 526 * No other thread can overwrite the removed SPTE as they > 527 * must either wait on the MMU lock or use > 528 * tdp_mmu_set_spte_atomic which will not overrite the > 529 * special removed SPTE value. No bookkeeping is needed > 530 * here since the SPTE is going from non-present > 531 * to non-present. > 532 */ > > 533 WRITE_ONCE(*iter->sptep, 0); > 534 > 535 return true; > 536 } > 537 > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
| |