qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>, Kevin Wolf <kwolf@redhat.com>,
	Jeff Cody <jcody@redhat.com>, Fam Zheng <famz@redhat.com>,
	"Jason J. Herne" <jjherne@linux.vnet.ibm.com>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 2/5] blockjob: add pause points
Date: Thu, 16 Jun 2016 14:17:37 +0100	[thread overview]
Message-ID: <CAJSP0QWer_3LpUWVWPOUBoVy-WLYxcbeRObSAs2BpAXk5L8DRg@mail.gmail.com> (raw)
In-Reply-To: <d54663a4-a9d5-cd4e-7447-350c010e2162@redhat.com>

On Wed, Jun 15, 2016 at 9:53 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 14/06/2016 20:17, Stefan Hajnoczi wrote:
>> Block jobs are coroutines that usually perform I/O but sometimes also
>> sleep or yield.  Currently only sleeping or yielded block jobs can be
>> paused.  This means jobs that do not sleep or yield (using
>> block_job_yield()) are unaffected by block_job_pause().
>>
>> Add block_job_pause_point() so that block jobs can mark quiescent points
>> that are suitable for pausing.  This solves the problem that it can take
>> a block job a long time to pause if it is performing a long series of
>> I/O operations.
>>
>> Transitioning to paused state involves a .pause()/.resume() callback.
>> These callbacks are used to ensure that I/O and event loop activity has
>> ceased while the job is at a pause point.
>>
>> Note that this patch introduces a stricter pause state than previously.
>> The job->busy flag was incorrectly documented as a quiescent state
>> without I/O pending.  This is violated by any job that has I/O pending
>> across sleep or block_job_yield(), like the mirror block job.
>
> Right, we should document job->busy as a quiescent state where no one
> will re-enter the coroutine.

That statement doesn't correspond with how it's used:

block_job_sleep_ns() leaves a timer pending and the job will re-enter
when the timer expires.  So "no one will re-enter the coroutine" is
too strict.

The important thing is it's safe to call block_job_enter().  In the
block_job_sleep_ns() case the timer is cancelled to prevent doubly
re-entry.

The doc comment I have in v4 allows the block_job_sleep_ns() case:

  /*
   * Set to false by the job while the coroutine has yielded and may be
   * re-entered by block_job_enter().  There may still be I/O or event loop
   * activity pending.
   */
  bool busy;

Stefan

  reply	other threads:[~2016-06-16 13:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 18:17 [Qemu-devel] [PATCH v4 0/5] blockjob: AioContext change support for mirror and backup Stefan Hajnoczi
2016-06-14 18:17 ` [Qemu-devel] [PATCH v4 1/5] blockjob: move iostatus reset out of block_job_enter() Stefan Hajnoczi
2016-06-15  8:47   ` Fam Zheng
2016-06-14 18:17 ` [Qemu-devel] [PATCH v4 2/5] blockjob: add pause points Stefan Hajnoczi
2016-06-15  8:53   ` Paolo Bonzini
2016-06-16 13:17     ` Stefan Hajnoczi [this message]
2016-06-16 13:24       ` Paolo Bonzini
2016-06-15  8:57   ` Fam Zheng
2016-06-15  9:01     ` Paolo Bonzini
2016-06-16 10:19     ` Stefan Hajnoczi
2016-06-14 18:17 ` [Qemu-devel] [PATCH v4 3/5] blockjob: add AioContext attached callback Stefan Hajnoczi
2016-06-15  9:05   ` Fam Zheng
2016-06-16 10:13     ` Stefan Hajnoczi
2016-06-14 18:17 ` [Qemu-devel] [PATCH v4 4/5] mirror: follow AioContext change gracefully Stefan Hajnoczi
2016-06-15  8:57   ` Paolo Bonzini
2016-06-16 10:17     ` Stefan Hajnoczi
2016-06-16 10:21       ` Paolo Bonzini
2016-06-16 11:28         ` Stefan Hajnoczi
2016-06-14 18:17 ` [Qemu-devel] [PATCH v4 5/5] backup: " Stefan Hajnoczi
2016-06-14 19:06 ` [Qemu-devel] [PATCH v4 0/5] blockjob: AioContext change support for mirror and backup Jason J. Herne
2016-06-15  8:56   ` Stefan Hajnoczi
2016-06-15  8:59 ` 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=CAJSP0QWer_3LpUWVWPOUBoVy-WLYxcbeRObSAs2BpAXk5L8DRg@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).