Re: [PATCH] KVM: x86: Convert INIT and SIPI signals into synchronously handled events

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

 



On 2013-03-13 10:03, Paolo Bonzini wrote:
> Il 13/03/2013 08:39, Jan Kiszka ha scritto:
>>> I think this should clear pending SIPIs, unless KVM_APIC_INIT
>>> was already set in which case it should be a no-op.  Something
>>> like:
>>>
>>> e = apic->pending_events; while (!(e & KVM_APIC_INIT)) e =
>>> cmpxchg(&apic->pending_events, e, (e | KVM_APIC_INIT) &
>>> ~KVM_APIC_SIPI);
>>>
>>> If you do this, better make pending_events an atomic_t.
> 
>> Quick question: Why atomic_t? It becomes a bit ugly to poke into
>> the atomic counter for bitops, and cmpxchg is mapped on an
>> interlocked version.
> 
> It's a bit safer because it forces you to use atomic_read, and
> generally points out to reviewers to think about memory barriers.  But
> indeed the lack of atomic_set_bit and atomic_clear_bit makes the code
> uglier.  And as long as there are no other bits in
> apic->pending_events, the above loop is actually the same as just
> 
>   apic->pending_events = 1 << KVM_APIC_INIT;

Yeah, can simplify this in the next version of the just posted patch.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
--
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


[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