Set sched_smt_power_savings by xenpm
Signed-off-by: Yu Ke <ke.yu@intel.com>
diff -r 0bd8fb8941bc tools/libxc/xc_pm.c
--- a/tools/libxc/xc_pm.c
+++ b/tools/libxc/xc_pm.c
@@ -334,3 +334,20 @@ int xc_get_cputopo(int xc_handle, struct
return rc;
}
+/* value: 0 - disable sched_smt_power_savings
+ 1 - enable sched_smt_power_savings
+ */
+int xc_set_sched_opt_smt(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_sched_opt_smt;
+ sysctl.u.pm_op.cpuid = 0;
+ sysctl.u.pm_op.set_sched_opt_smt = value;
+ rc = do_sysctl(xc_handle, &sysctl);
+
+ return rc;
+}
+
diff -r 0bd8fb8941bc tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -1266,4 +1266,6 @@ 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);
+
#endif /* XENCTRL_H */
diff -r 0bd8fb8941bc tools/misc/xenpm.c
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -56,6 +56,7 @@ void show_help(void)
" set-up-threshold [cpuid] <num> set up threshold
on CPU <cpuid> or all\n"
" 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"
" start [seconds] start collect Cx/Px
statistics,\n"
" output after CTRL-C or
SIGINT or several seconds.\n"
);
@@ -861,6 +862,36 @@ void cpu_topology_func(int argc, char *a
return ;
}
+void set_sched_smt_func(int argc, char *argv[])
+{
+ int value, rc;
+
+ if (argc != 1){
+ show_help();
+ exit(-1);
+ }
+
+ if ( !strncmp(argv[0], "disable", sizeof("disable")) )
+ {
+ value = 0;
+ }
+ else if ( !strncmp(argv[0], "enable", sizeof("enable"))
)
+ {
+ value = 1;
+ }
+ else
+ {
+ show_help();
+ exit(-1);
+ }
+
+ rc = xc_set_sched_opt_smt(xc_fd, value);
+ printf("%s sched_smt_power_savings %s\n", argv[0],
+ rc? "failed":"successeed" );
+
+ return;
+}
+
struct {
const char *name;
void (*function)(int argc, char *argv[]);
@@ -877,6 +908,7 @@ struct {
{ "set-sampling-rate", scaling_sampling_rate_func },
{ "set-up-threshold", scaling_up_threshold_func },
{ "get-cpu-topology", cpu_topology_func},
+ { "set-sched-smt", set_sched_smt_func},
};
int main(int argc, char *argv[])
diff -r 0bd8fb8941bc xen/drivers/acpi/pmstat.c
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -500,6 +500,17 @@ int do_pm_op(struct xen_sysctl_pm_op *op
break;
}
+ case XEN_SYSCTL_pm_op_set_sched_opt_smt:
+ {
+ uint32_t saved_value;
+
+ saved_value = sched_smt_power_savings;
+ sched_smt_power_savings = !!op->set_sched_opt_smt;
+ op->set_sched_opt_smt = saved_value;
+
+ break;
+ }
+
default:
printk("not defined sub-hypercall @ do_pm_op\n");
ret = -ENOSYS;
diff -r 0bd8fb8941bc xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -355,11 +355,9 @@ struct xen_set_cpufreq_para {
uint32_t ctrl_type;
uint32_t ctrl_value;
-}
-;
+};
+
/* Get physical CPU topology information. */
-
-
#define INVALID_TOPOLOGY_ID (~0U)
struct xen_get_cputopo {
/* IN: maximum addressable entry in
@@ -387,6 +385,9 @@ struct xen_sysctl_pm_op {
/* get CPU topology */
#define XEN_SYSCTL_pm_op_get_cputopo 0x20
+ /* set/reset scheduler power saving option */
+ #define XEN_SYSCTL_pm_op_set_sched_opt_smt 0x21
+
uint32_t cmd;
uint32_t cpuid;
union {
@@ -394,6 +395,7 @@ struct xen_sysctl_pm_op {
struct xen_set_cpufreq_gov set_gov;
struct xen_set_cpufreq_para set_para;
struct xen_get_cputopo get_topo;
+ uint32_t set_sched_opt_smt;
};
};
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Keir Fraser
2009-Mar-20 09:08 UTC
[Xen-devel] Re: [PATCH 2/2] Set sched_smt_power_savings by xenpm
On 20/03/2009 06:42, "Yu, Ke" <ke.yu@intel.com> wrote:> Set sched_smt_power_savings by xenpm > > Signed-off-by: Yu Ke <ke.yu@intel.com>I applied these patches, thanks. Actually you originally wanted to be able to adjust the vcpu_migration_delay via xenpm as well. I didn''t take that bit of the patch last time, but if there''s going to be a set of useful things to adjust at runtime, it should be included. So you could re-send that sysctl and xenpm plumbing if you like. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Yu, Ke
2009-Mar-20 13:05 UTC
[Xen-devel] RE: [PATCH 2/2] Set sched_smt_power_savings by xenpm
Thanks for the reminder. I will talk to Xiaowei on the vcpu_migration_delay stuff. Actually I did not remember I once sent out the patch of vcpu_migration_delay adjust in xenpm. But if Xiaowei think it is useful, we surely will be happy to send out the patch. Best Regards Ke>-----Original Message----- >From: Keir Fraser [mailto:keir.fraser@eu.citrix.com] >Sent: Friday, March 20, 2009 5:08 PM >To: Yu, Ke >Cc: xen-devel@lists.xensource.com; Tian, Kevin >Subject: Re: [PATCH 2/2] Set sched_smt_power_savings by xenpm > >On 20/03/2009 06:42, "Yu, Ke" <ke.yu@intel.com> wrote: > >> Set sched_smt_power_savings by xenpm >> >> Signed-off-by: Yu Ke <ke.yu@intel.com> > >I applied these patches, thanks. Actually you originally wanted to be able >to adjust the vcpu_migration_delay via xenpm as well. I didn''t take that bit >of the patch last time, but if there''s going to be a set of useful things to >adjust at runtime, it should be included. So you could re-send that sysctl >and xenpm plumbing if you like. > > -- Keir >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2009-Mar-20 13:20 UTC
[Xen-devel] Re: [PATCH 2/2] Set sched_smt_power_savings by xenpm
On 20/03/2009 13:05, "Yu, Ke" <ke.yu@intel.com> wrote:> Thanks for the reminder. I will talk to Xiaowei on the vcpu_migration_delay > stuff. Actually I did not remember I once sent out the patch of > vcpu_migration_delay adjust in xenpm. But if Xiaowei think it is useful, we > surely will be happy to send out the patch.It was certainly plumbed to dom0 tools. Perhaps there was a custom utlity to drive it. I wouldn''t have liked that, whereas plugging it through xenpm sounds okay. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Yu, Ke
2009-Mar-20 14:33 UTC
[Xen-devel] RE: [PATCH 2/2] Set sched_smt_power_savings by xenpm
>It was certainly plumbed to dom0 tools. Perhaps there was a custom utlity to >drive it. I wouldn''t have liked that, whereas plugging it through xenpm >sounds okay. > > -- Keir >Get it. I will make the patch. Best Regards Ke _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel