Re: [PATCH v2] KVM: x86: Use current rather than snapshotted TSC frequency if it is constant

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Anton,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kvm/master]
[also build test WARNING on mst-vhost/linux-next v5.18-rc3 next-20220420]
[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]

url:    https://github.com/intel-lab-lkp/linux/commits/Anton-Romanov/KVM-x86-Use-current-rather-than-snapshotted-TSC-frequency-if-it-is-constant/20220421-090221
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git master
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220421/202204211558.rjkmRfSe-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/c60b3070bd6e7e804de118dac10002e4f5f714a6
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Anton-Romanov/KVM-x86-Use-current-rather-than-snapshotted-TSC-frequency-if-it-is-constant/20220421-090221
        git checkout c60b3070bd6e7e804de118dac10002e4f5f714a6
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/kvm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   arch/x86/kvm/x86.c: In function '__get_kvmclock':
   arch/x86/kvm/x86.c:2936:17: error: expected expression before 'struct'
    2936 |                 struct timespec64 ts;
         |                 ^~~~~~
>> arch/x86/kvm/x86.c:2933:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    2933 |         if (ka->use_master_clock &&
         |         ^~
   arch/x86/kvm/x86.c:2938:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    2938 |                 if (kvm_get_walltime_and_clockread(&ts, &data->host_tsc)) {
         |                 ^~
   arch/x86/kvm/x86.c:2938:53: error: 'ts' undeclared (first use in this function); did you mean 'tms'?
    2938 |                 if (kvm_get_walltime_and_clockread(&ts, &data->host_tsc)) {
         |                                                     ^~
         |                                                     tms
   arch/x86/kvm/x86.c:2938:53: note: each undeclared identifier is reported only once for each function it appears in
   arch/x86/kvm/x86.c: At top level:
   arch/x86/kvm/x86.c:2952:11: error: expected identifier or '(' before 'else'
    2952 |         } else {
         |           ^~~~
   In file included from include/linux/percpu.h:6,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/kvm_host.h:7,
                    from arch/x86/kvm/x86.c:19:
   include/linux/preempt.h:219:1: error: expected identifier or '(' before 'do'
     219 | do { \
         | ^~
   include/linux/smp.h:268:33: note: in expansion of macro 'preempt_enable'
     268 | #define put_cpu()               preempt_enable()
         |                                 ^~~~~~~~~~~~~~
   arch/x86/kvm/x86.c:2956:9: note: in expansion of macro 'put_cpu'
    2956 |         put_cpu();
         |         ^~~~~~~
   include/linux/preempt.h:223:3: error: expected identifier or '(' before 'while'
     223 | } while (0)
         |   ^~~~~
   include/linux/smp.h:268:33: note: in expansion of macro 'preempt_enable'
     268 | #define put_cpu()               preempt_enable()
         |                                 ^~~~~~~~~~~~~~
   arch/x86/kvm/x86.c:2956:9: note: in expansion of macro 'put_cpu'
    2956 |         put_cpu();
         |         ^~~~~~~
   arch/x86/kvm/x86.c:2957:1: error: expected identifier or '(' before '}' token
    2957 | }
         | ^


vim +/if +2933 arch/x86/kvm/x86.c

  2922	
  2923	/* Called within read_seqcount_begin/retry for kvm->pvclock_sc.  */
  2924	static void __get_kvmclock(struct kvm *kvm, struct kvm_clock_data *data)
  2925	{
  2926		struct kvm_arch *ka = &kvm->arch;
  2927		struct pvclock_vcpu_time_info hv_clock;
  2928	
  2929		/* both __this_cpu_read() and rdtsc() should be on the same cpu */
  2930		get_cpu();
  2931	
  2932		data->flags = 0;
> 2933		if (ka->use_master_clock &&
  2934			(static_cpu_has(X86_FEATURE_CONSTANT_TSC) || __this_cpu_read(cpu_tsc_khz)))
  2935	#ifdef CONFIG_X86_64
  2936			struct timespec64 ts;
  2937	
  2938			if (kvm_get_walltime_and_clockread(&ts, &data->host_tsc)) {
  2939				data->realtime = ts.tv_nsec + NSEC_PER_SEC * ts.tv_sec;
  2940				data->flags |= KVM_CLOCK_REALTIME | KVM_CLOCK_HOST_TSC;
  2941			} else
  2942	#endif
  2943			data->host_tsc = rdtsc();
  2944	
  2945			data->flags |= KVM_CLOCK_TSC_STABLE;
  2946			hv_clock.tsc_timestamp = ka->master_cycle_now;
  2947			hv_clock.system_time = ka->master_kernel_ns + ka->kvmclock_offset;
  2948			kvm_get_time_scale(NSEC_PER_SEC, get_cpu_tsc_khz() * 1000LL,
  2949					   &hv_clock.tsc_shift,
  2950					   &hv_clock.tsc_to_system_mul);
  2951			data->clock = __pvclock_read_cycles(&hv_clock, data->host_tsc);
  2952		} else {
  2953			data->clock = get_kvmclock_base_ns() + ka->kvmclock_offset;
  2954		}
  2955	
  2956		put_cpu();
  2957	}
  2958	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux