Hi Tianrui,
First bad commit (maybe != root cause):
tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 15f539c4a521c5ae892554d0046e24f050ec0e00 commit: 07db411edd838080fb7c42b9f56bc08dd60d9af6 [3761/10661] LoongArch: KVM: Enable kvm config and add the makefile config: loongarch-randconfig-001-20240711 (https://download.01.org/0day-ci/archive/20240712/202407120630.mHZS1KSZ-lkp@i...) compiler: loongarch64-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240712/202407120630.mHZS1KSZ-lkp@i...)
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/202407120630.mHZS1KSZ-lkp@intel.com/
All warnings (new ones prefixed by >>):
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c: In function '__kvm_mmu_topup_memory_cache':
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:426:53: warning: 'kvmalloc_array' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
426 | mc->objects = kvmalloc_array(sizeof(void *), capacity, gfp); | ^~~~ arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:426:53: note: earlier argument should specify number of elements, later size of each element
vim +426 arch/loongarch/kvm/../../../virt/kvm/kvm_main.c
6926f95accee3f Sean Christopherson 2020-07-02 413 837f66c7120754 David Matlack 2022-06-22 414 int __kvm_mmu_topup_memory_cache(struct kvm_mmu_memory_cache *mc, int capacity, int min) 6926f95accee3f Sean Christopherson 2020-07-02 415 { 63f4b210414b65 Paolo Bonzini 2022-07-29 416 gfp_t gfp = mc->gfp_custom ? mc->gfp_custom : GFP_KERNEL_ACCOUNT; 6926f95accee3f Sean Christopherson 2020-07-02 417 void *obj; 6926f95accee3f Sean Christopherson 2020-07-02 418 6926f95accee3f Sean Christopherson 2020-07-02 419 if (mc->nobjs >= min) 6926f95accee3f Sean Christopherson 2020-07-02 420 return 0; 837f66c7120754 David Matlack 2022-06-22 421 837f66c7120754 David Matlack 2022-06-22 422 if (unlikely(!mc->objects)) { 837f66c7120754 David Matlack 2022-06-22 423 if (WARN_ON_ONCE(!capacity)) 837f66c7120754 David Matlack 2022-06-22 424 return -EIO; 837f66c7120754 David Matlack 2022-06-22 425 837f66c7120754 David Matlack 2022-06-22 @426 mc->objects = kvmalloc_array(sizeof(void *), capacity, gfp); 837f66c7120754 David Matlack 2022-06-22 427 if (!mc->objects) 837f66c7120754 David Matlack 2022-06-22 428 return -ENOMEM; 837f66c7120754 David Matlack 2022-06-22 429 837f66c7120754 David Matlack 2022-06-22 430 mc->capacity = capacity; 837f66c7120754 David Matlack 2022-06-22 431 } 837f66c7120754 David Matlack 2022-06-22 432 837f66c7120754 David Matlack 2022-06-22 433 /* It is illegal to request a different capacity across topups. */ 837f66c7120754 David Matlack 2022-06-22 434 if (WARN_ON_ONCE(mc->capacity != capacity)) 837f66c7120754 David Matlack 2022-06-22 435 return -EIO; 837f66c7120754 David Matlack 2022-06-22 436 837f66c7120754 David Matlack 2022-06-22 437 while (mc->nobjs < mc->capacity) { 837f66c7120754 David Matlack 2022-06-22 438 obj = mmu_memory_cache_alloc_obj(mc, gfp); 6926f95accee3f Sean Christopherson 2020-07-02 439 if (!obj) 6926f95accee3f Sean Christopherson 2020-07-02 440 return mc->nobjs >= min ? 0 : -ENOMEM; 6926f95accee3f Sean Christopherson 2020-07-02 441 mc->objects[mc->nobjs++] = obj; 6926f95accee3f Sean Christopherson 2020-07-02 442 } 6926f95accee3f Sean Christopherson 2020-07-02 443 return 0; 6926f95accee3f Sean Christopherson 2020-07-02 444 } 6926f95accee3f Sean Christopherson 2020-07-02 445
:::::: The code at line 426 was first introduced by commit :::::: 837f66c71207542283831d0762c5dca3db5b397a KVM: Allow for different capacities in kvm_mmu_memory_cache structs
:::::: TO: David Matlack dmatlack@google.com :::::: CC: Paolo Bonzini pbonzini@redhat.com