Re: [Qemu-devel] [PATCH v2 1/4] exec: Atomic access to bounce buffer

2015-03-13 Thread Paolo Bonzini
On 13/03/2015 09:32, Paolo Bonzini wrote: > > > On 13/03/2015 09:16, Fam Zheng wrote: >> +if (atomic_cmpxchg(&bounce.in_use, false, true)) { atomic_or is enough... >> atomic_cmpxchg is here to take the ownership of bounce iff it is not in use, >> so >> I think it is neces

Re: [Qemu-devel] [PATCH v2 1/4] exec: Atomic access to bounce buffer

2015-03-13 Thread Fam Zheng
On Fri, 03/13 09:32, Paolo Bonzini wrote: > > > On 13/03/2015 09:16, Fam Zheng wrote: > >>> > > +if (atomic_cmpxchg(&bounce.in_use, false, true)) { > >> > > >> > atomic_or is enough... > > atomic_cmpxchg is here to take the ownership of bounce iff it is not in > > use, so > > I think it

Re: [Qemu-devel] [PATCH v2 1/4] exec: Atomic access to bounce buffer

2015-03-13 Thread Paolo Bonzini
On 13/03/2015 09:16, Fam Zheng wrote: >>> > > +if (atomic_cmpxchg(&bounce.in_use, false, true)) { >> > >> > atomic_or is enough... > atomic_cmpxchg is here to take the ownership of bounce iff it is not in use, > so > I think it is necessary. It's changing false to true and true to true

Re: [Qemu-devel] [PATCH v2 1/4] exec: Atomic access to bounce buffer

2015-03-13 Thread Fam Zheng
On Fri, 03/13 09:09, Paolo Bonzini wrote: > > > On 13/03/2015 02:38, Fam Zheng wrote: > > There could be a race condition when two processes call > > address_space_map concurrently and both want to use the bounce buffer. > > > > Add an in_use flag in BounceBuffer to sync it. > > > > Signed-off-

Re: [Qemu-devel] [PATCH v2 1/4] exec: Atomic access to bounce buffer

2015-03-13 Thread Paolo Bonzini
On 13/03/2015 02:38, Fam Zheng wrote: > There could be a race condition when two processes call > address_space_map concurrently and both want to use the bounce buffer. > > Add an in_use flag in BounceBuffer to sync it. > > Signed-off-by: Fam Zheng > --- > exec.c | 5 - > 1 file changed,

[Qemu-devel] [PATCH v2 1/4] exec: Atomic access to bounce buffer

2015-03-12 Thread Fam Zheng
There could be a race condition when two processes call address_space_map concurrently and both want to use the bounce buffer. Add an in_use flag in BounceBuffer to sync it. Signed-off-by: Fam Zheng --- exec.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec