qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>,
	amit.shah@redhat.com, cornelia.huck@del.ibm.com,
	quintela@redhat.com, qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 12/13] virtio-gpu: Wrap in vmstate
Date: Tue, 12 Jul 2016 17:09:57 +0200	[thread overview]
Message-ID: <1468336197.30552.16.camel@redhat.com> (raw)
In-Reply-To: <20160712160236.57c4a2b4.cornelia.huck@de.ibm.com>

On Di, 2016-07-12 at 16:02 +0200, Cornelia Huck wrote:
> On Tue, 12 Jul 2016 15:54:57 +0200
> Gerd Hoffmann <kraxel@redhat.com> wrote:
> 
> > > @@ -1170,9 +1166,6 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
> > >  
> > >      if (virtio_gpu_virgl_enabled(g->conf)) {
> > >          vmstate_register(qdev, -1, &vmstate_virtio_gpu_unmigratable, g);
> > > -    } else {
> > > -        register_savevm(qdev, "virtio-gpu", -1, VIRTIO_GPU_VM_VERSION,
> > > -                        virtio_gpu_save, virtio_gpu_load, g);
> > >      }
> > >  }
> > >  
> > > @@ -1220,6 +1213,9 @@ static void virtio_gpu_reset(VirtIODevice *vdev)
> > >  #endif
> > >  }
> > >  
> > > +VMSTATE_VIRTIO_DEVICE(gpu, VIRTIO_GPU_VM_VERSION, virtio_gpu_load,
> > > +                      virtio_gpu_save);
> > > +
> > >  static Property virtio_gpu_properties[] = {
> > >      DEFINE_PROP_UINT32("max_outputs", VirtIOGPU, conf.max_outputs, 1),
> > >  #ifdef CONFIG_VIRGL
> > > @@ -1245,6 +1241,7 @@ static void virtio_gpu_class_init(ObjectClass *klass, void *data)
> > >      vdc->reset = virtio_gpu_reset;
> > >  
> > >      dc->props = virtio_gpu_properties;
> > > +    dc->vmsd = &vmstate_virtio_gpu;
> > >  }
> > >  
> > >  static const TypeInfo virtio_gpu_info = {
> > 
> > This is confusing.  I think for the virtio_gpu_virgl_enabled() case we
> > install *two* vmstates now ...
> 
> I don't think that matters, as the unmigratable state already blocks,
> no?

As long the core isn't confused if we register twice for the same device
it should work, yes ...

> > I think you should move up VMSTATE_VIRTIO_DEVICE, then simply replace
> > the register_savevm() call with a vmstate_register() call.
> 
> It would make virtio-gpu look different from all other devices, though.

Sure, because depending on device configuration you can migrate it or
not, which isn't the case for all other devices.

I'd prefer to have the logic for that in one place as it makes more
clear how things are working:  "if (!migrateable) register(block) else
register(normal);"

cheers,
  Gerd

  reply	other threads:[~2016-07-12 15:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12 12:19 [Qemu-devel] [PATCH v2 00/13] virtio migration: Flip outer layer to vmstate Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 01/13] virtio-net: Remove old migration version support Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 02/13] virtio-serial: " Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 03/13] virtio: Migration helper function and macro Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 04/13] virtio-scsi: Wrap in vmstate Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 05/13] virtio-blk: " Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 06/13] virtio-rng: " Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 07/13] virtio-balloon: " Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 08/13] virtio-net: " Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 09/13] virtio-serial: " Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 10/13] 9pfs: " Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 11/13] virtio-input: " Dr. David Alan Gilbert (git)
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 12/13] virtio-gpu: " Dr. David Alan Gilbert (git)
2016-07-12 13:54   ` Gerd Hoffmann
2016-07-12 14:02     ` Cornelia Huck
2016-07-12 15:09       ` Gerd Hoffmann [this message]
2016-07-12 15:12         ` Dr. David Alan Gilbert
2016-07-14 16:04         ` Dr. David Alan Gilbert
2016-07-15  9:53           ` Gerd Hoffmann
2016-07-12 12:19 ` [Qemu-devel] [PATCH v2 13/13] virtio: Update migration docs Dr. David Alan Gilbert (git)

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=1468336197.30552.16.camel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=cornelia.huck@del.ibm.com \
    --cc=dgilbert@redhat.com \
    --cc=mst@redhat.com \
    --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).