On Tue, May 08, 2012 at 05:26:55PM +0200, Paolo Bonzini wrote: > Il 23/04/2012 16:04, Michael S. Tsirkin ha scritto: > > +/* Our own copy of __test_and_clear_bit to make sure > > + * it is done with a single instruction */ > > Is this for microoptimization or correctness? If the latter, it does > not ensure anything without a "lock" prefix. > It can't race with other vcpus, only with vmexit on the same vcpu. > Paolo > > > +static inline int kvm_test_and_clear_bit(int nr, volatile u16* addr) > > +{ > > + int oldbit; > > + > > + asm volatile("btr %2,%1\n\t" > > + "sbb %0,%0" > > + : "=r" (oldbit), BITOP_ADDR_CONSTRAINT(*addr) : "Ir" (nr)); > > + return oldbit; -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html