Re: [PATCH 03/10] KVM: x86: Add KVM_[GS]ET_CLOCK_GUEST for accurate KVM clock migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2024-04-19 at 16:40 +0100, Paul Durrant wrote:
> 
> > +        * If KVM_REQ_CLOCK_UPDATE is already pending, or if the
> > hv_clock has
> > +        * never been generated at all, call
> > kvm_guest_time_update() to do so.
> > +        * Might as well use the PVCLOCK_TSC_STABLE_BIT as the
> > check for ever
> > +        * having been written.
> > +        */
> > +       if (kvm_check_request(KVM_REQ_CLOCK_UPDATE, v) ||
> > +           !(hv_clock->flags & PVCLOCK_TSC_STABLE_BIT)) {
> > +               if (kvm_guest_time_update(v))
> > +                       return -EINVAL;
> 
> nit: simple nested if, so you could use &&

Yeah, I frowned at that a bit, and decided I preferred it this way just
to highlight the fact that kvm_guest_time_update() is doing a *thing*.
And then we bail with -EINVAL if that thing fails.

If you stick it all in the if() statement, the code flow is logically
the same but it's just a bit less obvious that there are side-effects
here in the middle of the conditions, and that those side-effects are
actually the *main* point of the statement.

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux