Re: [PATCH v2] KVM: X86: Fix softlockup when get the current kvmclock timestamp

From: kbuild test robot
Date: Fri Nov 24 2017 - 22:16:03 EST


Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kvm/linux-next]
[also build test WARNING on v4.14 next-20171124]
[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/Wanpeng-Li/KVM-X86-Fix-softlockup-when-get-the-current-kvmclock-timestamp/20171109-030841
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

In file included from arch/x86/kvm/x86.h:7:0,
from arch/x86/kvm/x86.c:28:
arch/x86/kvm/x86.c: In function 'get_kvmclock_ns':
>> arch/x86/include/asm/pvclock.h:93:15: warning: '*((void *)&hv_clock+28)' may be used uninitialized in this function [-Wmaybe-uninitialized]
u64 offset = pvclock_scale_delta(delta, src->tsc_to_system_mul,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src->tsc_shift);
~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c:1785:32: note: '*((void *)&hv_clock+28)' was declared here
struct pvclock_vcpu_time_info hv_clock;
^~~~~~~~
In file included from arch/x86/kvm/x86.h:7:0,
from arch/x86/kvm/x86.c:28:
arch/x86/include/asm/pvclock.h:65:2: warning: '*((void *)&hv_clock+24)' may be used uninitialized in this function [-Wmaybe-uninitialized]
__asm__ (
^~~~~~~
arch/x86/kvm/x86.c:1785:32: note: '*((void *)&hv_clock+24)' was declared here
struct pvclock_vcpu_time_info hv_clock;
^~~~~~~~
--
In file included from arch/x86//kvm/x86.h:7:0,
from arch/x86//kvm/x86.c:28:
arch/x86//kvm/x86.c: In function 'get_kvmclock_ns':
>> arch/x86/include/asm/pvclock.h:93:15: warning: '*((void *)&hv_clock+28)' may be used uninitialized in this function [-Wmaybe-uninitialized]
u64 offset = pvclock_scale_delta(delta, src->tsc_to_system_mul,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src->tsc_shift);
~~~~~~~~~~~~~~~
arch/x86//kvm/x86.c:1785:32: note: '*((void *)&hv_clock+28)' was declared here
struct pvclock_vcpu_time_info hv_clock;
^~~~~~~~
In file included from arch/x86//kvm/x86.h:7:0,
from arch/x86//kvm/x86.c:28:
arch/x86/include/asm/pvclock.h:65:2: warning: '*((void *)&hv_clock+24)' may be used uninitialized in this function [-Wmaybe-uninitialized]
__asm__ (
^~~~~~~
arch/x86//kvm/x86.c:1785:32: note: '*((void *)&hv_clock+24)' was declared here
struct pvclock_vcpu_time_info hv_clock;
^~~~~~~~

vim +93 arch/x86/include/asm/pvclock.h

347bb4448 Zachary Amsden 2010-08-19 88
dce2db0a3 Marcelo Tosatti 2012-11-27 89 static __always_inline
a5a1d1c29 Thomas Gleixner 2016-12-21 90 u64 __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src, u64 tsc)
dce2db0a3 Marcelo Tosatti 2012-11-27 91 {
108b249c4 Paolo Bonzini 2016-09-01 92 u64 delta = tsc - src->tsc_timestamp;
a5a1d1c29 Thomas Gleixner 2016-12-21 @93 u64 offset = pvclock_scale_delta(delta, src->tsc_to_system_mul,
f7550d076 Minfei Huang 2016-05-27 94 src->tsc_shift);
3aed64f6d Paolo Bonzini 2016-06-09 95 return src->system_time + offset;
dce2db0a3 Marcelo Tosatti 2012-11-27 96 }
dce2db0a3 Marcelo Tosatti 2012-11-27 97

:::::: The code at line 93 was first introduced by commit
:::::: a5a1d1c2914b5316924c7893eb683a5420ebd3be clocksource: Use a plain u64 instead of cycle_t

:::::: TO: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
:::::: CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip