Re: [PATCH v3 1/4] arm64: KVM: use mutex_trylock_nest_lock when locking all vCPUs

kernel test robot
2025-05-07T17:34:01Z

Hi Maxim,

kernel test robot noticed the following build errors:

[auto build test ERROR on kvm/queue]
[also build test ERROR on kvm/next kvmarm/next tip/locking/core linus/master v6.15-rc5 next-20250507]
[cannot apply to kvm/linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Maxim-Levitsky/arm64-KVM-use-mutex_trylock_nest_lock-when-locking-all-vCPUs/20250501-042643
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
patch link: https://lore.kernel.org/r/20250430202311.364641-2-mlevitsk%40redhat.com
patch subject: [PATCH v3 1/4] arm64: KVM: use mutex_trylock_nest_lock when locking all vCPUs
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20250508/202505080024.CZZ0ssB5-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250508/202505080024.CZZ0ssB5-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505080024.CZZ0ssB5-lkp@intel.com/

All errors (new ones prefixed by >>):

arch/x86/kvm/../../../virt/kvm/kvm_main.c: In function 'kvm_trylock_all_vcpus':
>> arch/x86/kvm/../../../virt/kvm/kvm_main.c:1381:22: error: implicit declaration of function 'mutex_trylock_nest_lock'; did you mean 'mutex_lock_nest_lock'? [-Werror=implicit-function-declaration]
1381 | if (!mutex_trylock_nest_lock(&vcpu->mutex, &kvm->lock))
| ^~~~~~~~~~~~~~~~~~~~~~~
| mutex_lock_nest_lock
cc1: some warnings being treated as errors

vim +1381 arch/x86/kvm/../../../virt/kvm/kvm_main.c

1370
1371 /*
1372 * Try to lock all of the VM's vCPUs.
1373 * Assumes that the kvm->lock is held.
1374 */
1375 int kvm_trylock_all_vcpus(struct kvm *kvm)
1376 {
1377 struct kvm_vcpu *vcpu;
1378 unsigned long i, j;
1379
1380 kvm_for_each_vcpu(i, vcpu, kvm)
> 1381 if (!mutex_trylock_nest_lock(&vcpu->mutex, &kvm->lock))
1382 goto out_unlock;
1383 return 0;
1384
1385 out_unlock:
1386 kvm_for_each_vcpu(j, vcpu, kvm) {
1387 if (i == j)
1388 break;
1389 mutex_unlock(&vcpu->mutex);
1390 }
1391 return -EINTR;
1392 }
1393 EXPORT_SYMBOL_GPL(kvm_trylock_all_vcpus);
1394

--
0-DAY CI Kernel Test Service