Re: [PATCH 5/8] kvm: Add cap/kvm_run field for memory fault exits

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

 



On Fri, Feb 17, 2023, Anish Moorthy wrote:
> On Thu, Feb 16, 2023 at 1:38 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > Ensuring that vCPUs "see" the new value and not corrupting memory are two very
> > different things.  Making the flag an atomic, wrapping with a rwlock, etc... do
> > nothing to ensure vCPUs observe the new value.  And for non-crazy usage of bools,
> > they're not even necessary to avoid memory corruption...
> 
> Oh, that's news to me- I've learned to treat any unprotected concurrent accesses
> to memory as undefined behavior: guess there's always more to learn.

To expand a bit, undefined and non-deterministic are two different things.  In
this case, the behavior is not deterministic, but it _is_ defined.  Readers will
either see %true or %false, but they will not see %beagle. 

And more importantly _KVM_ doesn't care whether or not the behavior is deterministic,
that's userspace's responsibility.  E.g. if KVM were endangered by the flag changing
then some form of locking absolutely would be needed, but that's not the case here.




[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