From: Julien Grall <julien.grall@citrix.com>
To: Haozhong Zhang <haozhong.zhang@intel.com>, xen-devel@lists.xen.org
Cc: Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Jan Beulich <jbeulich@suse.com>,
Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
Jun Nakajima <jun.nakajima@intel.com>, Keir Fraser <keir@xen.org>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH 13/13] tools/libxl: Add 'vtsc_khz' option to set guest TSC rate
Date: Mon, 28 Sep 2015 12:47:24 +0100 [thread overview]
Message-ID: <560928CC.8000401@citrix.com> (raw)
In-Reply-To: <1443424438-13404-14-git-send-email-haozhong.zhang@intel.com>
Hi,
On 28/09/15 08:13, Haozhong Zhang wrote:
> This patch adds an option 'vtsc_khz' to allow users to set vcpu's TSC
> rate in KHz. In the case that tsc_mode = 'default', the default value of
> 'vtsc_khz' option is the host TSC rate which is used when 'vtsc_khz'
> option is set to 0 or does not appear in the configuration. In all other
> cases of tsc_mode, 'vtsc_khz' option is just ignored.
>
> Another purpose of adding this option is to keep vcpu's TSC rate across
> guest reboot. In existing code, a new domain is created from the
> configuration of the previous domain which was just rebooted. vcpu's TSC
> rate is not stored in the configuration and the host TSC rate is the
> used as vcpu's TSC rate. This works fine unless the previous domain was
> migrated from another host machine with a different host TSC rate than
> the current one.
>
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> ---
> tools/libxl/libxl_types.idl | 1 +
> tools/libxl/libxl_x86.c | 4 +++-
> tools/libxl/xl_cmdimpl.c | 22 ++++++++++++++++++++++
> 3 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> index 9f6ec00..91cb0be 100644
> --- a/tools/libxl/libxl_types.idl
> +++ b/tools/libxl/libxl_types.idl
> @@ -413,6 +413,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
> ("vcpu_soft_affinity", Array(libxl_bitmap, "num_vcpu_soft_affinity")),
> ("numa_placement", libxl_defbool),
> ("tsc_mode", libxl_tsc_mode),
> + ("vtsc_khz", uint32),
This is x86 specific, can we begin to move anything arch-specific under
arch_foo? See arch_arm for instance.
Also, you would need to add a new define LIBXL_HAVE_foo to let allow
developer writing app on top of libxl support multiple version of Xen.
See libxl.h
> ("max_memkb", MemKB),
> ("target_memkb", MemKB),
> ("video_memkb", MemKB),
> diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
> index 896f34c..7baaee4 100644
> --- a/tools/libxl/libxl_x86.c
> +++ b/tools/libxl/libxl_x86.c
> @@ -276,6 +276,7 @@ int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
> {
> int ret = 0;
> int tsc_mode;
> + uint32_t vtsc_khz;
> uint32_t rtc_timeoffset;
> libxl_ctx *ctx = libxl__gc_owner(gc);
>
> @@ -300,7 +301,8 @@ int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
> default:
> abort();
> }
> - xc_domain_set_tsc_info(ctx->xch, domid, tsc_mode, 0, 0, 0);
> + vtsc_khz = d_config->b_info.vtsc_khz;
> + xc_domain_set_tsc_info(ctx->xch, domid, tsc_mode, 0, vtsc_khz, 0);
> if (libxl_defbool_val(d_config->b_info.disable_migrate))
> xc_domain_disable_migrate(ctx->xch, domid);
> rtc_timeoffset = d_config->b_info.rtc_timeoffset;
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 2706759..5fabda7 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -1462,6 +1462,28 @@ static void parse_config_data(const char *config_source,
> }
> }
>
> + /* "vtsc_khz" option works only if "tsc_mode" option is
> + * "default". In this case, if "vtsc_khz" option is set to 0, we
> + * will reset it to the host TSC rate. In all other cases, we just
> + * ignore any given value and always set it to 0.
> + */
> + if (!xlu_cfg_get_long(config, "vtsc_khz", &l, 0))
This option has to be documented docs/man/xl.cfg.pod.5.
> + b_info->vtsc_khz = l;
> + if (b_info->tsc_mode == LIBXL_TSC_MODE_DEFAULT) {
> + if (b_info->vtsc_khz == 0) {
> + libxl_physinfo physinfo;
> + if (!libxl_get_physinfo(ctx, &physinfo))
> + b_info->vtsc_khz = physinfo.cpu_khz;
> + else
> + fprintf(stderr, "WARNING: cannot get host TSC rate.\n");
> + }
> + } else {
> + fprintf(stderr, "WARNING: ignoring \"vtsc_khz\" option. "
> + "\"vtsc_khz\" option works only if "
> + "\"tsc_mode\" option is \"default\".\n");
> + b_info->vtsc_khz = 0;
> + }
> +
> if (!xlu_cfg_get_long(config, "rtc_timeoffset", &l, 0))
> b_info->rtc_timeoffset = l;
>
>
Regards,
--
Julien Grall
next prev parent reply other threads:[~2015-09-28 11:47 UTC|newest]
Thread overview: 117+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-28 7:13 [PATCH 00/13] Add VMX TSC scaling support Haozhong Zhang
2015-09-28 7:13 ` [PATCH 01/13] x86/time.c: Use system time to calculate elapsed_nsec in tsc_get_info() Haozhong Zhang
2015-10-09 6:51 ` Jan Beulich
2015-10-09 13:41 ` Boris Ostrovsky
2015-10-09 14:00 ` Haozhong Zhang
2015-10-09 15:11 ` Jan Beulich
2015-10-09 16:09 ` Boris Ostrovsky
2015-10-09 16:19 ` Jan Beulich
2015-10-09 16:31 ` Boris Ostrovsky
2015-10-09 16:51 ` Haozhong Zhang
2015-10-09 18:59 ` Boris Ostrovsky
2015-10-09 14:39 ` Jan Beulich
2015-10-09 15:37 ` Boris Ostrovsky
2015-10-09 16:39 ` Haozhong Zhang
2015-10-09 16:44 ` Boris Ostrovsky
2015-10-09 14:35 ` Haozhong Zhang
2015-10-09 14:43 ` Jan Beulich
2015-10-09 15:56 ` Boris Ostrovsky
2015-10-14 2:45 ` Haozhong Zhang
2015-10-14 9:40 ` Jan Beulich
2015-10-14 10:00 ` Haozhong Zhang
2015-10-14 10:20 ` Jan Beulich
2015-10-14 10:24 ` Haozhong Zhang
2015-09-28 7:13 ` [PATCH 02/13] x86/time.c: Get the correct guest TSC rate " Haozhong Zhang
2015-09-28 7:13 ` [PATCH 03/13] x86/hvm: Collect information of TSC scaling ratio Haozhong Zhang
2015-10-22 12:53 ` Jan Beulich
2015-10-22 14:40 ` Haozhong Zhang
2015-10-22 14:51 ` Jan Beulich
2015-10-22 15:57 ` Haozhong Zhang
2015-09-28 7:13 ` [PATCH 04/13] x86/hvm: Setup " Haozhong Zhang
2015-10-22 13:13 ` Jan Beulich
2015-10-22 15:55 ` Haozhong Zhang
2015-10-22 16:05 ` Jan Beulich
2015-10-22 16:39 ` Haozhong Zhang
2015-10-23 7:44 ` Haozhong Zhang
2015-10-23 7:59 ` Jan Beulich
2015-10-23 8:18 ` Haozhong Zhang
2015-10-23 8:31 ` Jan Beulich
2015-10-23 8:40 ` Haozhong Zhang
2015-10-23 9:18 ` Jan Beulich
2015-09-28 7:13 ` [PATCH 05/13] x86/hvm: Replace architecture TSC scaling by a common function Haozhong Zhang
2015-10-22 13:52 ` Jan Beulich
2015-10-23 0:49 ` Haozhong Zhang
2015-09-28 7:13 ` [PATCH 06/13] x86/hvm: Scale host TSC when setting/getting guest TSC Haozhong Zhang
2015-10-22 14:17 ` Jan Beulich
2015-10-22 15:44 ` Boris Ostrovsky
2015-10-22 16:23 ` Haozhong Zhang
2015-10-27 20:16 ` Aravind Gopalakrishnan
2015-10-28 1:51 ` Haozhong Zhang
2015-11-09 7:43 ` Haozhong Zhang
2015-11-12 13:50 ` George Dunlap
2015-10-22 16:03 ` Haozhong Zhang
2015-10-27 1:54 ` Haozhong Zhang
2015-10-27 8:15 ` Jan Beulich
2015-10-27 8:25 ` Haozhong Zhang
2015-10-27 8:44 ` Haozhong Zhang
2015-10-27 13:10 ` Boris Ostrovsky
2015-10-27 13:55 ` Boris Ostrovsky
2015-10-27 16:13 ` haozhong.zhang
2015-10-27 16:13 ` haozhong.zhang
2015-09-28 7:13 ` [PATCH 07/13] x86/hvm: Move saving/loading vcpu's TSC to common code Haozhong Zhang
2015-10-22 14:54 ` Jan Beulich
2015-09-28 7:13 ` [PATCH 08/13] x86/hvm: Detect TSC scaling through hvm_funcs in tsc_set_info() Haozhong Zhang
2015-10-22 15:01 ` Jan Beulich
2015-09-28 7:13 ` [PATCH 09/13] x86/time.c: Scale host TSC in pvclock properly Haozhong Zhang
2015-09-28 16:36 ` Boris Ostrovsky
2015-09-29 0:19 ` Haozhong Zhang
2015-10-22 15:50 ` Boris Ostrovsky
2015-10-22 16:44 ` Haozhong Zhang
2015-10-22 19:15 ` Boris Ostrovsky
2015-09-28 7:13 ` [PATCH 10/13] vmx: Detect and initialize VMX RDTSC(P) scaling Haozhong Zhang
2015-10-27 13:19 ` Jan Beulich
2015-10-27 16:17 ` Haozhong Zhang
2015-09-28 7:13 ` [PATCH 11/13] vmx: Use scaled host TSC to calculate TSC offset Haozhong Zhang
2015-10-22 15:55 ` Boris Ostrovsky
2015-10-22 17:12 ` Haozhong Zhang
2015-10-22 19:19 ` Boris Ostrovsky
2015-10-23 0:52 ` Haozhong Zhang
2015-10-27 13:29 ` Jan Beulich
2015-10-27 16:21 ` Haozhong Zhang
2015-09-28 7:13 ` [PATCH 12/13] vmx: Add a call-back to apply TSC scaling ratio to hardware Haozhong Zhang
2015-09-28 16:02 ` Boris Ostrovsky
2015-09-29 1:07 ` Haozhong Zhang
2015-09-29 9:33 ` Andrew Cooper
2015-09-29 10:02 ` Haozhong Zhang
2015-09-29 10:25 ` Andrew Cooper
2015-09-29 13:59 ` Haozhong Zhang
2015-10-27 13:33 ` Jan Beulich
2015-10-28 2:41 ` Haozhong Zhang
2015-09-28 7:13 ` [PATCH 13/13] tools/libxl: Add 'vtsc_khz' option to set guest TSC rate Haozhong Zhang
2015-09-28 11:47 ` Julien Grall [this message]
2015-09-28 12:11 ` Haozhong Zhang
2015-09-28 14:19 ` Wei Liu
2015-09-29 0:40 ` Haozhong Zhang
2015-09-29 9:20 ` Wei Liu
2015-09-29 9:50 ` Haozhong Zhang
2015-09-29 10:24 ` Julien Grall
2015-09-29 10:07 ` Ian Campbell
2015-09-29 10:33 ` Wei Liu
2015-09-29 12:57 ` Haozhong Zhang
2015-09-29 10:04 ` Ian Campbell
2015-09-29 10:13 ` Haozhong Zhang
2015-09-29 10:24 ` Andrew Cooper
2015-09-29 10:28 ` Ian Campbell
2015-09-29 10:31 ` Andrew Cooper
2015-09-29 13:53 ` Haozhong Zhang
2015-09-29 13:56 ` Andrew Cooper
2015-09-29 14:01 ` Haozhong Zhang
2015-09-29 14:37 ` Ian Campbell
2015-09-29 15:16 ` Haozhong Zhang
2015-09-28 10:51 ` [PATCH 00/13] Add VMX TSC scaling support Andrew Cooper
2015-09-28 13:48 ` Boris Ostrovsky
2015-11-22 17:54 ` Haozhong Zhang
2015-11-23 15:37 ` Boris Ostrovsky
2015-11-24 13:05 ` Haozhong Zhang
2015-11-24 14:19 ` Boris Ostrovsky
2015-11-24 14:25 ` Haozhong Zhang
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=560928CC.8000401@citrix.com \
--to=julien.grall@citrix.com \
--cc=Aravind.Gopalakrishnan@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=haozhong.zhang@intel.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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.