On Tue, Dec 01, 2015 at 01:37:37PM +0100, Paolo Bonzini wrote:
> atomic_mb_{read,set} does order accesses to the variable against 
> all other accesses.  In this case I'd prefer it to smp_wmb/rmb, because 
> the writes to written_size are far from the writes to status.

Yes... It should be again all the other variables.

> 
> Compare with thread-pool.c:
> 
>         req->ret = ret;
>         /* Write ret before state.  */
>         smp_wmb();
>         req->state = THREAD_DONE;
> 
>         /* Read state before ret.  */
>         smp_rmb();
> 
>         /* Schedule ourselves in case elem->common.cb() calls aio_poll() to
>          * wait for another request that completed at the same time.
>          */
>         qemu_bh_schedule(pool->completion_bh);
> 
>         elem->common.cb(elem->common.opaque, elem->ret);
> 
> It's a matter of taste though.  What you wrote above is certainly okay
> as well.

Thanks for the explanation. Then I will choose smp_*() this time and
post v4 later.

Peter

> 
> Paolo

Reply via email to