From patchwork Sun Jun 25 03:12:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 9807921 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9DF6F6038C for ; Sun, 25 Jun 2017 03:13:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ADA428210 for ; Sun, 25 Jun 2017 03:13:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F5CC28396; Sun, 25 Jun 2017 03:13:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FBE328210 for ; Sun, 25 Jun 2017 03:13:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751083AbdFYDNM (ORCPT ); Sat, 24 Jun 2017 23:13:12 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:34294 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750944AbdFYDNL (ORCPT ); Sat, 24 Jun 2017 23:13:11 -0400 Received: by mail-qk0-f196.google.com with SMTP id 91so5113157qkq.1 for ; Sat, 24 Jun 2017 20:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references:reply-to:organization; bh=NsH0KO/t8w9cJVd+A11wphXMUDyDZzzRa4i8yFfJbhg=; b=lz5g8MqWo/ol28zg0NDvn/R8kiDacRE1bCGKcjeKwKcPp6H79Yvt/VlPy0pTPTWJLI pNeg+nmcVgsOf0MYjVckHaAcq1JtTwj5wVG/iI+XTo3ra1HeeYQz4d23gxRakuuGfqbt bEKXPoAb6yQENdjkedQXeZmrrb7YCA89t0arRzVb4+JrL4U5DlU+wD3Ch0Wfjb/+9Aez hKG3TVSM5CDjrug0di56aVEIZcnueviL8JdHPuN8yvWCDGquVNLoUZA0zDrkCxm/Pep8 rRIEoXQ/5O8SvDqxcL8rBAXyGuFNPs0/iaeCSZC+5sN7seeD2S19zcg6v19jtqTjMr/W tODA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references:reply-to:organization; bh=NsH0KO/t8w9cJVd+A11wphXMUDyDZzzRa4i8yFfJbhg=; b=j43S3vkmVCDfRym5MnTmtlRUxzEX06B+XZ/ZfgHIVltf9ADtog3dN8uhIHxzlR4Aee IevnNMVSFuw4tof5XQyV5F1UyUeoTt1KgYtF8rf3oRF55G8sRcsTnGp8PobbRiw7UFNH 4DPFYsS5KwxbGulgMRhmj4DRihFxPFWBXP6+cYVoEry7a5P0g80hegPnEmopAQPatEYi MDn9/ToKTeWa0CvbGKmDxLkD6ghEQORDzelwjkVy3BcVnmHHensnwcDKhwSoOQQHE4Uf hO9G9x5TQjbMru/IQ80r5dnDxi54Ap2F9muQYCSfNgrzAJC719JabNePnFeEzfE/056a AcFQ== X-Gm-Message-State: AKS2vOyCAWgINFqD32ql9w6CCJNVKC4zD6VAnJh+u4Uhkgm4QO8wyO/p veFYsyXjXmGtd7by X-Received: by 10.55.31.93 with SMTP id f90mr16353578qkf.85.1498360390054; Sat, 24 Jun 2017 20:13:10 -0700 (PDT) Received: from localhost.localdomain (pool-173-48-65-169.bstnma.fios.verizon.net. [173.48.65.169]) by smtp.gmail.com with ESMTPSA id o76sm6158770qke.7.2017.06.24.20.13.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Jun 2017 20:13:09 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Len Brown Subject: [PATCH 3/5] tools/power turbostat: stop migrating, unless '-m' Date: Sat, 24 Jun 2017 20:12:59 -0700 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498360381-10293-1-git-send-email-lenb@kernel.org> References: <1498360381-10293-1-git-send-email-lenb@kernel.org> In-Reply-To: References: Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Len Brown 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 --- tools/power/x86/turbostat/turbostat.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 6f7c64a..1a3a5b4 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; unsigned int crystal_hz; unsigned long long tsc_hz; int base_cpu; +int do_migrate; double discover_bclk(unsigned int family, unsigned int model); unsigned int has_hwp; /* IA32_PM_ENABLE, IA32_HWP_CAPABILITIES */ /* IA32_HWP_REQUEST, IA32_HWP_STATUS */ @@ -302,6 +303,9 @@ int for_all_cpus(int (func)(struct thread_data *, struct core_data *, struct pkg int cpu_migrate(int cpu) { + if (!do_migrate) + return 0; + CPU_ZERO_S(cpu_affinity_setsize, cpu_affinity_set); CPU_SET_S(cpu, cpu_affinity_setsize, cpu_affinity_set); if (sched_setaffinity(0, cpu_affinity_setsize, cpu_affinity_set) == -1) @@ -5000,6 +5004,7 @@ void cmdline(int argc, char **argv) {"hide", required_argument, 0, 'H'}, // meh, -h taken by --help {"Joules", no_argument, 0, 'J'}, {"list", no_argument, 0, 'l'}, + {"migrate", no_argument, 0, 'm'}, {"out", required_argument, 0, 'o'}, {"quiet", no_argument, 0, 'q'}, {"show", required_argument, 0, 's'}, @@ -5011,7 +5016,7 @@ void cmdline(int argc, char **argv) progname = argv[0]; - while ((opt = getopt_long_only(argc, argv, "+C:c:Ddhi:JM:m:o:qST:v", + while ((opt = getopt_long_only(argc, argv, "+C:c:Ddhi:Jmo:qST:v", long_options, &option_index)) != -1) { switch (opt) { case 'a': @@ -5054,6 +5059,9 @@ void cmdline(int argc, char **argv) list_header_only++; quiet++; break; + case 'm': + do_migrate = 1; + break; case 'o': outf = fopen_or_die(optarg, "w"); break;