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

From: Sean Christopherson

Date: Tue Jul 28 2026 - 19:06:17 EST


On Tue, Jul 28, 2026, David Woodhouse wrote:
> From: David Woodhouse <dwmw@xxxxxxxxxxxx>
>
> 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));