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-20220421] [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-randconfig-a014 (https://download.01.org/0day-ci/archive/20220421/202204211846.Gtei0xp5-lkp@xxxxxxxxx/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project bac6cd5bf85669e3376610cfc4c4f9ca015e7b9b) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # 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 COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross 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:2936:3: error: expected expression struct timespec64 ts; ^ >> arch/x86/kvm/x86.c:2938:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation] if (kvm_get_walltime_and_clockread(&ts, &data->host_tsc)) { ^ arch/x86/kvm/x86.c:2933:2: note: previous statement is here if (ka->use_master_clock && ^ arch/x86/kvm/x86.c:2938:39: error: use of undeclared identifier 'ts' if (kvm_get_walltime_and_clockread(&ts, &data->host_tsc)) { ^ arch/x86/kvm/x86.c:2939:21: error: use of undeclared identifier 'ts' data->realtime = ts.tv_nsec + NSEC_PER_SEC * ts.tv_sec; ^ arch/x86/kvm/x86.c:2939:49: error: use of undeclared identifier 'ts' data->realtime = ts.tv_nsec + NSEC_PER_SEC * ts.tv_sec; ^ arch/x86/kvm/x86.c:2952:4: error: expected identifier or '(' } else { ^ arch/x86/kvm/x86.c:2956:2: error: expected identifier or '(' put_cpu(); ^ include/linux/smp.h:268:20: note: expanded from macro 'put_cpu' #define put_cpu() preempt_enable() ^ include/linux/preempt.h:239:26: note: expanded from macro 'preempt_enable' #define preempt_enable() \ ^ arch/x86/kvm/x86.c:2956:2: error: expected identifier or '(' include/linux/smp.h:268:20: note: expanded from macro 'put_cpu' #define put_cpu() preempt_enable() ^ include/linux/preempt.h:243:3: note: expanded from macro 'preempt_enable' } while (0) ^ arch/x86/kvm/x86.c:2957:1: error: extraneous closing brace ('}') } ^ 1 warning and 8 errors generated. vim +/if +2938 arch/x86/kvm/x86.c c60b3070bd6e7e Anton Romanov 2022-04-21 2922 869b44211adc87 Paolo Bonzini 2021-09-16 2923 /* Called within read_seqcount_begin/retry for kvm->pvclock_sc. */ 869b44211adc87 Paolo Bonzini 2021-09-16 2924 static void __get_kvmclock(struct kvm *kvm, struct kvm_clock_data *data) 108b249c453dd7 Paolo Bonzini 2016-09-01 2925 { 108b249c453dd7 Paolo Bonzini 2016-09-01 2926 struct kvm_arch *ka = &kvm->arch; 8b953440645631 Paolo Bonzini 2016-11-16 2927 struct pvclock_vcpu_time_info hv_clock; 8b953440645631 Paolo Bonzini 2016-11-16 2928 e2c2206a18993b Wanpeng Li 2017-05-11 2929 /* both __this_cpu_read() and rdtsc() should be on the same cpu */ e2c2206a18993b Wanpeng Li 2017-05-11 2930 get_cpu(); e2c2206a18993b Wanpeng Li 2017-05-11 2931 869b44211adc87 Paolo Bonzini 2021-09-16 2932 data->flags = 0; c60b3070bd6e7e Anton Romanov 2022-04-21 2933 if (ka->use_master_clock && c60b3070bd6e7e Anton Romanov 2022-04-21 2934 (static_cpu_has(X86_FEATURE_CONSTANT_TSC) || __this_cpu_read(cpu_tsc_khz))) c68dc1b577eabd Oliver Upton 2021-09-16 2935 #ifdef CONFIG_X86_64 c68dc1b577eabd Oliver Upton 2021-09-16 2936 struct timespec64 ts; c68dc1b577eabd Oliver Upton 2021-09-16 2937 c68dc1b577eabd Oliver Upton 2021-09-16 @2938 if (kvm_get_walltime_and_clockread(&ts, &data->host_tsc)) { c68dc1b577eabd Oliver Upton 2021-09-16 2939 data->realtime = ts.tv_nsec + NSEC_PER_SEC * ts.tv_sec; c68dc1b577eabd Oliver Upton 2021-09-16 2940 data->flags |= KVM_CLOCK_REALTIME | KVM_CLOCK_HOST_TSC; c68dc1b577eabd Oliver Upton 2021-09-16 2941 } else c68dc1b577eabd Oliver Upton 2021-09-16 2942 #endif c68dc1b577eabd Oliver Upton 2021-09-16 2943 data->host_tsc = rdtsc(); c68dc1b577eabd Oliver Upton 2021-09-16 2944 869b44211adc87 Paolo Bonzini 2021-09-16 2945 data->flags |= KVM_CLOCK_TSC_STABLE; 869b44211adc87 Paolo Bonzini 2021-09-16 2946 hv_clock.tsc_timestamp = ka->master_cycle_now; 869b44211adc87 Paolo Bonzini 2021-09-16 2947 hv_clock.system_time = ka->master_kernel_ns + ka->kvmclock_offset; c60b3070bd6e7e Anton Romanov 2022-04-21 2948 kvm_get_time_scale(NSEC_PER_SEC, get_cpu_tsc_khz() * 1000LL, 8b953440645631 Paolo Bonzini 2016-11-16 2949 &hv_clock.tsc_shift, 8b953440645631 Paolo Bonzini 2016-11-16 2950 &hv_clock.tsc_to_system_mul); c68dc1b577eabd Oliver Upton 2021-09-16 2951 data->clock = __pvclock_read_cycles(&hv_clock, data->host_tsc); 55c0cefbdbdaca Oliver Upton 2021-09-16 2952 } else { 55c0cefbdbdaca Oliver Upton 2021-09-16 2953 data->clock = get_kvmclock_base_ns() + ka->kvmclock_offset; 55c0cefbdbdaca Oliver Upton 2021-09-16 2954 } e2c2206a18993b Wanpeng Li 2017-05-11 2955 e2c2206a18993b Wanpeng Li 2017-05-11 2956 put_cpu(); 55c0cefbdbdaca Oliver Upton 2021-09-16 2957 } e2c2206a18993b Wanpeng Li 2017-05-11 2958 -- 0-DAY CI Kernel Test Service https://01.org/lkp