qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: agraf@suse.de, stefanb@linux.vnet.ibm.com, quintela@redhat.com,
	mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org,
	aliguori@amazon.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [RFC PATCH v2 05/16] Header/constant/types fixes for visitors
Date: Wed, 7 May 2014 12:47:06 +0300	[thread overview]
Message-ID: <20140507094706.GB10830@redhat.com> (raw)
In-Reply-To: <1398271069-22057-6-git-send-email-dgilbert@redhat.com>

On Wed, Apr 23, 2014 at 05:37:38PM +0100, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Move constants around and add types to allow file structure to move into
> visitors.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  arch_init.c                   | 12 ------------
>  include/migration/migration.h | 17 +++++++++++++++++
>  include/migration/vmstate.h   | 20 +++++++++++++++++---
>  include/qemu/typedefs.h       |  4 ++--
>  4 files changed, 36 insertions(+), 17 deletions(-)
> 
> diff --git a/arch_init.c b/arch_init.c
> index 60c975d..73b9303 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -110,18 +110,6 @@ static bool mig_throttle_on;
>  static int dirty_rate_high_cnt;
>  static void check_guest_throttling(void);
>  
> -/***********************************************************/
> -/* ram save/restore */
> -
> -#define RAM_SAVE_FLAG_FULL     0x01 /* Obsolete, not used anymore */
> -#define RAM_SAVE_FLAG_COMPRESS 0x02
> -#define RAM_SAVE_FLAG_MEM_SIZE 0x04
> -#define RAM_SAVE_FLAG_PAGE     0x08
> -#define RAM_SAVE_FLAG_EOS      0x10
> -#define RAM_SAVE_FLAG_CONTINUE 0x20
> -#define RAM_SAVE_FLAG_XBZRLE   0x40
> -/* 0x80 is reserved in migration.h start with 0x100 next */
> -
>  static struct defconfig_file {
>      const char *filename;
>      /* Indicates it is an user config file (disabled by -no-user-config) */
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 3e1e6c7..8111125 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -165,7 +165,16 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags);
>   * side. This lets before_ram_iterate/after_ram_iterate add
>   * transport-specific sections to the RAM migration data.
>   */
> +/* ram save/restore */
> +#define RAM_SAVE_FLAG_FULL     0x01 /* Obsolete, not used anymore */
> +#define RAM_SAVE_FLAG_COMPRESS 0x02
> +#define RAM_SAVE_FLAG_MEM_SIZE 0x04
> +#define RAM_SAVE_FLAG_PAGE     0x08
> +#define RAM_SAVE_FLAG_EOS      0x10
> +#define RAM_SAVE_FLAG_CONTINUE 0x20
> +#define RAM_SAVE_FLAG_XBZRLE   0x40
>  #define RAM_SAVE_FLAG_HOOK     0x80
> +#define RAM_SAVE_FLAG_MASK    0x1ff
>  
>  #define RAM_SAVE_CONTROL_NOT_SUPP -1000
>  #define RAM_SAVE_CONTROL_DELAYED  -2000
> @@ -174,4 +183,12 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
>                               ram_addr_t offset, size_t size,
>                               int *bytes_sent);
>  
> +typedef struct {
> +    uint64_t addr;
> +    uint16_t flags;
> +    char     idstr[256];
> +    char     ch;  /* Used for filled pages (normally 0 fill) */
> +    size_t   len; /* Uses include xbzrle's data len */
> +} ramsecentry_header;
> +


RamSecEntryHeader?

and maybe we should make this 256 a named constant too.


>  #endif
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index e7e1705..a5e4b0b 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -26,6 +26,7 @@
>  #ifndef QEMU_VMSTATE_H
>  #define QEMU_VMSTATE_H 1
>  
> +#include "qemu/typedefs.h"
>  #ifndef CONFIG_USER_ONLY
>  #include <migration/qemu-file.h>
>  #endif
> @@ -49,15 +50,27 @@ typedef struct SaveVMHandlers {
>       * use data that is local to the migration thread or protected
>       * by other locks.
>       */
> -    int (*save_live_iterate)(QEMUFile *f, void *opaque);
> +    int (*save_live_iterate)(Visitor *v, void *opaque);
>  
>      /* This runs outside the iothread lock!  */
> -    int (*save_live_setup)(QEMUFile *f, void *opaque);
> -    uint64_t (*save_live_pending)(QEMUFile *f, void *opaque, uint64_t max_size);
> +    int (*save_live_setup)(Visitor *v, void *opaque);
> +    uint64_t (*save_live_pending)(void *opaque, uint64_t max_size);
>  
>      LoadStateHandler *load_state;
>  } SaveVMHandlers;
>  
> +/* This is the data used to identify a section as passed
> + * into the section version of the compat sequence visitor
> + * (TODO: Probably want to move the whole name lookup into there
> + *    and keep the section_id wrapped inside the binary visitor)
> + */
> +typedef struct SectionHeader {
> +    uint32_t section_id;
> +    uint32_t instance_id; /* Below only used for full version */
> +    uint32_t version_id;
> +    char     idstr[256];
> +} SectionHeader;
> +
>  int register_savevm(DeviceState *dev,
>                      const char *idstr,
>                      int instance_id,
> @@ -134,6 +147,7 @@ struct VMStateDescription {
>      void (*pre_save)(void *opaque);
>      VMStateField *fields;
>      const VMStateSubsection *subsections;
> +    uint32_t ber_tag;
>  };
>  
>  #ifdef CONFIG_USER_ONLY
> diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
> index bf8daac..3fea88e 100644
> --- a/include/qemu/typedefs.h
> +++ b/include/qemu/typedefs.h
> @@ -10,8 +10,6 @@ typedef struct QEMUBH QEMUBH;
>  
>  typedef struct AioContext AioContext;
>  
> -typedef struct Visitor Visitor;
> -
>  struct Monitor;
>  typedef struct Monitor Monitor;
>  typedef struct MigrationParams MigrationParams;
> @@ -39,6 +37,7 @@ typedef struct DriveInfo DriveInfo;
>  typedef struct DisplayState DisplayState;
>  typedef struct DisplayChangeListener DisplayChangeListener;
>  typedef struct DisplaySurface DisplaySurface;
> +typedef struct Error Error;
>  typedef struct PixelFormat PixelFormat;
>  typedef struct QemuConsole QemuConsole;
>  typedef struct CharDriverState CharDriverState;
> @@ -73,5 +72,6 @@ typedef struct SHPCDevice SHPCDevice;
>  typedef struct FWCfgState FWCfgState;
>  typedef struct PcGuestInfo PcGuestInfo;
>  typedef struct Range Range;
> +typedef struct Visitor Visitor;
>  
>  #endif /* QEMU_TYPEDEFS_H */
> -- 
> 1.9.0

       reply	other threads:[~2014-05-07  9:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1398271069-22057-1-git-send-email-dgilbert@redhat.com>
     [not found] ` <1398271069-22057-6-git-send-email-dgilbert@redhat.com>
2014-05-07  9:47   ` Michael S. Tsirkin [this message]
2014-05-07 10:33     ` [Qemu-devel] [RFC PATCH v2 05/16] Header/constant/types fixes for visitors Dr. David Alan Gilbert
     [not found] ` <1398271069-22057-2-git-send-email-dgilbert@redhat.com>
2014-05-07  9:50   ` [Qemu-devel] [RFC PATCH v2 01/16] Visitor: Add methods for migration format use Michael S. Tsirkin
2014-05-07 10:23     ` Dr. David Alan Gilbert
2014-05-07 10:32       ` Michael S. Tsirkin
     [not found] ` <5357EF56.4010703@redhat.com>
     [not found]   ` <20140423171622.GG2516@work-vm>
     [not found]     ` <87sip3dvsj.fsf@blackfin.pond.sub.org>
     [not found]       ` <20140424082059.GB2459@work-vm>
     [not found]         ` <20140424082923.GA31845@redhat.com>
     [not found]           ` <87wqeduc0d.fsf@blackfin.pond.sub.org>
2014-05-06 18:58             ` [Qemu-devel] [RFC PATCH v2 00/16] visitor+BER migration format Dr. David Alan Gilbert
2014-05-06 20:26               ` Michael S. Tsirkin
2014-05-07  5:49                 ` Markus Armbruster
2014-05-07  9:22                   ` Dr. David Alan Gilbert
     [not found]     ` <5357FCA9.8040801@redhat.com>
     [not found]       ` <20140423175410.GA28308@redhat.com>
     [not found]         ` <53580D27.2080507@redhat.com>
2014-05-07  9:57           ` Michael S. Tsirkin
     [not found] ` <1398271069-22057-16-git-send-email-dgilbert@redhat.com>
2014-05-07 10:02   ` [Qemu-devel] [RFC PATCH v2 15/16] Wire in BER visitors Michael S. Tsirkin
2014-05-07 10:08     ` 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=20140507094706.GB10830@redhat.com \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aliguori@amazon.com \
    --cc=dgilbert@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanb@linux.vnet.ibm.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).