* [PATCH] libxl: fix rtc_timeoffset setting
@ 2012-04-13 9:08 Lin Ming
2012-04-20 9:29 ` Lin Ming
2012-04-24 16:46 ` Ian Jackson
0 siblings, 2 replies; 3+ messages in thread
From: Lin Ming @ 2012-04-13 9:08 UTC (permalink / raw)
To: xen-devel; +Cc: Teck Choon Giam, Ian Campbell
libxl__domain_build_info_setdefault may be called several times,
so rtc_timeoffset can't be setted in it.
Move rtc_timeoffset setting logic to libxl__build_pre.
Reported-by: Teck Choon Giam <giamteckchoon@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
---
tools/libxl/libxl_create.c | 9 ---------
tools/libxl/libxl_dom.c | 17 +++++++++++++++--
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index e63c7bd..e706124 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -127,15 +127,6 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
b_info->target_memkb = b_info->max_memkb;
libxl_defbool_setdefault(&b_info->localtime, false);
- if (libxl_defbool_val(b_info->localtime)) {
- time_t t;
- struct tm *tm;
-
- t = time(NULL);
- tm = localtime(&t);
-
- b_info->rtc_timeoffset += tm->tm_gmtoff;
- }
libxl_defbool_setdefault(&b_info->disable_migrate, false);
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 0bdd654..91c4bd8 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -65,6 +65,8 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
libxl_ctx *ctx = libxl__gc_owner(gc);
int tsc_mode;
char *xs_domid, *con_domid;
+ uint32_t rtc_timeoffset;
+
xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap);
xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT);
@@ -91,8 +93,19 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
if (libxl_defbool_val(info->disable_migrate))
xc_domain_disable_migrate(ctx->xch, domid);
- if (info->rtc_timeoffset)
- xc_domain_set_time_offset(ctx->xch, domid, info->rtc_timeoffset);
+ rtc_timeoffset = info->rtc_timeoffset;
+ if (libxl_defbool_val(info->localtime)) {
+ time_t t;
+ struct tm *tm;
+
+ t = time(NULL);
+ tm = localtime(&t);
+
+ rtc_timeoffset += tm->tm_gmtoff;
+ }
+
+ if (rtc_timeoffset)
+ xc_domain_set_time_offset(ctx->xch, domid, rtc_timeoffset);
if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
unsigned long shadow;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] libxl: fix rtc_timeoffset setting
2012-04-13 9:08 [PATCH] libxl: fix rtc_timeoffset setting Lin Ming
@ 2012-04-20 9:29 ` Lin Ming
2012-04-24 16:46 ` Ian Jackson
1 sibling, 0 replies; 3+ messages in thread
From: Lin Ming @ 2012-04-20 9:29 UTC (permalink / raw)
To: xen-devel, Ian Jackson; +Cc: Teck Choon Giam, Ian Campbell
On Fri, Apr 13, 2012 at 5:08 PM, Lin Ming <mlin@ss.pku.edu.cn> wrote:
> libxl__domain_build_info_setdefault may be called several times,
> so rtc_timeoffset can't be setted in it.
>
> Move rtc_timeoffset setting logic to libxl__build_pre.
>
> Reported-by: Teck Choon Giam <giamteckchoon@gmail.com>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
Hi IanJ,
Would you take this one?
Thanks,
Lin Ming
> ---
> tools/libxl/libxl_create.c | 9 ---------
> tools/libxl/libxl_dom.c | 17 +++++++++++++++--
> 2 files changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index e63c7bd..e706124 100644
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -127,15 +127,6 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
> b_info->target_memkb = b_info->max_memkb;
>
> libxl_defbool_setdefault(&b_info->localtime, false);
> - if (libxl_defbool_val(b_info->localtime)) {
> - time_t t;
> - struct tm *tm;
> -
> - t = time(NULL);
> - tm = localtime(&t);
> -
> - b_info->rtc_timeoffset += tm->tm_gmtoff;
> - }
>
> libxl_defbool_setdefault(&b_info->disable_migrate, false);
>
> diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
> index 0bdd654..91c4bd8 100644
> --- a/tools/libxl/libxl_dom.c
> +++ b/tools/libxl/libxl_dom.c
> @@ -65,6 +65,8 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
> libxl_ctx *ctx = libxl__gc_owner(gc);
> int tsc_mode;
> char *xs_domid, *con_domid;
> + uint32_t rtc_timeoffset;
> +
> xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
> libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap);
> xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT);
> @@ -91,8 +93,19 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
> if (libxl_defbool_val(info->disable_migrate))
> xc_domain_disable_migrate(ctx->xch, domid);
>
> - if (info->rtc_timeoffset)
> - xc_domain_set_time_offset(ctx->xch, domid, info->rtc_timeoffset);
> + rtc_timeoffset = info->rtc_timeoffset;
> + if (libxl_defbool_val(info->localtime)) {
> + time_t t;
> + struct tm *tm;
> +
> + t = time(NULL);
> + tm = localtime(&t);
> +
> + rtc_timeoffset += tm->tm_gmtoff;
> + }
> +
> + if (rtc_timeoffset)
> + xc_domain_set_time_offset(ctx->xch, domid, rtc_timeoffset);
>
> if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
> unsigned long shadow;
> --
> 1.7.2.5
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libxl: fix rtc_timeoffset setting
2012-04-13 9:08 [PATCH] libxl: fix rtc_timeoffset setting Lin Ming
2012-04-20 9:29 ` Lin Ming
@ 2012-04-24 16:46 ` Ian Jackson
1 sibling, 0 replies; 3+ messages in thread
From: Ian Jackson @ 2012-04-24 16:46 UTC (permalink / raw)
To: Lin Ming; +Cc: Teck Choon Giam, Ian Campbell, xen-devel
Lin Ming writes ("[Xen-devel] [PATCH] libxl: fix rtc_timeoffset setting"):
> libxl__domain_build_info_setdefault may be called several times,
> so rtc_timeoffset can't be setted in it.
>
> Move rtc_timeoffset setting logic to libxl__build_pre.
>
> Reported-by: Teck Choon Giam <giamteckchoon@gmail.com>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-24 16:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13 9:08 [PATCH] libxl: fix rtc_timeoffset setting Lin Ming
2012-04-20 9:29 ` Lin Ming
2012-04-24 16:46 ` Ian Jackson
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.