[kvm:kvm-coco-queue 60/109] arch/x86/kvm/mmu/tdp_mmu.c:1176:25: sparse: sparse: incorrect type in argument 1 (different address spaces)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git kvm-coco-queue
head:   d2c7662a6ea1c325a9ae878b3f1a265264bcd18b
commit: f6ab1baaf315a860e46baf9f7b1a5bf3db99f9ec [60/109] KVM: x86/tdp_mmu: Support mirror root for TDP MMU
config: x86_64-randconfig-121-20241011 (https://download.01.org/0day-ci/archive/20241012/202410120851.DMfCaszW-lkp@xxxxxxxxx/config)
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/20241012/202410120851.DMfCaszW-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/202410120851.DMfCaszW-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> arch/x86/kvm/mmu/tdp_mmu.c:1176:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long [usertype] *sptep @@     got unsigned long long [noderef] [usertype] __rcu *[addressable] [usertype] sptep @@
   arch/x86/kvm/mmu/tdp_mmu.c:1176:25: sparse:     expected unsigned long long [usertype] *sptep
   arch/x86/kvm/mmu/tdp_mmu.c:1176:25: sparse:     got unsigned long long [noderef] [usertype] __rcu *[addressable] [usertype] sptep
   arch/x86/kvm/mmu/tdp_mmu.c: note: in included file (through include/linux/rbtree.h, include/linux/mm_types.h, include/linux/mmzone.h, ...):
   include/linux/rcupdate.h:869:25: sparse: sparse: context imbalance in '__tdp_mmu_zap_root' - unexpected unlock
   arch/x86/kvm/mmu/tdp_mmu.c:1459:33: sparse: sparse: context imbalance in 'tdp_mmu_split_huge_pages_root' - unexpected unlock

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

  1120	
  1121	static int tdp_mmu_split_huge_page(struct kvm *kvm, struct tdp_iter *iter,
  1122					   struct kvm_mmu_page *sp, bool shared);
  1123	
  1124	/*
  1125	 * Handle a TDP page fault (NPT/EPT violation/misconfiguration) by installing
  1126	 * page tables and SPTEs to translate the faulting guest physical address.
  1127	 */
  1128	int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
  1129	{
  1130		struct kvm_mmu_page *root = tdp_mmu_get_root_for_fault(vcpu, fault);
  1131		struct kvm *kvm = vcpu->kvm;
  1132		struct tdp_iter iter;
  1133		struct kvm_mmu_page *sp;
  1134		int ret = RET_PF_RETRY;
  1135	
  1136		kvm_mmu_hugepage_adjust(vcpu, fault);
  1137	
  1138		trace_kvm_mmu_spte_requested(fault);
  1139	
  1140		rcu_read_lock();
  1141	
  1142		tdp_mmu_for_each_pte(iter, kvm, root, fault->gfn, fault->gfn + 1) {
  1143			int r;
  1144	
  1145			if (fault->nx_huge_page_workaround_enabled)
  1146				disallowed_hugepage_adjust(fault, iter.old_spte, iter.level);
  1147	
  1148			/*
  1149			 * If SPTE has been frozen by another thread, just give up and
  1150			 * retry, avoiding unnecessary page table allocation and free.
  1151			 */
  1152			if (is_frozen_spte(iter.old_spte))
  1153				goto retry;
  1154	
  1155			if (iter.level == fault->goal_level)
  1156				goto map_target_level;
  1157	
  1158			/* Step down into the lower level page table if it exists. */
  1159			if (is_shadow_present_pte(iter.old_spte) &&
  1160			    !is_large_pte(iter.old_spte))
  1161				continue;
  1162	
  1163			/*
  1164			 * The SPTE is either non-present or points to a huge page that
  1165			 * needs to be split.
  1166			 */
  1167			sp = tdp_mmu_alloc_sp(vcpu);
  1168			tdp_mmu_init_child_sp(sp, &iter);
  1169			if (is_mirror_sp(sp))
  1170				kvm_mmu_alloc_external_spt(vcpu, sp);
  1171	
  1172			sp->nx_huge_page_disallowed = fault->huge_page_disallowed;
  1173	
  1174			if (is_shadow_present_pte(iter.old_spte)) {
  1175				/* Don't support large page for mirrored roots (TDX) */
> 1176				KVM_BUG_ON(is_mirror_sptep(iter.sptep), vcpu->kvm);
  1177				r = tdp_mmu_split_huge_page(kvm, &iter, sp, true);
  1178			} else {
  1179				r = tdp_mmu_link_sp(kvm, &iter, sp, true);
  1180			}
  1181	
  1182			/*
  1183			 * Force the guest to retry if installing an upper level SPTE
  1184			 * failed, e.g. because a different task modified the SPTE.
  1185			 */
  1186			if (r) {
  1187				tdp_mmu_free_sp(sp);
  1188				goto retry;
  1189			}
  1190	
  1191			if (fault->huge_page_disallowed &&
  1192			    fault->req_level >= iter.level) {
  1193				spin_lock(&kvm->arch.tdp_mmu_pages_lock);
  1194				if (sp->nx_huge_page_disallowed)
  1195					track_possible_nx_huge_page(kvm, sp);
  1196				spin_unlock(&kvm->arch.tdp_mmu_pages_lock);
  1197			}
  1198		}
  1199	
  1200		/*
  1201		 * The walk aborted before reaching the target level, e.g. because the
  1202		 * iterator detected an upper level SPTE was frozen during traversal.
  1203		 */
  1204		WARN_ON_ONCE(iter.level == fault->goal_level);
  1205		goto retry;
  1206	
  1207	map_target_level:
  1208		ret = tdp_mmu_map_handle_target_level(vcpu, fault, &iter);
  1209	
  1210	retry:
  1211		rcu_read_unlock();
  1212		return ret;
  1213	}
  1214	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux