qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 05/17] block: access wakeup with at


From: Paolo Bonzini
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 05/17] block: access wakeup with atomic ops
Date: Thu, 4 May 2017 09:12:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0


On 04/05/2017 08:39, Fam Zheng wrote:
> On Thu, 04/20 14:00, Paolo Bonzini wrote:
>> Signed-off-by: Paolo Bonzini <address@hidden>
>> ---
>>  block/io.c                | 3 ++-
>>  block/nfs.c               | 4 +++-
>>  block/sheepdog.c          | 3 ++-
>>  include/block/block.h     | 5 +++--
>>  include/block/block_int.h | 4 ++--
>>  5 files changed, 12 insertions(+), 7 deletions(-)
>>
>> diff --git a/block/io.c b/block/io.c
>> index 869322a..3b2ede9 100644
>> --- a/block/io.c
>> +++ b/block/io.c
>> @@ -501,7 +501,8 @@ static void dummy_bh_cb(void *opaque)
>>  
>>  void bdrv_wakeup(BlockDriverState *bs)
>>  {
>> -    if (bs->wakeup) {
>> +    /* The barrier (or an atomic op) is in the caller.  */
> 
> Why not add a barrier here so that callers don't need to worry about that?

Barriers are relatively expensive, and the common case is

dataplane7:block/io.c-void bdrv_dec_in_flight(BlockDriverState *bs)
dataplane7:block/io.c-{
dataplane7:block/io.c-    atomic_dec(&bs->in_flight);
dataplane7:block/io.c:    bdrv_wakeup(bs);
dataplane7:block/io.c-}

Paolo

>> +    if (atomic_read(&bs->wakeup)) {
>>          aio_bh_schedule_oneshot(qemu_get_aio_context(), dummy_bh_cb, NULL);
>>      }
>>  }
> 
> Fam
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]