Re: [PATCH] virt/kvm avoids oops by adding parameter checking

From: kbuild test robot
Date: Sat Sep 02 2017 - 23:37:03 EST


Hi nixiaoming,

[auto build test ERROR on v4.13-rc6]
[also build test ERROR on next-20170901]
[cannot apply to kvm/linux-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/nixiaoming/virt-kvm-avoids-oops-by-adding-parameter-checking/20170823-203000
config: powerpc-ppc64_defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc

All errors (new ones prefixed by >>):

arch/powerpc/kvm/../../../virt/kvm/kvm_main.c: In function 'kvm_flush_remote_tlbs':
>> arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:248:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
long dirty_count = smp_load_acquire(&kvm->tlbs_dirty);
^~~~
arch/powerpc/kvm/../../../virt/kvm/kvm_main.c: In function 'kvm_write_guest_offset_cached':
arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:2025:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
gpa_t gpa = ghc->gpa + offset;
^~~~~
cc1: all warnings being treated as errors

vim +248 arch/powerpc/kvm/../../../virt/kvm/kvm_main.c

d9e368d6 drivers/kvm/kvm_main.c Avi Kivity 2007-06-07 238
a6d51016 virt/kvm/kvm_main.c Mario Smarduch 2015-01-15 239 #ifndef CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL
49846896 virt/kvm/kvm_main.c Rusty Russell 2008-12-08 240 void kvm_flush_remote_tlbs(struct kvm *kvm)
2e53d63a virt/kvm/kvm_main.c Marcelo Tosatti 2008-02-20 241 {
6f1ad410 virt/kvm/kvm_main.c nixiaoming 2017-08-22 242 if (kvm == NULL)
6f1ad410 virt/kvm/kvm_main.c nixiaoming 2017-08-22 243 return;
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 244 /*
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 245 * Read tlbs_dirty before setting KVM_REQ_TLB_FLUSH in
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 246 * kvm_make_all_cpus_request.
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 247 */
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 @248 long dirty_count = smp_load_acquire(&kvm->tlbs_dirty);
a086f6a1 virt/kvm/kvm_main.c Xiao Guangrong 2014-04-17 249
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 250 /*
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 251 * We want to publish modifications to the page tables before reading
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 252 * mode. Pairs with a memory barrier in arch-specific code.
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 253 * - x86: smp_mb__after_srcu_read_unlock in vcpu_enter_guest
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 254 * and smp_mb in walk_shadow_page_lockless_begin/end.
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 255 * - powerpc: smp_mb in kvmppc_prepare_to_enter.
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 256 *
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 257 * There is already an smp_mb__after_atomic() before
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 258 * kvm_make_all_cpus_request() reads vcpu->mode. We reuse that
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 259 * barrier here.
4ae3cb3a virt/kvm/kvm_main.c Lan Tianyu 2016-03-13 260 */
445b8236 virt/kvm/kvm_main.c Tang Chen 2014-09-24 261 if (kvm_make_all_cpus_request(kvm, KVM_REQ_TLB_FLUSH))
49846896 virt/kvm/kvm_main.c Rusty Russell 2008-12-08 262 ++kvm->stat.remote_tlb_flush;
a086f6a1 virt/kvm/kvm_main.c Xiao Guangrong 2014-04-17 263 cmpxchg(&kvm->tlbs_dirty, dirty_count, 0);
2e53d63a virt/kvm/kvm_main.c Marcelo Tosatti 2008-02-20 264 }
2ba9f0d8 virt/kvm/kvm_main.c Aneesh Kumar K.V 2013-10-07 265 EXPORT_SYMBOL_GPL(kvm_flush_remote_tlbs);
a6d51016 virt/kvm/kvm_main.c Mario Smarduch 2015-01-15 266 #endif
2e53d63a virt/kvm/kvm_main.c Marcelo Tosatti 2008-02-20 267

:::::: The code at line 248 was first introduced by commit
:::::: 4ae3cb3a2551b41f22284f713e7d5e2b61a85c1d KVM: Replace smp_mb() with smp_load_acquire() in the kvm_flush_remote_tlbs()

:::::: TO: Lan Tianyu <tianyu.lan@xxxxxxxxx>
:::::: CC: Paolo Bonzini <pbonzini@xxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip