diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-04-06 13:49:16 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-04-06 13:49:16 +0100 |
commit | 9d8216601857f5666b52c64139cde296456a8205 (patch) | |
tree | 06e7719a724ac82589c67e2e63576e20d62d2564 /tools | |
parent | 3e15c37e68862b9d8f3a9f0085fab2d596e19e49 (diff) | |
download | xen-9d8216601857f5666b52c64139cde296456a8205.tar.gz xen-9d8216601857f5666b52c64139cde296456a8205.tar.bz2 xen-9d8216601857f5666b52c64139cde296456a8205.zip |
xenpm: Set scheduler vcpu_migration_delay by xenpm
Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Yang Xiaowei <xiaowei.yang@intel.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libxc/xc_pm.c | 30 | ||||
-rw-r--r-- | tools/libxc/xenctrl.h | 2 | ||||
-rw-r--r-- | tools/misc/xenpm.c | 52 |
3 files changed, 84 insertions, 0 deletions
diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c index 652f1729ef..501041073e 100644 --- a/tools/libxc/xc_pm.c +++ b/tools/libxc/xc_pm.c @@ -362,6 +362,36 @@ int xc_set_sched_opt_smt(int xc_handle, uint32_t value) return rc; } +int xc_set_vcpu_migration_delay(int xc_handle, uint32_t value) +{ + int rc; + DECLARE_SYSCTL; + + sysctl.cmd = XEN_SYSCTL_pm_op; + sysctl.u.pm_op.cmd = XEN_SYSCTL_pm_op_set_vcpu_migration_delay; + sysctl.u.pm_op.cpuid = 0; + sysctl.u.pm_op.set_vcpu_migration_delay = value; + rc = do_sysctl(xc_handle, &sysctl); + + return rc; +} + +int xc_get_vcpu_migration_delay(int xc_handle, uint32_t *value) +{ + int rc; + DECLARE_SYSCTL; + + sysctl.cmd = XEN_SYSCTL_pm_op; + sysctl.u.pm_op.cmd = XEN_SYSCTL_pm_op_get_vcpu_migration_delay; + sysctl.u.pm_op.cpuid = 0; + rc = do_sysctl(xc_handle, &sysctl); + + if (!rc && value) + *value = sysctl.u.pm_op.get_vcpu_migration_delay; + + return rc; +} + int xc_get_cpuidle_max_cstate(int xc_handle, uint32_t *value) { int rc; diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 7111fa97c5..c9b1866b60 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -1261,6 +1261,8 @@ struct xc_get_cputopo { int xc_get_cputopo(int xc_handle, struct xc_get_cputopo *info); int xc_set_sched_opt_smt(int xc_handle, uint32_t value); +int xc_set_vcpu_migration_delay(int xc_handle, uint32_t value); +int xc_get_vcpu_migration_delay(int xc_handle, uint32_t *value); int xc_get_cpuidle_max_cstate(int xc_handle, uint32_t *value); int xc_set_cpuidle_max_cstate(int xc_handle, uint32_t value); diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c index 1d65393706..015d80a5b9 100644 --- a/tools/misc/xenpm.c +++ b/tools/misc/xenpm.c @@ -57,6 +57,8 @@ void show_help(void) " it is used in ondemand governor.\n" " get-cpu-topology get thread/core/socket topology info\n" " set-sched-smt enable|disable enable/disable scheduler smt power saving\n" + " set-vcpu-migration-delay <num> set scheduler vcpu migration delay in us\n" + " get-vcpu-migration-delay get scheduler vcpu migration delay\n" " set-max-cstate <num> set the C-State limitation (<num> >= 0)\n" " start [seconds] start collect Cx/Px statistics,\n" " output after CTRL-C or SIGINT or several seconds.\n" @@ -884,6 +886,54 @@ void set_sched_smt_func(int argc, char *argv[]) return; } +void set_vcpu_migration_delay_func(int argc, char *argv[]) +{ + int value; + int rc; + + if (argc != 1){ + show_help(); + exit(-1); + } + + value = atoi(argv[0]); + + if (value < 0) + { + printf("Please try non-negative vcpu migration delay\n"); + exit(-1); + } + + rc = xc_set_vcpu_migration_delay(xc_fd, value); + printf("%s to set vcpu migration delay to %d us\n", + rc? "Fail":"Succeed", value ); + + return; +} + +void get_vcpu_migration_delay_func(int argc, char *argv[]) +{ + uint32_t value; + int rc; + + if (argc != 0){ + show_help(); + exit(-1); + } + + rc = xc_get_vcpu_migration_delay(xc_fd, &value); + if (!rc) + { + printf("Schduler vcpu migration delay is %d us\n", value); + } + else + { + printf("Failed to get scheduler vcpu migration delay, errno=%d\n", errno); + } + + return; +} + void set_max_cstate_func(int argc, char *argv[]) { int value, rc; @@ -918,6 +968,8 @@ struct { { "set-up-threshold", scaling_up_threshold_func }, { "get-cpu-topology", cpu_topology_func}, { "set-sched-smt", set_sched_smt_func}, + { "get-vcpu-migration-delay", get_vcpu_migration_delay_func}, + { "set-vcpu-migration-delay", set_vcpu_migration_delay_func}, { "set-max-cstate", set_max_cstate_func}, }; |