aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2017-05-28 00:18:12 -0400
committerLen Brown <len.brown@intel.com>2017-06-24 23:03:19 -0400
commitc91fc8519d87715a3a173475ea3778794c139996 (patch)
treea0d623cbceeb6cc3eb0415d39994530985000d18
parentf4fdf2b474606580b95eed95d06c762d4fd3f57b (diff)
tools/power turbostat: stop migrating, unless '-m'
Turbostat has the capability to set its own affinity to each CPU so that its MSR accesses are on the local CPU. However, using the in-kernel cross-call in the msr driver tends to be less invasive, so do that -- by-default. '-m' remains to get the old behaviour. Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--tools/power/x86/turbostat/turbostat.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 6f7c64acee23..1a3a5b436b80 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -92,6 +92,7 @@ unsigned int do_ring_perf_limit_reasons;
92unsigned int crystal_hz; 92unsigned int crystal_hz;
93unsigned long long tsc_hz; 93unsigned long long tsc_hz;
94int base_cpu; 94int base_cpu;
95int do_migrate;
95double discover_bclk(unsigned int family, unsigned int model); 96double discover_bclk(unsigned int family, unsigned int model);
96unsigned int has_hwp; /* IA32_PM_ENABLE, IA32_HWP_CAPABILITIES */ 97unsigned int has_hwp; /* IA32_PM_ENABLE, IA32_HWP_CAPABILITIES */
97 /* IA32_HWP_REQUEST, IA32_HWP_STATUS */ 98 /* IA32_HWP_REQUEST, IA32_HWP_STATUS */
@@ -302,6 +303,9 @@ int for_all_cpus(int (func)(struct thread_data *, struct core_data *, struct pkg
302 303
303int cpu_migrate(int cpu) 304int cpu_migrate(int cpu)
304{ 305{
306 if (!do_migrate)
307 return 0;
308
305 CPU_ZERO_S(cpu_affinity_setsize, cpu_affinity_set); 309 CPU_ZERO_S(cpu_affinity_setsize, cpu_affinity_set);
306 CPU_SET_S(cpu, cpu_affinity_setsize, cpu_affinity_set); 310 CPU_SET_S(cpu, cpu_affinity_setsize, cpu_affinity_set);
307 if (sched_setaffinity(0, cpu_affinity_setsize, cpu_affinity_set) == -1) 311 if (sched_setaffinity(0, cpu_affinity_setsize, cpu_affinity_set) == -1)
@@ -5000,6 +5004,7 @@ void cmdline(int argc, char **argv)
5000 {"hide", required_argument, 0, 'H'}, // meh, -h taken by --help 5004 {"hide", required_argument, 0, 'H'}, // meh, -h taken by --help
5001 {"Joules", no_argument, 0, 'J'}, 5005 {"Joules", no_argument, 0, 'J'},
5002 {"list", no_argument, 0, 'l'}, 5006 {"list", no_argument, 0, 'l'},
5007 {"migrate", no_argument, 0, 'm'},
5003 {"out", required_argument, 0, 'o'}, 5008 {"out", required_argument, 0, 'o'},
5004 {"quiet", no_argument, 0, 'q'}, 5009 {"quiet", no_argument, 0, 'q'},
5005 {"show", required_argument, 0, 's'}, 5010 {"show", required_argument, 0, 's'},
@@ -5011,7 +5016,7 @@ void cmdline(int argc, char **argv)
5011 5016
5012 progname = argv[0]; 5017 progname = argv[0];
5013 5018
5014 while ((opt = getopt_long_only(argc, argv, "+C:c:Ddhi:JM:m:o:qST:v", 5019 while ((opt = getopt_long_only(argc, argv, "+C:c:Ddhi:Jmo:qST:v",
5015 long_options, &option_index)) != -1) { 5020 long_options, &option_index)) != -1) {
5016 switch (opt) { 5021 switch (opt) {
5017 case 'a': 5022 case 'a':
@@ -5054,6 +5059,9 @@ void cmdline(int argc, char **argv)
5054 list_header_only++; 5059 list_header_only++;
5055 quiet++; 5060 quiet++;
5056 break; 5061 break;
5062 case 'm':
5063 do_migrate = 1;
5064 break;
5057 case 'o': 5065 case 'o':
5058 outf = fopen_or_die(optarg, "w"); 5066 outf = fopen_or_die(optarg, "w");
5059 break; 5067 break;