arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Sat Nov 18 2023 - 01:25:38 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 791c8ab095f71327899023223940dd52257a4173
commit: c1fc48aad14dbe7654f5986afb906332b528d54b LoongArch: KVM: Enable kvm config and add the makefile
date: 7 weeks ago
config: loongarch-randconfig-r111-20231118 (https://download.01.org/0day-ci/archive/20231118/202311181454.CTPrSYmQ-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231118/202311181454.CTPrSYmQ-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/202311181454.CTPrSYmQ-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct cpumask *[noderef] __percpu * @@
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: expected void *ptr
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: got struct cpumask *[noderef] __percpu *
>> arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct cpumask *[noderef] __percpu * @@
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: expected void *ptr
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: got struct cpumask *[noderef] __percpu *
>> arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct cpumask *[noderef] __percpu * @@
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: expected void *ptr
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: got struct cpumask *[noderef] __percpu *
>> arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct cpumask *[noderef] __percpu * @@
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: expected void *ptr
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:300:16: sparse: got struct cpumask *[noderef] __percpu *
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct cpumask *[noderef] __percpu * @@
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: expected void *ptr
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: got struct cpumask *[noderef] __percpu *
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct cpumask *[noderef] __percpu * @@
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: expected void *ptr
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: got struct cpumask *[noderef] __percpu *
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct cpumask *[noderef] __percpu * @@
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: expected void *ptr
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: got struct cpumask *[noderef] __percpu *
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct cpumask *[noderef] __percpu * @@
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: expected void *ptr
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:327:16: sparse: got struct cpumask *[noderef] __percpu *
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c: note: in included file:
include/linux/kvm_host.h:1946:54: sparse: sparse: array of flexible structures
include/linux/kvm_host.h:1948:56: sparse: sparse: array of flexible structures
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:602:9: sparse: sparse: context imbalance in 'kvm_mmu_notifier_change_pte' - different lock contexts for basic block
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:602:9: sparse: sparse: context imbalance in 'kvm_mmu_notifier_invalidate_range_start' - different lock contexts for basic block
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:602:9: sparse: sparse: context imbalance in 'kvm_mmu_notifier_invalidate_range_end' - different lock contexts for basic block
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:602:9: sparse: sparse: context imbalance in 'kvm_mmu_notifier_clear_flush_young' - different lock contexts for basic block
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:602:9: sparse: sparse: context imbalance in 'kvm_mmu_notifier_clear_young' - different lock contexts for basic block
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:602:9: sparse: sparse: context imbalance in 'kvm_mmu_notifier_test_young' - different lock contexts for basic block
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:1969:49: sparse: sparse: self-comparison always evaluates to false
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:1975:37: sparse: sparse: self-comparison always evaluates to false
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:2674:9: sparse: sparse: context imbalance in 'hva_to_pfn_remapped' - unexpected unlock

vim +300 arch/loongarch/kvm/../../../virt/kvm/kvm_main.c

7053df4edb3ae3 Vitaly Kuznetsov 2018-05-16 289
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 290 bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
620b2438abf98f Vitaly Kuznetsov 2021-09-03 291 unsigned long *vcpu_bitmap)
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 292 {
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 293 struct kvm_vcpu *vcpu;
620b2438abf98f Vitaly Kuznetsov 2021-09-03 294 struct cpumask *cpus;
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 295 int i, me;
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 296 bool called;
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 297
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 298 me = get_cpu();
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 299
620b2438abf98f Vitaly Kuznetsov 2021-09-03 @300 cpus = this_cpu_cpumask_var_ptr(cpu_kick_mask);
620b2438abf98f Vitaly Kuznetsov 2021-09-03 301 cpumask_clear(cpus);
620b2438abf98f Vitaly Kuznetsov 2021-09-03 302
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 303 for_each_set_bit(i, vcpu_bitmap, KVM_MAX_VCPUS) {
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 304 vcpu = kvm_get_vcpu(kvm, i);
381cecc5d7b777 Vitaly Kuznetsov 2021-09-03 305 if (!vcpu)
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 306 continue;
b56bd8e03cf4d5 Jinrong Liang 2022-01-25 307 kvm_make_vcpu_request(vcpu, req, cpus, me);
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 308 }
ae0946cd360175 Vitaly Kuznetsov 2021-09-03 309
620b2438abf98f Vitaly Kuznetsov 2021-09-03 310 called = kvm_kick_many_cpus(cpus, !!(req & KVM_REQUEST_WAIT));
3cba41307a2b13 Xiao Guangrong 2011-01-12 311 put_cpu();
7053df4edb3ae3 Vitaly Kuznetsov 2018-05-16 312
7053df4edb3ae3 Vitaly Kuznetsov 2018-05-16 313 return called;
7053df4edb3ae3 Vitaly Kuznetsov 2018-05-16 314 }
7053df4edb3ae3 Vitaly Kuznetsov 2018-05-16 315

:::::: The code at line 300 was first introduced by commit
:::::: 620b2438abf98f09e19802cbc3bc2e98179cdbe2 KVM: Make kvm_make_vcpus_request_mask() use pre-allocated cpu_kick_mask

:::::: TO: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
:::::: CC: Paolo Bonzini <pbonzini@xxxxxxxxxx>

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