qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: Jianjun Duan <duanj@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, dmitry@daynix.com,
	peter.maydell@linaro.org, kraxel@redhat.com, mst@redhat.com,
	david@gibson.dropbear.id.au, pbonzini@redhat.com,
	veroniabahaa@gmail.com, amit.shah@redhat.com, mreitz@redhat.com,
	kwolf@redhat.com, rth@twiddle.net, aurelien@aurel32.net,
	leon.alrae@imgtec.com, blauwirbel@gmail.com,
	mark.cave-ayland@ilande.co.uk, mdroth@linux.vnet.ibm.com,
	dgilbert@redhat.com
Subject: Re: [Qemu-devel] [QEMU PATCH v10 1/3] migration: extend VMStateInfo
Date: Thu, 03 Nov 2016 11:18:52 +0100	[thread overview]
Message-ID: <87oa1w6f3n.fsf@emacs.mitica> (raw)
In-Reply-To: <edfd2532-12eb-a0f9-61bc-67d3459a16a7@linux.vnet.ibm.com> (Jianjun Duan's message of "Wed, 2 Nov 2016 09:54:51 -0700")

Jianjun Duan <duanj@linux.vnet.ibm.com> wrote:
> On 11/02/2016 03:40 AM, Juan Quintela wrote:
>> Jianjun Duan <duanj@linux.vnet.ibm.com> wrote:
>>> Current migration code cannot handle some data structures such as
>>> QTAILQ in qemu/queue.h. Here we extend the signatures of put/get
>>> in VMStateInfo so that customized handling is supported.
>>>
>>> Signed-off-by: Jianjun Duan <duanj@linux.vnet.ibm.com>
>> 
>>> +/* VMStateInfo allows customized migration of objects that don't fit in
>>> + * any category in VMStateFlags. Additional information can be passed
>>> + * into get and put in terms of field and vmdesc parameters.
>>> + * For primitive data types such as integer, field and vmdesc parameters
>>> + * should be ignored inside get/put. */
>>>  struct VMStateInfo {
>>>      const char *name;
>>> -    int (*get)(QEMUFile *f, void *pv, size_t size);
>>> -    void (*put)(QEMUFile *f, void *pv, size_t size);
>>> +    int (*get)(QEMUFile *f, void *pv, size_t size, VMStateField *field);
>>> +    void (*put)(QEMUFile *f, void *pv, size_t size, VMStateField *field,
>>> +                QJSON *vmdesc);
>> 
>> If we are changing put type, I would like to add an error value to it.
>> 
> so we change the return type to int?

Yeap.  Right now it is impossible to return errors.  If we change the
prototype, better to just add the return of the error, and that
everything return  0 for now.

Thanks, Juan.

>>>  static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
>>>                                      void *opaque, QJSON *vmdesc);
>>> @@ -83,6 +84,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
>>>  
>>>      trace_vmstate_load_state(vmsd->name, version_id);
>>>      if (version_id > vmsd->version_id) {
>>> +        error_report("%s %s",  vmsd->name, "too new");
>>>          trace_vmstate_load_state_end(vmsd->name, "too new", -EINVAL);
>>>          return -EINVAL;
>>>      }
>>> @@ -93,6 +95,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
>>>              trace_vmstate_load_state_end(vmsd->name, "old path", ret);
>>>              return ret;
>>>          }
>>> +        error_report("%s %s",  vmsd->name, "too old");
>>>          trace_vmstate_load_state_end(vmsd->name, "too old", -EINVAL);
>>>          return -EINVAL;
>>>      }
>> 
>> This two are good, but don't belong to this patch, please sent separately.
>> 
> OK.
>>> @@ -122,8 +125,10 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
>>>                      ret = vmstate_load_state(f, field->vmsd, addr,
>>>                                               field->vmsd->version_id);
>>>                  } else {
>>> -                    ret = field->info->get(f, addr, size);
>>> -
>>> +                    /* field is always passed in. But it should be ignored by
>>> +                     * get when not needed. It is only needed in cases* of
>>> +                     * customized handling, such as migrating QTAILQ. */
>>> +                    ret = field->info->get(f, addr, size, field);
>> 
>> I would not put this comment here, better on the header when the field
>> is declared?  Same for the next one.
>> 
> OK.
>
> Thanks,
> Jianjun
>>>                  }
>>>                  if (ret >= 0) {
>>>                      ret = qemu_file_get_error(f);
>>> @@ -328,7 +333,11 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
>>>                  if (field->flags & VMS_STRUCT) {
>>>                      vmstate_save_state(f, field->vmsd, addr, vmdesc_loop);
>>>                  } else {
>>> -                    field->info->put(f, addr, size);
>>> +                    /* field and vmdesc_loop are always passed in. But they
>>> +                     * should be ignored by put when not needed. They are
>>> +                     * only needed in cases f customized handling, such as
>>> +                     * migrating QTAILQ. */
>>> +                    field->info->put(f, addr, size, field, vmdesc_loop);
>>>                  }
>> 
>> 
>> Rest of patch is ok.
>> 

  reply	other threads:[~2016-11-03 10:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-31 19:53 [Qemu-devel] [QEMU PATCH v10 0/3] migration: migrate QTAILQ Jianjun Duan
2016-10-31 19:53 ` [Qemu-devel] [QEMU PATCH v10 1/3] migration: extend VMStateInfo Jianjun Duan
2016-11-02 10:40   ` Juan Quintela
2016-11-02 16:54     ` Jianjun Duan
2016-11-03 10:18       ` Juan Quintela [this message]
2016-10-31 19:53 ` [Qemu-devel] [QEMU PATCH v10 2/3] migration: migrate QTAILQ Jianjun Duan
2016-11-02 10:45   ` Juan Quintela
2016-11-02 16:38     ` Paolo Bonzini
2016-11-03 11:14       ` Halil Pasic
2016-11-03 11:32         ` Halil Pasic
2016-11-02 17:05     ` Jianjun Duan
2016-10-31 19:53 ` [Qemu-devel] [QEMU PATCH v10 3/3] tests/migration: Add test for QTAILQ migration Jianjun Duan
2016-11-02 10:47   ` Juan Quintela
2016-11-03 12:22     ` Halil Pasic
2016-11-03 16:47       ` Jianjun Duan
2016-11-03 17:17         ` Halil Pasic
2016-11-03 18:40           ` Jianjun Duan
2016-11-03 18:51             ` Halil Pasic

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=87oa1w6f3n.fsf@emacs.mitica \
    --to=quintela@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=aurelien@aurel32.net \
    --cc=blauwirbel@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=dgilbert@redhat.com \
    --cc=dmitry@daynix.com \
    --cc=duanj@linux.vnet.ibm.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=leon.alrae@imgtec.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=veroniabahaa@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 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).