qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kwolf@redhat.com, lersek@redhat.com, jsnow@redhat.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] efi var store migration assert (bdrv_co_do_pwritev: Assertion `!(bs->open_flags & 0x0800)' failed.)
Date: Tue, 5 Apr 2016 11:48:14 +0100	[thread overview]
Message-ID: <20160405104813.GB2242@work-vm> (raw)
In-Reply-To: <570244B3.4070105@redhat.com>

* Paolo Bonzini (pbonzini@redhat.com) wrote:
> 
> 
> On 01/04/2016 19:58, Dr. David Alan Gilbert wrote:
> > In the continuing journeys of trying to migrate a q35 guest with ovmf,
> > I've just hit this assert:
> > 
> > qemu-system-x86_64: /root/git/qemu/block/io.c:1297: bdrv_co_do_pwritev: Assertion `!(bs->open_flags & 0x0800)' failed.
> > 
> > This is just ahead of rc0 - 1458317c8ada834cf39287f6d11a8cb8a37360d6 from yesterday.
> 
> Try this...

Well, migration survives; how do I test if pflash is sane after migration?

Dave

> Paolo
> 
> diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
> index c475c2a..e96a7b0 100644
> --- a/hw/block/pflash_cfi01.c
> +++ b/hw/block/pflash_cfi01.c
> @@ -46,6 +46,7 @@
>  #include "exec/address-spaces.h"
>  #include "qemu/host-utils.h"
>  #include "hw/sysbus.h"
> +#include "sysemu/sysemu.h"
>  
>  #define PFLASH_BUG(fmt, ...) \
>  do { \
> @@ -97,6 +98,7 @@ struct pflash_t {
>      MemoryRegion mem;
>      char *name;
>      void *storage;
> +    VMChangeStateEntry *vmstate;
>  };
>  
>  static int pflash_post_load(void *opaque, int version_id);
> @@ -944,13 +946,24 @@ MemoryRegion *pflash_cfi01_get_memory(pflash_t *fl)
>      return &fl->mem;
>  }
>  
> +static void postload_update_cb(void *opaque, int running, RunState state)
> +{
> +    pflash_t *pfl = opaque;
> +
> +    /* This is called after bdrv_invalidate_cache_all.  */
> +    qemu_del_vm_change_state_handler(pfl->vmstate);
> +    pfl->vmstate = NULL;
> +
> +    DPRINTF("%s: updating bdrv for %s\n", __func__, pfl->name);
> +    pflash_update(pfl, 0, pfl->sector_len * pfl->nb_blocs);
> +}
> +
>  static int pflash_post_load(void *opaque, int version_id)
>  {
>      pflash_t *pfl = opaque;
>  
>      if (!pfl->ro) {
> -        DPRINTF("%s: updating bdrv for %s\n", __func__, pfl->name);
> -        pflash_update(pfl, 0, pfl->sector_len * pfl->nb_blocs);
> +        pfl->vmstate = qemu_add_vm_change_state_handler(postload_update_cb, pfl);
>      }
>      return 0;
>  }
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2016-04-05 10:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 17:58 [Qemu-devel] efi var store migration assert (bdrv_co_do_pwritev: Assertion `!(bs->open_flags & 0x0800)' failed.) Dr. David Alan Gilbert
2016-04-04 10:40 ` Paolo Bonzini
2016-04-05 10:48   ` Dr. David Alan Gilbert [this message]
2016-04-05 10:58     ` Laszlo Ersek
2016-04-05 11:25       ` Dr. David Alan Gilbert
2016-04-05 11:34         ` Laszlo Ersek
2016-04-05 13:06     ` Paolo Bonzini
2016-04-14 15:30   ` Peter Maydell
2016-04-15 10:49     ` 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=20160405104813.GB2242@work-vm \
    --to=dgilbert@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lersek@redhat.com \
    --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).