[Qemu-devel] [PATCH] aio: strengthen memory barriers for bottom half scheduling

2015-04-09 Thread Paolo Bonzini
There are two problems with memory barriers in async.c. The fix is to use atomic_xchg in order to achieve sequential consistency between the scheduling of a bottom half and the corresponding execution. First, if bh-scheduled is already 1 in qemu_bh_schedule, QEMU does not execute a memory

Re: [Qemu-devel] [PATCH] aio: strengthen memory barriers for bottom half scheduling

2015-04-09 Thread Stefan Hajnoczi
On Thu, Apr 09, 2015 at 11:21:10AM +0200, Paolo Bonzini wrote: There are two problems with memory barriers in async.c. The fix is to use atomic_xchg in order to achieve sequential consistency between the scheduling of a bottom half and the corresponding execution. First, if bh-scheduled is

Re: [Qemu-devel] [PATCH] aio: strengthen memory barriers for bottom half scheduling

2015-04-08 Thread Richard W.M. Jones
On Tue, Apr 07, 2015 at 05:16:19PM +0200, Paolo Bonzini wrote: This bug is, most likely, also the cause of failures in the libguestfs testsuite on AArch64. I'm afraid I have to agree with Laszlo, that this patch unfortunately does not cure the aarch64 race. The test case I'm using is:

Re: [Qemu-devel] [PATCH] aio: strengthen memory barriers for bottom half scheduling

2015-04-08 Thread Laszlo Ersek
On 04/08/15 12:15, Richard W.M. Jones wrote: On Tue, Apr 07, 2015 at 05:16:19PM +0200, Paolo Bonzini wrote: This bug is, most likely, also the cause of failures in the libguestfs testsuite on AArch64. I'm afraid I have to agree with Laszlo, that this patch unfortunately does not cure the

Re: [Qemu-devel] [PATCH] aio: strengthen memory barriers for bottom half scheduling

2015-04-08 Thread Laszlo Ersek
On 04/07/15 20:20, Leveille, Paul wrote: Paolo, I've applied your patch in place of my prototype patch and, as expected, it's working fine. Thanks! I also tested the patch (on top of 5a24f20a72), and on aarch64 it doesn't fix the hang. If there's interest, I can write up the reproducer

Re: [Qemu-devel] [PATCH] aio: strengthen memory barriers for bottom half scheduling

2015-04-08 Thread Leveille, Paul
Paolo, I've applied your patch in place of my prototype patch and, as expected, it's working fine. Thanks! -Original Message- From: Paolo Bonzini [mailto:pbonz...@redhat.com] Sent: Tuesday, April 07, 2015 11:16 AM To: qemu-devel@nongnu.org Cc: ler...@redhat.com; Leveille, Paul;

Re: [Qemu-devel] [PATCH] aio: strengthen memory barriers for bottom half scheduling

2015-04-08 Thread Stefan Hajnoczi
On Tue, Apr 7, 2015 at 4:16 PM, Paolo Bonzini pbonz...@redhat.com wrote: There are two problems with memory barriers in async.c. The fix is to use atomic_xchg in order to achieve sequential consistency between the scheduling of a bottom half and the corresponding execution. First, if

[Qemu-devel] [PATCH] aio: strengthen memory barriers for bottom half scheduling

2015-04-07 Thread Paolo Bonzini
There are two problems with memory barriers in async.c. The fix is to use atomic_xchg in order to achieve sequential consistency between the scheduling of a bottom half and the corresponding execution. First, if bh-scheduled is already 1 in qemu_bh_schedule, QEMU does not execute a memory