Re: [PATCH v7 05/36] KVM: x86: Fold __get_kvmclock() into get_kvmclock()

Sean Christopherson <[email protected]> Tue, 28 Jul 2026 16:06:09 -0700
Newsgroups gmane.linux.documentation,gmane.comp.emulators.kvm.devel,gmane.linux.kernel,gmane.comp.emulators.xen.devel
Message-ID <[email protected]>
On Tue, Jul 28, 2026, David Woodhouse wrote:
> From: David Woodhouse <[email protected]>
> 
> There is no need for the separate __get_kvmclock() helper; just inline
> its body into get_kvmclock() within the seqcount retry loop.

Actually, there ends up being quite a bit of value if we rework the inner helper
to be all about the master clock mode.  If we go that route, then the main loop
is pretty self-explanatory, we can use early returns instead of continues and
subtle fall-throughs, and the indentation levels go down.

	do {
		data->flags = 0;

		seq = read_seqcount_begin(&ka->pvclock_sc);
		if (!__get_kvmclock_master_clock(kvm, data))
			data->clock = get_kvmclock_base_ns() + ka->kvmclock_offset;
	} while (read_seqcount_retry(&ka->pvclock_sc, seq));