All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Halil Pasic <pasic@linux.vnet.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	"Jason J . Herne" <jjherne@linux.vnet.ibm.com>,
	Juan Quintela <quintela@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH 2/3] vmstate: error hint for failed equal checks part 2
Date: Wed, 7 Jun 2017 12:07:59 +0100	[thread overview]
Message-ID: <20170607110758.GC2099@work-vm> (raw)
In-Reply-To: <20170606165510.33057-3-pasic@linux.vnet.ibm.com>

* Halil Pasic (pasic@linux.vnet.ibm.com) wrote:
> Verbose error reporting for the _EQUAL family. Modify the standard _EQUAL
> so the hint states the assertion probably failed due to a bug. Introduce
> _EQUAL_HINT for specifying a context specific hint.
> 
> Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>

I'd prefer not to print 'Bug!?' by default - they already get the
message telling them something didn't match and the migration fails.
There are none-bug ways of this happening, e.g. a user starting a VM on
the source and destination with different configs.

(I also worry we have a lot f macros for each size;
EQUAL, EQUAL_V, EQUAL_V_HINT but I don't know of a better answer for
that)

Dave

> ---
> Keeping this separate for now because we may want something different
> here. E.g. no new macros and adding an extra NULL parameter for all
> pre-existing  _EQUAL usages.
> ---
>  include/migration/vmstate.h | 54 ++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 48 insertions(+), 6 deletions(-)
> 
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index d90d9b12ca..ed1e1fd047 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -302,6 +302,18 @@ extern const VMStateInfo vmstate_info_qtailq;
>      .offset       = vmstate_offset_value(_state, _field, _type),     \
>  }
>  
> +#define VMSTATE_SINGLE_FULL(_field, _state, _test, _version, _info,  \
> +                            _type, _err_hint) {                      \
> +    .name         = (stringify(_field)),                             \
> +    .err_hint     = (_err_hint),                                     \
> +    .version_id   = (_version),                                      \
> +    .field_exists = (_test),                                         \
> +    .size         = sizeof(_type),                                   \
> +    .info         = &(_info),                                        \
> +    .flags        = VMS_SINGLE,                                      \
> +    .offset       = vmstate_offset_value(_state, _field, _type),     \
> +}
> +
>  /* Validate state using a boolean predicate. */
>  #define VMSTATE_VALIDATE(_name, _test) { \
>      .name         = (_name),                                         \
> @@ -808,30 +820,60 @@ extern const VMStateInfo vmstate_info_qtailq;
>  #define VMSTATE_UINT64(_f, _s)                                        \
>      VMSTATE_UINT64_V(_f, _s, 0)
>  
> +#define VMSTATE_UINT8_EQUAL_HINT(_f, _s, _err_hint)                   \
> +    VMSTATE_SINGLE_FULL(_f, _s, NULL, 0, vmstate_info_uint8_equal,    \
> +                        uint8_t, _err_hint)
> +
>  #define VMSTATE_UINT8_EQUAL(_f, _s)                                   \
> -    VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint8_equal, uint8_t)
> +    VMSTATE_UINT8_EQUAL_HINT(_f, _s, "Bug!?")
> +
> +#define VMSTATE_UINT16_EQUAL_HINT(_f, _s, _err_hint)                  \
> +    VMSTATE_SINGLE_FULL(_f, _s, NULL, 0, vmstate_info_uint16_equal,   \
> +                        uint16_t, _err_hint)
>  
>  #define VMSTATE_UINT16_EQUAL(_f, _s)                                  \
> -    VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint16_equal, uint16_t)
> +    VMSTATE_UINT16_EQUAL_HINT(_f, _s, "Bug!?")
> +
> +#define VMSTATE_UINT16_EQUAL_V_HINT(_f, _s, _v, _err_hint)            \
> +    VMSTATE_SINGLE_FULL(_f, _s, NULL, _v, vmstate_info_uint16_equal,  \
> +                        uint16_t, _err_hint)
>  
>  #define VMSTATE_UINT16_EQUAL_V(_f, _s, _v)                            \
> -    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16_equal, uint16_t)
> +    VMSTATE_UINT16_EQUAL_V_HINT(_f, _s, _v, "Bug!?")
> +
> +#define VMSTATE_INT32_EQUAL_HINT(_f, _s, _err_hint)                   \
> +    VMSTATE_SINGLE_FULL(_f, _s, NULL, 0, vmstate_info_int32_equal,    \
> +                        int32_t, _err_hint)
>  
>  #define VMSTATE_INT32_EQUAL(_f, _s)                                   \
> -    VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_equal, int32_t)
> +    VMSTATE_INT32_EQUAL_HINT(_f, _s, "Bug!?")
> +
> +#define VMSTATE_UINT32_EQUAL_V_HINT(_f, _s, _v,  _err_hint)           \
> +    VMSTATE_SINGLE_FULL(_f, _s, NULL, _v, vmstate_info_uint32_equal,  \
> +                        uint32_t, _err_hint)
>  
>  #define VMSTATE_UINT32_EQUAL_V(_f, _s, _v)                            \
> -    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint32_equal, uint32_t)
> +    VMSTATE_UINT32_EQUAL_V_HINT(_f, _s, _v, "Bug!?")
>  
>  #define VMSTATE_UINT32_EQUAL(_f, _s)                                  \
>      VMSTATE_UINT32_EQUAL_V(_f, _s, 0)
>  
> +#define VMSTATE_UINT32_EQUAL_HINT(_f, _s, _err_hint)                  \
> +    VMSTATE_UINT32_EQUAL_V_HINT(_f, _s, 0, _err_hint)
> +
> +#define VMSTATE_UINT64_EQUAL_V_HINT(_f, _s, _v,  _err_hint)           \
> +    VMSTATE_SINGLE_FULL(_f, _s, NULL, _v, vmstate_info_int64_equal,   \
> +                        uint64_t, _err_hint)
> +
>  #define VMSTATE_UINT64_EQUAL_V(_f, _s, _v)                            \
> -    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64_equal, uint64_t)
> +    VMSTATE_UINT64_EQUAL_V_HINT(_f, _s, _v, "Bug!?")
>  
>  #define VMSTATE_UINT64_EQUAL(_f, _s)                                  \
>      VMSTATE_UINT64_EQUAL_V(_f, _s, 0)
>  
> +#define VMSTATE_UINT64_EQUAL_HINT(_f, _s, _err_hint)                  \
> +    VMSTATE_UINT64_EQUAL_V_HINT(_f, _s, 0, _err_hint)
> +
>  #define VMSTATE_INT32_POSITIVE_LE(_f, _s)                             \
>      VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
>  
> -- 
> 2.11.2
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2017-06-07 11:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 16:55 [Qemu-devel] [RFC PATCH 0/3] vmstate: error hint for failed equal checks Halil Pasic
2017-06-06 16:55 ` [Qemu-devel] [RFC PATCH 1/3] " Halil Pasic
2017-06-07  9:51   ` Dr. David Alan Gilbert
2017-06-08 11:05     ` Halil Pasic
2017-06-14 13:51       ` Halil Pasic
2017-06-22  8:22         ` Dr. David Alan Gilbert
2017-06-22 13:18           ` Halil Pasic
2017-06-22 17:06             ` Dr. David Alan Gilbert
2017-06-29 19:04         ` Eric Blake
2017-06-30 14:41           ` Halil Pasic
2017-06-30 14:54             ` Eric Blake
2017-06-30 16:10               ` Halil Pasic
2017-07-03 13:52                 ` Markus Armbruster
2017-07-03 16:21                   ` Halil Pasic
2017-07-04  6:42                     ` Markus Armbruster
2017-07-04 11:25                       ` Halil Pasic
2017-06-06 16:55 ` [Qemu-devel] [RFC PATCH 2/3] vmstate: error hint for failed equal checks part 2 Halil Pasic
2017-06-07 11:07   ` Dr. David Alan Gilbert [this message]
2017-06-07 11:30     ` Halil Pasic
2017-06-07 12:01       ` Dr. David Alan Gilbert
2017-06-07 12:19         ` Halil Pasic
2017-06-07 17:10           ` Dr. David Alan Gilbert
2017-06-07 17:18             ` Halil Pasic
2017-06-07 17:21               ` Dr. David Alan Gilbert
2017-06-07 16:35   ` Juan Quintela
2017-06-07 16:56     ` Halil Pasic
2017-06-06 16:55 ` [Qemu-devel] [RFC PATCH 3/3] s390x/css: add hint for devno missmatch Halil Pasic
2017-06-07 11:22   ` Dr. David Alan Gilbert
2017-06-07 11:47     ` Halil Pasic
2017-06-07 12:07       ` Dr. David Alan Gilbert
2017-06-07 16:37     ` Juan Quintela

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=20170607110758.GC2099@work-vm \
    --to=dgilbert@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=pasic@linux.vnet.ibm.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 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.