qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Peter Lieven <pl@kamp.de>
Cc: kwolf@redhat.com, pbonzini@redhat.com, owasserm@redhat.com,
	qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCHv3] block-migration: efficiently encode zero blocks
Date: Thu, 18 Jul 2013 13:03:30 +0800	[thread overview]
Message-ID: <20130718050330.GA26971@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1373885705-13722-1-git-send-email-pl@kamp.de>

On Mon, Jul 15, 2013 at 12:55:05PM +0200, Peter Lieven wrote:
> @@ -114,16 +115,29 @@ static void blk_mig_unlock(void)
>  static void blk_send(QEMUFile *f, BlkMigBlock * blk)
>  {
>      int len;
> +    uint64_t flags = BLK_MIG_FLAG_DEVICE_BLOCK;
> +
> +    if (migrate_zero_blocks() && buffer_is_zero(blk->buf, BLOCK_SIZE)) {
[...]
> +bool migrate_zero_blocks(void)
> +{
> +    MigrationState *s;
> +
> +    s = migrate_get_current();
> +
> +    return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS];
> +}

blk_send() is called without locks held.  It would be safer and cleaner
to stash bool migrate_zero_blocks in BlkMigBlock in init_blk_migration()
instead of accessing migrate_get_current() without locks held.

This eliminates the assumption that accessing migrate_get_current() is
safe without locks.

Besides this locking issue I'm happy with the code.

Stefan

  parent reply	other threads:[~2013-07-18  5:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15 10:55 [Qemu-devel] [PATCHv3] block-migration: efficiently encode zero blocks Peter Lieven
2013-07-15 21:27 ` Eric Blake
2013-07-16  7:10   ` Peter Lieven
2013-07-18  5:03 ` Stefan Hajnoczi [this message]
2013-07-18  6:02   ` Peter Lieven

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=20130718050330.GA26971@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=owasserm@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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).