Re: [Qemu-devel] [PATCH v3] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-08 Thread Stefan Hajnoczi
On Wed, Nov 08, 2017 at 05:32:23PM +0300, Pavel Butsykin wrote: > On 08.11.2017 17:24, Sergio Lopez wrote: > > On Wed, Nov 8, 2017 at 3:15 PM, Paolo Bonzini wrote: > > > On 08/11/2017 15:10, Sergio Lopez wrote: > > > > > I'm not quite sure that the pre-fetched is involved in this issue, > > > > >

Re: [Qemu-devel] [PATCH v3] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-08 Thread Pavel Butsykin
On 08.11.2017 17:15, Paolo Bonzini wrote: On 08/11/2017 15:10, Sergio Lopez wrote: I'm not quite sure that the pre-fetched is involved in this issue, because pre-fetch reading a certain addresses should be invalidated by write on another core to the same addresses. In our case write req->state

Re: [Qemu-devel] [PATCH v3] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-08 Thread Pavel Butsykin
On 08.11.2017 17:24, Sergio Lopez wrote: On Wed, Nov 8, 2017 at 3:15 PM, Paolo Bonzini wrote: On 08/11/2017 15:10, Sergio Lopez wrote: I'm not quite sure that the pre-fetched is involved in this issue, because pre-fetch reading a certain addresses should be invalidated by write on another core

Re: [Qemu-devel] [PATCH v3] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-08 Thread Sergio Lopez
On Wed, Nov 8, 2017 at 3:15 PM, Paolo Bonzini wrote: > On 08/11/2017 15:10, Sergio Lopez wrote: >>> I'm not quite sure that the pre-fetched is involved in this issue, >>> because pre-fetch reading a certain addresses should be invalidated by >>> write on another core to the same addresses. In our

Re: [Qemu-devel] [PATCH v3] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-08 Thread Paolo Bonzini
On 08/11/2017 15:10, Sergio Lopez wrote: >> I'm not quite sure that the pre-fetched is involved in this issue, >> because pre-fetch reading a certain addresses should be invalidated by >> write on another core to the same addresses. In our case write >> req->state = THREAD_DONE should invalidate re

Re: [Qemu-devel] [PATCH v3] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-08 Thread Sergio Lopez
On Wed, Nov 8, 2017 at 2:50 PM, Pavel Butsykin wrote: > On 08.11.2017 09:34, Sergio Lopez wrote: >> This was considered to be safe, as the completion function restarts the >> loop just after the call to qemu_bh_cancel. But, under certain access >> patterns and scheduling conditions, the loop may w

Re: [Qemu-devel] [PATCH v3] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-08 Thread Pavel Butsykin
On 08.11.2017 09:34, Sergio Lopez wrote: Commit b7a745d added a qemu_bh_cancel call to the completion function as an optimization to prevent it from unnecessarily rescheduling itself. This completion function is scheduled from worker_thread, after setting the state of a ThreadPoolElement to THRE

[Qemu-devel] [PATCH v3] util/async: use atomic_mb_set in qemu_bh_cancel

2017-11-07 Thread Sergio Lopez
Commit b7a745d added a qemu_bh_cancel call to the completion function as an optimization to prevent it from unnecessarily rescheduling itself. This completion function is scheduled from worker_thread, after setting the state of a ThreadPoolElement to THREAD_DONE. This was considered to be safe, a