Re: [Xen-devel] [PATCH 03/27] tools/libxl: Stash all restore parameters in domain_create_state

2015-06-17 Thread Yang Hongyang



On 06/15/2015 09:44 PM, Andrew Cooper wrote:

Shortly more parameters will appear, and this saves unboxing each one.

No functional change.

Signed-off-by: Andrew Cooper andrew.coop...@citrix.com
CC: Ian Campbell ian.campb...@citrix.com
CC: Ian Jackson ian.jack...@eu.citrix.com
CC: Wei Liu wei.l...@citrix.com


Reviewed-by: Yang Hongyang yan...@cn.fujitsu.com


---
  tools/libxl/libxl_create.c   |   12 ++--
  tools/libxl/libxl_internal.h |2 +-
  tools/libxl/libxl_save_callout.c |2 +-
  3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 86384d2..385891c 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1577,8 +1577,8 @@ static void domain_create_cb(libxl__egc *egc,
   int rc, uint32_t domid);

  static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
-uint32_t *domid,
-int restore_fd, int checkpointed_stream,
+uint32_t *domid, int restore_fd,
+const libxl_domain_restore_params *params,
  const libxl_asyncop_how *ao_how,
  const libxl_asyncprogress_how *aop_console_how)
  {
@@ -1591,8 +1591,8 @@ static int do_domain_create(libxl_ctx *ctx, 
libxl_domain_config *d_config,
  libxl_domain_config_init(cdcs-dcs.guest_config_saved);
  libxl_domain_config_copy(ctx, cdcs-dcs.guest_config_saved, d_config);
  cdcs-dcs.restore_fd = restore_fd;
+if (params) cdcs-dcs.restore_params = *params;
  cdcs-dcs.callback = domain_create_cb;
-cdcs-dcs.checkpointed_stream = checkpointed_stream;
  libxl__ao_progress_gethow(cdcs-dcs.aop_console_how, aop_console_how);
  cdcs-domid_out = domid;

@@ -1619,7 +1619,7 @@ int libxl_domain_create_new(libxl_ctx *ctx, 
libxl_domain_config *d_config,
  const libxl_asyncop_how *ao_how,
  const libxl_asyncprogress_how *aop_console_how)
  {
-return do_domain_create(ctx, d_config, domid, -1, 0,
+return do_domain_create(ctx, d_config, domid, -1, NULL,
  ao_how, aop_console_how);
  }

@@ -1629,8 +1629,8 @@ int libxl_domain_create_restore(libxl_ctx *ctx, 
libxl_domain_config *d_config,
  const libxl_asyncop_how *ao_how,
  const libxl_asyncprogress_how 
*aop_console_how)
  {
-return do_domain_create(ctx, d_config, domid, restore_fd,
-params-checkpointed_stream, ao_how, 
aop_console_how);
+return do_domain_create(ctx, d_config, domid, restore_fd, params,
+ao_how, aop_console_how);
  }

  /*
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 6226c18..796bd21 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -3122,11 +3122,11 @@ struct libxl__domain_create_state {
  libxl_domain_config *guest_config;
  libxl_domain_config guest_config_saved; /* vanilla config */
  int restore_fd;
+libxl_domain_restore_params restore_params;
  libxl__domain_create_cb *callback;
  libxl_asyncprogress_how aop_console_how;
  /* private to domain_create */
  int guest_domid;
-int checkpointed_stream;
  libxl__domain_build_state build_state;
  libxl__bootloader_state bl;
  libxl__stub_dm_spawn_state dmss;
diff --git a/tools/libxl/libxl_save_callout.c b/tools/libxl/libxl_save_callout.c
index 40b25e4..3585a84 100644
--- a/tools/libxl/libxl_save_callout.c
+++ b/tools/libxl/libxl_save_callout.c
@@ -59,7 +59,7 @@ void libxl__xc_domain_restore(libxl__egc *egc, 
libxl__domain_create_state *dcs,
  state-store_domid, state-console_port,
  state-console_domid,
  hvm, pae, superpages,
-cbflags, dcs-checkpointed_stream,
+cbflags, dcs-restore_params.checkpointed_stream,
  };

  dcs-shs.ao = ao;



--
Thanks,
Yang.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 03/27] tools/libxl: Stash all restore parameters in domain_create_state

2015-06-16 Thread Ian Campbell
On Mon, 2015-06-15 at 14:44 +0100, Andrew Cooper wrote:
 Shortly more parameters will appear, and this saves unboxing each one.
 
 No functional change.
 
 Signed-off-by: Andrew Cooper andrew.coop...@citrix.com
 CC: Ian Campbell ian.campb...@citrix.com
 CC: Ian Jackson ian.jack...@eu.citrix.com
 CC: Wei Liu wei.l...@citrix.com
 ---
  tools/libxl/libxl_create.c   |   12 ++--
  tools/libxl/libxl_internal.h |2 +-
  tools/libxl/libxl_save_callout.c |2 +-
  3 files changed, 8 insertions(+), 8 deletions(-)
 
 diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
 index 86384d2..385891c 100644
 --- a/tools/libxl/libxl_create.c
 +++ b/tools/libxl/libxl_create.c
 @@ -1577,8 +1577,8 @@ static void domain_create_cb(libxl__egc *egc,
   int rc, uint32_t domid);
  
  static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
 -uint32_t *domid,
 -int restore_fd, int checkpointed_stream,
 +uint32_t *domid, int restore_fd,
 +const libxl_domain_restore_params *params,
  const libxl_asyncop_how *ao_how,
  const libxl_asyncprogress_how *aop_console_how)
  {
 @@ -1591,8 +1591,8 @@ static int do_domain_create(libxl_ctx *ctx, 
 libxl_domain_config *d_config,
  libxl_domain_config_init(cdcs-dcs.guest_config_saved);
  libxl_domain_config_copy(ctx, cdcs-dcs.guest_config_saved, d_config);
  cdcs-dcs.restore_fd = restore_fd;
 +if (params) cdcs-dcs.restore_params = *params;

Is this eventually going to become non-optional? I think not and its
validity is entirely intertwined with the validity of restore_fd (as I
suspect it was before, but I've not checked).

Perhaps an error check to that effect would be useful?

Anyway, I think what you've done here is correct, so:
Acked-by: Ian Campbell ian.campb...@citrix.com

[...]
 @@ -3122,11 +3122,11 @@ struct libxl__domain_create_state {
  libxl_domain_config *guest_config;
  libxl_domain_config guest_config_saved; /* vanilla config */
  int restore_fd;
 +libxl_domain_restore_params restore_params;
  libxl__domain_create_cb *callback;
  libxl_asyncprogress_how aop_console_how;
  /* private to domain_create */
  int guest_domid;
 -int checkpointed_stream;

This has, in effect moved from private to domain_create to filled in
by user, I don't think the change here has actually changed its status,
but I suspect it was wrong before (alternatively restore_fd is in the
wrong place instead).

Ian.


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 03/27] tools/libxl: Stash all restore parameters in domain_create_state

2015-06-16 Thread Andrew Cooper
On 16/06/15 14:37, Ian Campbell wrote:
 On Mon, 2015-06-15 at 14:44 +0100, Andrew Cooper wrote:
 Shortly more parameters will appear, and this saves unboxing each one.

 No functional change.

 Signed-off-by: Andrew Cooper andrew.coop...@citrix.com
 CC: Ian Campbell ian.campb...@citrix.com
 CC: Ian Jackson ian.jack...@eu.citrix.com
 CC: Wei Liu wei.l...@citrix.com
 ---
  tools/libxl/libxl_create.c   |   12 ++--
  tools/libxl/libxl_internal.h |2 +-
  tools/libxl/libxl_save_callout.c |2 +-
  3 files changed, 8 insertions(+), 8 deletions(-)

 diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
 index 86384d2..385891c 100644
 --- a/tools/libxl/libxl_create.c
 +++ b/tools/libxl/libxl_create.c
 @@ -1577,8 +1577,8 @@ static void domain_create_cb(libxl__egc *egc,
   int rc, uint32_t domid);
  
  static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
 -uint32_t *domid,
 -int restore_fd, int checkpointed_stream,
 +uint32_t *domid, int restore_fd,
 +const libxl_domain_restore_params *params,
  const libxl_asyncop_how *ao_how,
  const libxl_asyncprogress_how *aop_console_how)
  {
 @@ -1591,8 +1591,8 @@ static int do_domain_create(libxl_ctx *ctx, 
 libxl_domain_config *d_config,
  libxl_domain_config_init(cdcs-dcs.guest_config_saved);
  libxl_domain_config_copy(ctx, cdcs-dcs.guest_config_saved, d_config);
  cdcs-dcs.restore_fd = restore_fd;
 +if (params) cdcs-dcs.restore_params = *params;
 Is this eventually going to become non-optional? I think not and its
 validity is entirely intertwined with the validity of restore_fd (as I
 suspect it was before, but I've not checked).

 Perhaps an error check to that effect would be useful?

It is mandatory for restore, and currently unused for plain create. 
restore_fd being  -1 does appear to be the canonical switch between a
restore and a create, so should be the qualification of validity.


 Anyway, I think what you've done here is correct, so:
 Acked-by: Ian Campbell ian.campb...@citrix.com
 
 [...]
 @@ -3122,11 +3122,11 @@ struct libxl__domain_create_state {
  libxl_domain_config *guest_config;
  libxl_domain_config guest_config_saved; /* vanilla config */
  int restore_fd;
 +libxl_domain_restore_params restore_params;
  libxl__domain_create_cb *callback;
  libxl_asyncprogress_how aop_console_how;
  /* private to domain_create */
  int guest_domid;
 -int checkpointed_stream;
 This has, in effect moved from private to domain_create to filled in
 by user, I don't think the change here has actually changed its status,
 but I suspect it was wrong before (alternatively restore_fd is in the
 wrong place instead).

I think it was wrong before.  It was always a caller-provided parameter,
albeit implicit by virtue of essentially being a remus boolean.

~Andrew

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH 03/27] tools/libxl: Stash all restore parameters in domain_create_state

2015-06-15 Thread Andrew Cooper
Shortly more parameters will appear, and this saves unboxing each one.

No functional change.

Signed-off-by: Andrew Cooper andrew.coop...@citrix.com
CC: Ian Campbell ian.campb...@citrix.com
CC: Ian Jackson ian.jack...@eu.citrix.com
CC: Wei Liu wei.l...@citrix.com
---
 tools/libxl/libxl_create.c   |   12 ++--
 tools/libxl/libxl_internal.h |2 +-
 tools/libxl/libxl_save_callout.c |2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 86384d2..385891c 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1577,8 +1577,8 @@ static void domain_create_cb(libxl__egc *egc,
  int rc, uint32_t domid);
 
 static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,
-uint32_t *domid,
-int restore_fd, int checkpointed_stream,
+uint32_t *domid, int restore_fd,
+const libxl_domain_restore_params *params,
 const libxl_asyncop_how *ao_how,
 const libxl_asyncprogress_how *aop_console_how)
 {
@@ -1591,8 +1591,8 @@ static int do_domain_create(libxl_ctx *ctx, 
libxl_domain_config *d_config,
 libxl_domain_config_init(cdcs-dcs.guest_config_saved);
 libxl_domain_config_copy(ctx, cdcs-dcs.guest_config_saved, d_config);
 cdcs-dcs.restore_fd = restore_fd;
+if (params) cdcs-dcs.restore_params = *params;
 cdcs-dcs.callback = domain_create_cb;
-cdcs-dcs.checkpointed_stream = checkpointed_stream;
 libxl__ao_progress_gethow(cdcs-dcs.aop_console_how, aop_console_how);
 cdcs-domid_out = domid;
 
@@ -1619,7 +1619,7 @@ int libxl_domain_create_new(libxl_ctx *ctx, 
libxl_domain_config *d_config,
 const libxl_asyncop_how *ao_how,
 const libxl_asyncprogress_how *aop_console_how)
 {
-return do_domain_create(ctx, d_config, domid, -1, 0,
+return do_domain_create(ctx, d_config, domid, -1, NULL,
 ao_how, aop_console_how);
 }
 
@@ -1629,8 +1629,8 @@ int libxl_domain_create_restore(libxl_ctx *ctx, 
libxl_domain_config *d_config,
 const libxl_asyncop_how *ao_how,
 const libxl_asyncprogress_how *aop_console_how)
 {
-return do_domain_create(ctx, d_config, domid, restore_fd,
-params-checkpointed_stream, ao_how, 
aop_console_how);
+return do_domain_create(ctx, d_config, domid, restore_fd, params,
+ao_how, aop_console_how);
 }
 
 /*
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 6226c18..796bd21 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -3122,11 +3122,11 @@ struct libxl__domain_create_state {
 libxl_domain_config *guest_config;
 libxl_domain_config guest_config_saved; /* vanilla config */
 int restore_fd;
+libxl_domain_restore_params restore_params;
 libxl__domain_create_cb *callback;
 libxl_asyncprogress_how aop_console_how;
 /* private to domain_create */
 int guest_domid;
-int checkpointed_stream;
 libxl__domain_build_state build_state;
 libxl__bootloader_state bl;
 libxl__stub_dm_spawn_state dmss;
diff --git a/tools/libxl/libxl_save_callout.c b/tools/libxl/libxl_save_callout.c
index 40b25e4..3585a84 100644
--- a/tools/libxl/libxl_save_callout.c
+++ b/tools/libxl/libxl_save_callout.c
@@ -59,7 +59,7 @@ void libxl__xc_domain_restore(libxl__egc *egc, 
libxl__domain_create_state *dcs,
 state-store_domid, state-console_port,
 state-console_domid,
 hvm, pae, superpages,
-cbflags, dcs-checkpointed_stream,
+cbflags, dcs-restore_params.checkpointed_stream,
 };
 
 dcs-shs.ao = ao;
-- 
1.7.10.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel