Hi Oliver,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on kvm/linux-next]
[also build test WARNING on vhost/linux-next v5.8-rc6 next-20200721]
[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/0day-ci/linux/commits/Oliver-Upton/KVM_-GET-SET-_TSC_O...
base:
https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce (this is a W=1 build):
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> arch/x86/kvm/x86.c:2052:6: warning: no previous prototype for
'kvm_write_tsc_offset' [-Wmissing-prototypes]
2052 | void
kvm_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset, u64 tsc, u64 ns,
| ^~~~~~~~~~~~~~~~~~~~
vim +/kvm_write_tsc_offset +2052 arch/x86/kvm/x86.c
2047
2048 /*
2049 * Sets the TSC offset for the vCPU and tracks the TSC matching generation. Must
2050 * hold the kvm->arch.tsc_write_lock to call this function.
2051 */
2052 void kvm_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset, u64
tsc, u64 ns,
2053 bool matched)
2054 {
2055 struct kvm *kvm = vcpu->kvm;
2056 bool already_matched;
2057
2058 already_matched = (vcpu->arch.this_tsc_generation ==
kvm->arch.cur_tsc_generation);
2059 /*
2060 * We also track the most recent recorded KHZ, write and time to
2061 * allow the matching interval to be extended at each write.
2062 */
2063 kvm->arch.last_tsc_nsec = ns;
2064 kvm->arch.last_tsc_write = tsc;
2065 kvm->arch.last_tsc_khz = vcpu->arch.virtual_tsc_khz;
2066
2067 vcpu->arch.last_guest_tsc = tsc;
2068
2069 /* Keep track of which generation this VCPU has synchronized to */
2070 vcpu->arch.this_tsc_generation = kvm->arch.cur_tsc_generation;
2071 vcpu->arch.this_tsc_nsec = kvm->arch.cur_tsc_nsec;
2072 vcpu->arch.this_tsc_write = kvm->arch.cur_tsc_write;
2073
2074 kvm_vcpu_write_tsc_offset(vcpu, offset);
2075
2076 spin_lock(&kvm->arch.pvclock_gtod_sync_lock);
2077 if (!matched) {
2078 /*
2079 * We split periods of matched TSC writes into generations.
2080 * For each generation, we track the original measured
2081 * nanosecond time, offset, and write, so if TSCs are in
2082 * sync, we can match exact offset, and if not, we can match
2083 * exact software computation in compute_guest_tsc()
2084 *
2085 * These values are tracked in kvm->arch.cur_xxx variables.
2086 */
2087 kvm->arch.nr_vcpus_matched_tsc = 0;
2088 kvm->arch.cur_tsc_generation++;
2089 kvm->arch.cur_tsc_nsec = ns;
2090 kvm->arch.cur_tsc_write = tsc;
2091 kvm->arch.cur_tsc_offset = offset;
2092 } else if (!already_matched) {
2093 kvm->arch.nr_vcpus_matched_tsc++;
2094 }
2095
2096 kvm_track_tsc_matching(vcpu);
2097 spin_unlock(&kvm->arch.pvclock_gtod_sync_lock);
2098 }
2099
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org