All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	qemu block <qemu-block@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 0/3] block: pause block jobs for bdrv_drain_begin/end
Date: Tue, 28 Mar 2017 20:26:13 +0800	[thread overview]
Message-ID: <20170328122613.GD5207@lemon.lan> (raw)
In-Reply-To: <20170324152755.GR12560@stefanha-x1.localdomain>

On Fri, 03/24 15:27, Stefan Hajnoczi wrote:
> On Thu, Mar 23, 2017 at 06:57:14PM +0100, Paolo Bonzini wrote:
> > 
> > 
> > On 23/03/2017 18:44, Stefan Hajnoczi wrote:
> > >> It's possible to wedge QEMU if the guest tries to reset a virtio-pci
> > >> device as QEMU is also using the drive for a blockjob. This patchset
> > >> aims to allow us to safely pause/resume jobs attached to individual
> > >> nodes in a manner similar to how bdrv_drain_all_begin/end do.
> > > 
> > > Weird, I thought the 0 nanosecond sleep that block jobs do in their
> > > main loop allows aio_poll() loops to finish.
> > 
> > The 0 nanosecond sleep is now done in the BDS AioContext rather than in 
> > the "non-aio_poll-aware" main loop:
> > 
> >     commit 0b9caf9b3166c8deb3c4f3a774c2384b069dc29c
> >     Author: Fam Zheng <famz@redhat.com>
> >     Date:   Tue Aug 26 15:15:43 2014 +0800
> > 
> >     coroutine: Drop co_sleep_ns
> >     
> >     block_job_sleep_ns is the only user. Since we are moving towards
> >     AioContext aware code, it's better to use the explicit version and drop
> >     the old one.
> >     
> >     Signed-off-by: Fam Zheng <famz@redhat.com>
> >     Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>
> >     Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> But we hold the AioContext lock and are calling aio_poll(), so I would
> expect our loop to terminate.  The blockjob coroutine should still be
> leaving this little gap in activity during which the aio_poll() loop
> finishes.

I am not sure, but at each gap, aio_poll() is free to fire the 0 nanosecond
sleep timer cb already, which will generate more I/O. The correct thing is, like
in this series, set the pause flag.

Fam

      reply	other threads:[~2017-03-28 12:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16 21:23 [Qemu-devel] [PATCH v2 0/3] block: pause block jobs for bdrv_drain_begin/end John Snow
2017-03-16 21:23 ` [Qemu-devel] [PATCH v2 1/3] blockjob: add block_job_start_shim John Snow
2017-03-22 12:57   ` Jeff Cody
2017-03-22 15:58     ` Jeff Cody
2017-03-16 21:23 ` [Qemu-devel] [PATCH v2 2/3] block-backend: add drained_begin / drained_end ops John Snow
2017-03-22 16:04   ` Jeff Cody
2017-03-16 21:23 ` [Qemu-devel] [PATCH v2 3/3] blockjob: add devops to blockjob backends John Snow
2017-03-22 16:11   ` Jeff Cody
2017-03-16 21:28 ` [Qemu-devel] [PATCH v2 0/3] block: pause block jobs for bdrv_drain_begin/end no-reply
2017-03-22 15:37   ` John Snow
2017-03-22 16:01     ` Jeff Cody
2017-03-22 16:05       ` John Snow
2017-03-22 16:16         ` Jeff Cody
2017-03-22 17:22   ` Jeff Cody
2017-03-23 17:44 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-03-23 17:57   ` Paolo Bonzini
2017-03-24 15:27     ` Stefan Hajnoczi
2017-03-28 12:26       ` Fam Zheng [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=20170328122613.GD5207@lemon.lan \
    --to=famz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.