All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Woodhouse <dwmw@amazon.co.uk>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [dwmw2:kvmclock4 16/33] arch/x86/kvm/x86.c:3388:22: error: implicit declaration of function 'kvm_get_time_and_clockread'; did you mean 'kvm_get_monotonic_and_clockread'?
Date: Mon, 11 May 2026 19:59:53 +0800	[thread overview]
Message-ID: <202605111940.zLRfvQzJ-lkp@intel.com> (raw)

tree:   git://git.infradead.org/users/dwmw2/linux kvmclock4
head:   d6673491163f4987d73e4644987c605f22cbf706
commit: d216b965d38e8dc9aeccd8eea855a1187f997199 [16/33] KVM: x86: Restructure kvm_guest_time_update() for TSC upscaling
config: i386-buildonly-randconfig-006 (https://download.01.org/0day-ci/archive/20260511/202605111940.zLRfvQzJ-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260511/202605111940.zLRfvQzJ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605111940.zLRfvQzJ-lkp@intel.com/

All errors (new ones prefixed by >>):

   arch/x86/kvm/x86.c: In function 'kvm_guest_time_update':
>> arch/x86/kvm/x86.c:3388:22: error: implicit declaration of function 'kvm_get_time_and_clockread'; did you mean 'kvm_get_monotonic_and_clockread'? [-Wimplicit-function-declaration]
    3388 |                     !kvm_get_time_and_clockread(&kernel_ns, &host_tsc) &&
         |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
         |                      kvm_get_monotonic_and_clockread
   arch/x86/kvm/x86.c:3359:23: warning: unused variable 'flags' [-Wunused-variable]
    3359 |         unsigned long flags;
         |                       ^~~~~


vim +3388 arch/x86/kvm/x86.c

  3355	
  3356	int kvm_guest_time_update(struct kvm_vcpu *v)
  3357	{
  3358		struct pvclock_vcpu_time_info hv_clock = {};
  3359		unsigned long flags;
  3360		u64 tgt_tsc_hz;
  3361		unsigned seq;
  3362		struct kvm_vcpu_arch *vcpu = &v->arch;
  3363		struct kvm_arch *ka = &v->kvm->arch;
  3364		s64 kernel_ns;
  3365		u64 tsc_timestamp, host_tsc;
  3366		u64 master_host_tsc = 0;
  3367		s64 master_kernel_ns = 0;
  3368		bool use_master_clock;
  3369	
  3370		/*
  3371		 * If the host uses TSC clock, then passthrough TSC as stable
  3372		 * to the guest.
  3373		 */
  3374		do {
  3375			seq = read_seqcount_begin(&ka->pvclock_sc);
  3376	
  3377			use_master_clock = ka->use_master_clock;
  3378	
  3379			/*
  3380			 * The TSC read and the call to get_cpu_tsc_khz() must happen
  3381			 * on the same CPU.
  3382			 */
  3383			get_cpu();
  3384	
  3385			tgt_tsc_hz = (u64)get_cpu_tsc_khz() * 1000;
  3386	
  3387			if (use_master_clock &&
> 3388			    !kvm_get_time_and_clockread(&kernel_ns, &host_tsc) &&
  3389			    WARN_ON_ONCE(!read_seqcount_retry(&ka->pvclock_sc, seq)))
  3390				use_master_clock = false;
  3391	
  3392			put_cpu();
  3393	
  3394			if (!use_master_clock)
  3395				break;
  3396	
  3397			master_host_tsc = ka->master_cycle_now;
  3398			master_kernel_ns = ka->master_kernel_ns;
  3399		} while (read_seqcount_retry(&ka->pvclock_sc, seq));
  3400	
  3401		if (unlikely(tgt_tsc_hz == 0)) {
  3402			kvm_make_request(KVM_REQ_CLOCK_UPDATE, v);
  3403			return 1;
  3404		}
  3405	
  3406		if (!use_master_clock) {
  3407			host_tsc = rdtsc();
  3408			kernel_ns = get_kvmclock_base_ns();
  3409		}
  3410	
  3411		/*
  3412		 * We may have to catch up the TSC to match elapsed wall clock
  3413		 * time for two reasons, even if kvmclock is used.
  3414		 *   1) CPU could have been running below the maximum TSC rate
  3415		 *   2) Broken TSC compensation resets the base at each VCPU
  3416		 *      entry to avoid unknown leaps of TSC even when running
  3417		 *      again on the same CPU.  This may cause apparent elapsed
  3418		 *      time to disappear, and the guest to stand still or run
  3419		 *      very slowly.
  3420		 */
  3421		if (vcpu->tsc_catchup) {
  3422			s64 adjustment;
  3423	
  3424			/*
  3425			 * Calculate the delta between what the guest TSC *should* be
  3426			 * and what it actually is according to kvm_read_l1_tsc().
  3427			 */
  3428			adjustment = compute_guest_tsc(v, kernel_ns) -
  3429				     kvm_read_l1_tsc(v, host_tsc);
  3430			if (adjustment > 0)
  3431				adjust_tsc_offset_guest(v, adjustment);
  3432		}
  3433	
  3434		/*
  3435		 * Now that TSC upscaling is out of the way, the remaining calculations
  3436		 * are all relative to the reference time that's placed in hv_clock.
  3437		 * If the master clock is NOT in use, the reference time is "now".  If
  3438		 * master clock is in use, the reference time comes from there.
  3439		 */
  3440		if (use_master_clock) {
  3441			host_tsc = master_host_tsc;
  3442			kernel_ns = master_kernel_ns;
  3443		}
  3444		tsc_timestamp = kvm_read_l1_tsc(v, host_tsc);
  3445	
  3446		/* With all the info we got, fill in the values */
  3447	
  3448		if (kvm_caps.has_tsc_control) {
  3449			tgt_tsc_hz = kvm_scale_tsc(tgt_tsc_hz,
  3450						    v->arch.l1_tsc_scaling_ratio);
  3451			tgt_tsc_hz = tgt_tsc_hz ? : 1;
  3452		}
  3453	
  3454		if (unlikely(vcpu->hw_tsc_hz != tgt_tsc_hz)) {
  3455			kvm_get_time_scale(NSEC_PER_SEC, tgt_tsc_hz,
  3456					   &vcpu->pvclock_tsc_shift,
  3457					   &vcpu->pvclock_tsc_mul);
  3458			vcpu->hw_tsc_hz = tgt_tsc_hz;
  3459		}
  3460	
  3461		hv_clock.tsc_shift = vcpu->pvclock_tsc_shift;
  3462		hv_clock.tsc_to_system_mul = vcpu->pvclock_tsc_mul;
  3463		hv_clock.tsc_timestamp = tsc_timestamp;
  3464		hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset;
  3465		vcpu->last_guest_tsc = tsc_timestamp;
  3466	
  3467		/* If the host uses TSC clocksource, then it is stable */
  3468		hv_clock.flags = 0;
  3469		if (use_master_clock)
  3470			hv_clock.flags |= PVCLOCK_TSC_STABLE_BIT;
  3471	
  3472		if (vcpu->pv_time.active) {
  3473			/*
  3474			 * GUEST_STOPPED is only supported by kvmclock, and KVM's
  3475			 * historic behavior is to only process the request if kvmclock
  3476			 * is active/enabled.
  3477			 */
  3478			if (vcpu->pvclock_set_guest_stopped_request) {
  3479				hv_clock.flags |= PVCLOCK_GUEST_STOPPED;
  3480				vcpu->pvclock_set_guest_stopped_request = false;
  3481			}
  3482			kvm_setup_guest_pvclock(&hv_clock, v, &vcpu->pv_time, 0);
  3483	
  3484			hv_clock.flags &= ~PVCLOCK_GUEST_STOPPED;
  3485		}
  3486	
  3487		kvm_hv_setup_tsc_page(v->kvm, &hv_clock);
  3488	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2026-05-11 12:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 11:59 kernel test robot [this message]
2026-05-11 12:26 ` [dwmw2:kvmclock4 16/33] arch/x86/kvm/x86.c:3388:22: error: implicit declaration of function 'kvm_get_time_and_clockread'; did you mean 'kvm_get_monotonic_and_clockread'? David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202605111940.zLRfvQzJ-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dwmw@amazon.co.uk \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.