All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, patches@linaro.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] migration: Correctly handle subsections with no 'needed' function
Date: Tue, 07 Aug 2018 15:17:24 +0200	[thread overview]
Message-ID: <87muty2u57.fsf@trasno.org> (raw)
In-Reply-To: <20180807130355.29780-1-peter.maydell@linaro.org> (Peter Maydell's message of "Tue, 7 Aug 2018 14:03:55 +0100")

Peter Maydell <peter.maydell@linaro.org> wrote:
> Currently the vmstate subsection handling code treats a subsection
> with no 'needed' function pointer as if it were the subsection
> list terminator, so the subsection is never transferred and nor
> is any subsection following it in the list.
>
> Handle NULL 'needed' function pointers in subsections in the same
> way that we do for top level VMStateDescription structures:
> treat the subsection as always being needed.
>
> This doesn't change behaviour for the current set of devices
> in the tree, because all subsections declare a 'needed' function.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> NB: last para in the commit message is only true once the
> "Arm migration fixes for 3.0" patchset has been committed.
> We could optionally drop some of the "use a dummy needed fn"
> changes once this is in...
>
> I thought I'd sent this out a few days back, but apparently not,
> since it's not on-list...
>
>  migration/vmstate.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/migration/vmstate.c b/migration/vmstate.c
> index 6b9079bb51e..0bc240a3175 100644
> --- a/migration/vmstate.c
> +++ b/migration/vmstate.c
> @@ -418,7 +418,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
>  static const VMStateDescription *
>  vmstate_get_subsection(const VMStateDescription **sub, char *idstr)
>  {
> -    while (sub && *sub && (*sub)->needed) {
> +    while (sub && *sub) {
>          if (strcmp(idstr, (*sub)->name) == 0) {
>              return *sub;
>          }

Ack to this one.  Code supposed that needed was alwasy !=0.  We don't
really care on the reception side.  Good spotted.

> @@ -486,8 +486,8 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
>      int ret = 0;
>  
>      trace_vmstate_subsection_save_top(vmsd->name);
> -    while (sub && *sub && (*sub)->needed) {
> -        if ((*sub)->needed(opaque)) {
> +    while (sub && *sub) {
> +        if (vmstate_save_needed(*sub, opaque)) {
>              const VMStateDescription *vmsdsub = *sub;
>              uint8_t len;


I am not so sure about this one.  Why are we having a subsection without
a ->needed function?  I don't know why that it is useful for.  if we
don't have a needed function, then it is just better to just add that
"subsection" to the normal section, increase the version number and live
with that, no?

Later, Juan.

  reply	other threads:[~2018-08-07 13:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07 13:03 [Qemu-devel] [PATCH] migration: Correctly handle subsections with no 'needed' function Peter Maydell
2018-08-07 13:17 ` Juan Quintela [this message]
2018-08-07 13:21   ` Peter Maydell
2018-08-07 13:25     ` Peter Maydell
2018-08-07 14:32     ` Juan Quintela
2018-08-07 14:39       ` Peter Maydell
2018-08-07 14:49         ` Juan Quintela
2018-08-07 15:00           ` Peter Maydell
2018-08-07 15:05             ` Juan Quintela
2018-08-07 15:09               ` Peter Maydell
2018-08-07 15:12                 ` Dr. David Alan Gilbert
2018-08-08  7:27                 ` Juan Quintela
2018-08-08 13:47                   ` Peter Maydell
2018-08-07 13:43   ` Dr. David Alan Gilbert
2018-08-07 13:41 ` Dr. David Alan Gilbert

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=87muty2u57.fsf@trasno.org \
    --to=quintela@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.