Re: [Qemu-devel] [PATCH v3 23/29] bitmap: add atomic set functions

2015-05-27 Thread Fam Zheng
On Tue, 05/26 18:54, Paolo Bonzini wrote: > From: Stefan Hajnoczi > > Use atomic_or() for atomic bitmaps where several threads may set bits at > the same time. This avoids the race condition between threads loading > an element, bitwise ORing, and then storing the element. > > When setting all

Re: [Qemu-devel] [PATCH v3 23/29] bitmap: add atomic set functions

2015-05-27 Thread Paolo Bonzini
On 27/05/2015 09:58, Fam Zheng wrote: > On Tue, 05/26 18:54, Paolo Bonzini wrote: >> From: Stefan Hajnoczi >> >> Use atomic_or() for atomic bitmaps where several threads may set bits at >> the same time. This avoids the race condition between threads loading >> an element, bitwise ORing, and th

Re: [Qemu-devel] [PATCH v3 23/29] bitmap: add atomic set functions

2015-05-27 Thread Fam Zheng
On Tue, 05/26 18:54, Paolo Bonzini wrote: > From: Stefan Hajnoczi > > Use atomic_or() for atomic bitmaps where several threads may set bits at > the same time. This avoids the race condition between threads loading > an element, bitwise ORing, and then storing the element. > > When setting all

[Qemu-devel] [PATCH v3 23/29] bitmap: add atomic set functions

2015-05-26 Thread Paolo Bonzini
From: Stefan Hajnoczi Use atomic_or() for atomic bitmaps where several threads may set bits at the same time. This avoids the race condition between threads loading an element, bitwise ORing, and then storing the element. When setting all bits in a word we can avoid atomic ops and instead just