Re: [PATCH 2/4] KVM: x86/xen: Compatibility fixes for shared runstate area

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

 



On Sat, 2022-11-19 at 11:38 +0000, Durrant, Paul wrote:
> > +       size_t user_len, user_len1, user_len2;
> 
> I think it might make the code marginally neater to use two-element arrays... but only marginally.

Not sure; I kind of prefer it like this. At least overall, this version
is somewhat nicer than some of the interim attempts that you saw... :)


> > +        * Attempt to obtain the GPC lock on *both* (if there are two)
> > +        * gfn_to_pfn caches that cover the region.
> > +        */
> > +       read_lock_irqsave(&gpc1->lock, flags);
> > +       while (!kvm_gfn_to_pfn_cache_check(v->kvm, gpc1, gpc1->gpa, user_len1)) {
> > +               read_unlock_irqrestore(&gpc1->lock, flags);
> > 
> > -               vx->runstate_times[RUNSTATE_runnable] += steal_ns;
> > +               /* When invoked from kvm_sched_out() we cannot sleep */
> > +               if (atomic)
> > +                       return;
> > +
> > +               if (kvm_gfn_to_pfn_cache_refresh(v->kvm, gpc1, gpc1->gpa, user_len1))
> > +                       return;
> > +
> > +               read_lock_irqsave(&gpc1->lock, flags);
> 
> This is a repeated pattern now, so how about a helper function?

I've been tempted by that a few times but although it's a repeating
pattern, there are differences every time around the conditions for
bailing out early — the if (atomic) part above.



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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux