qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org
Cc: den@openvz.org
Subject: Re: [Qemu-devel] [PATCH] nbd: strict nbd_wr_syncv
Date: Tue, 16 May 2017 12:19:32 +0200	[thread overview]
Message-ID: <ea800bcc-858e-b5cd-dd25-f3241d1f2c0a@redhat.com> (raw)
In-Reply-To: <a746364c-2c7c-9cb6-b7e2-b27d42e035b3@virtuozzo.com>



On 16/05/2017 12:16, Vladimir Sementsov-Ogievskiy wrote:
> 16.05.2017 12:51, Paolo Bonzini wrote:
>>
>> On 16/05/2017 11:32, Vladimir Sementsov-Ogievskiy wrote:
>>> 16.05.2017 12:10, Vladimir Sementsov-Ogievskiy wrote:
>>>> 15.05.2017 12:43, Vladimir Sementsov-Ogievskiy wrote:
>>>>> I mean, make negotiation behave like normal nbd communication,
>>>>> non-blocking socket + yield.. So, some other coroutines may do their
>>>>> work, while nbd-negotiation coroutine waits for io..
>> Some callers of bdrv_open may not allow reentrancy.  For example:
>>
>>     handle_qmp_command
>>     -> qmp_dispatch
>>     -> do_qmp_dispatch
>>     -> qmp_marshal_blockdev_add
>>     -> qmp_blockdev_add
>>     -> bds_tree_init
>>     -> bdrv_open
>>
>> You cannot return to the monitor before qmp_blockdev_add is done,
>> otherwise you don't have a return value for handle_qmp_command to pass
>> to monitor_json_emitter.
> 
> Hmm. What about something like bdrv_pread (finally, bdrv_prwv_co) for
> non-coroutine, ie, calling aio_poll in a while loop, until coroutine
> finishes?

Yes, of course that would work: you create a coroutine, and wrap it with
aio_poll until it completes.

Paolo

>>
>>>> Also, one more question here: in nbd_negotiate_write(), why do we need
>>>> qio_channel_add_watch? write_sync will yield with qio_channel_yield()
>>>> until io complete, why to use 2 mechanisms to wake up a coroutine?
>>> Hmm, these nbd_negotiate_* functions was introduced in 1a6245a5b, when
>>> nbd_wr_syncv was working through qemu_co_sendv_recvv, which just yields,
>>> without setting any handlers. But now, nbd_wr_syncv works through
>>> qio_channel_yield() which sets handlers, so the code with extra watchers
>>> looks wrong.
>> Yes, I think you're right about that.
> 
> Ok, I'll make a patch for it and finish LOG->errp conversion.
> 
>>
>> Paolo
> 
> 

      reply	other threads:[~2017-05-16 10:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12 14:17 [Qemu-devel] [PATCH] nbd: strict nbd_wr_syncv Vladimir Sementsov-Ogievskiy
2017-05-12 15:46 ` Paolo Bonzini
2017-05-12 15:57   ` Vladimir Sementsov-Ogievskiy
2017-05-12 16:30     ` Paolo Bonzini
2017-05-15  9:43       ` Vladimir Sementsov-Ogievskiy
2017-05-16  9:10         ` Vladimir Sementsov-Ogievskiy
2017-05-16  9:32           ` Vladimir Sementsov-Ogievskiy
2017-05-16  9:51             ` Paolo Bonzini
2017-05-16 10:16               ` Vladimir Sementsov-Ogievskiy
2017-05-16 10:19                 ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea800bcc-858e-b5cd-dd25-f3241d1f2c0a@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=den@openvz.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).