qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Paolo Bonzini <pbonzini@redhat.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:10:53 +0300	[thread overview]
Message-ID: <e86ebf22-66ac-759c-c726-390daa2933c2@virtuozzo.com> (raw)
In-Reply-To: <858a4c56-1f9c-b7a3-fd73-34e4c8b59953@virtuozzo.com>

15.05.2017 12:43, Vladimir Sementsov-Ogievskiy wrote:
> 12.05.2017 19:30, Paolo Bonzini wrote:
>>
>> On 12/05/2017 17:57, Vladimir Sementsov-Ogievskiy wrote:
>>> 12.05.2017 18:46, Paolo Bonzini wrote:
>>>> On 12/05/2017 16:17, Vladimir Sementsov-Ogievskiy wrote:
>>>>> nbd_wr_syncv is called either from coroutine or from client 
>>>>> negotiation
>>>>> code, when socket is in blocking mode. So, -EAGAIN is impossible.
>>>>>
>>>>> Furthermore, EAGAIN is confusing, as, what to read/write again? With
>>>>> EAGAIN as a return code we don't know how much data is already
>>>>> read or written by the function, so in case of EAGAIN the whole
>>>>> communication is broken.
>>>>>
>>>>> Signed-off-by: Vladimir Sementsov-Ogievskiy 
>>>>> <vsementsov@virtuozzo.com>
>>>>> ---
>>>>>
>>>>> Hi all!
>>>>>
>>>>> If I understand right, nbd_wr_syncv is called either from coroutine
>>>>> or from client negotiation code, when socket is in blocking mode.
>>>>> So, some thoughts
>>>>>
>>>>> 1. let's establish this with an assert, because returning EAGAIN is
>>>>>      confusing (see above)
>>>> Yes, this seems like a good idea.
>>>>
>>>>> 2. should we in case of non-coroutine context start this coroutine in
>>>>>      nbd_wr_syncv, like in bdrv_prwv_co, and use non-blocking mode?
>>>>> 3. is there any problems or disadvantages of moving client 
>>>>> negotiation
>>>>>      to coroutine too?
>>>> When you move code to coroutines you need to be aware of what code can
>>>> now run concurrently, for example the monitor.  I'm not sure that it's
>>>> possible to do this.
>>> Hmm, can you please give some example of a problem? qcow2_open starts
>>> coroutines to read it's header, why nbd_open can't start
>>> coroutine/coroutines to read/write some negotiation data?
>> Ah, it's not a problem if you use synchronous I/O (aio_poll) within the
>> coroutines.  But then it's still blocking I/O in every way (except
>> you've fcntl-ed the descriptor to make it non-blocking); it's simply
>> hidden underneath coroutines and aio_poll.
>
> 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..
>
>>
>> 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?


-- 
Best regards,
Vladimir

  reply	other threads:[~2017-05-16  9:11 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 [this message]
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

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=e86ebf22-66ac-759c-c726-390daa2933c2@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).