From patchwork Wed Jan 11 15:11:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 9510395 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 B3F54601E7 for ; Wed, 11 Jan 2017 15:12:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7FB127CF5 for ; Wed, 11 Jan 2017 15:12:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C4A8283F6; Wed, 11 Jan 2017 15:12:39 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 53DA127CF5 for ; Wed, 11 Jan 2017 15:12:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757524AbdAKPMX (ORCPT ); Wed, 11 Jan 2017 10:12:23 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33895 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756096AbdAKPMU (ORCPT ); Wed, 11 Jan 2017 10:12:20 -0500 Received: by mail-pf0-f196.google.com with SMTP id y143so11993954pfb.1; Wed, 11 Jan 2017 07:12:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=HcRX3N37y1nF6y5EjQwgF6Ahx4Rccoa3MqVgeLEj/MY=; b=BsC1lbAjjRnvGs4W/xkPSDxtWFQCr9sicUfLK3UbXg82oXGfxOjPGD0PzRqiwalO6a MyhX3dYsm0ICs8yz6k+DnOvH8Vv8rPpDb3jX30plS7rRK0ONsHkgwCS0K0KAIjRxgOr/ FcCEmIN03eghsEOJhucxW4T7D6uFV9QQ6eDEe9jFkyuuK8Jrxr3Gaq/mUQIqAdsNmSaT o45KqycS8upF8m6hZnDpqm1s3XJOswjfMCzJcODXaDZas/8vkwD8hiWDr1JISS1L/JVP uKodBfc8KkG8abH2lBCY+fpqdgQ2LrMgWtLsbPPvX21sjPJkroCpjvp3pZPKC2xEaejo RE+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=HcRX3N37y1nF6y5EjQwgF6Ahx4Rccoa3MqVgeLEj/MY=; b=jFLBtEQLFXN6FGlfs2CHdN8ws9kCRUi+k6ugBv4dmScNkyOk9efr7Zhcg5pRt+7xMk rMoDpxKlzQEPBTE/RInGeD/v0B4DmUw/fEn8E9+lqkEvx1abrX4AKn1nUZgsp6oGLUxB Vz9dnf9m8te+tp+dfo04ZUr5xOqGynPXTsJdY3OrSxtPXoRBLPQiEIKULf7mEJdz+Igo hI6wcVFz0QxC/MHfKCpnaWp662zwOxLL4UspviNAseB4ICp2GLTSAoVjALIl73O+8Hhu IvfWobyZ6OuZHbeQMBSxQTZc1s87tmHbFCBg1/VUTT4PpGXL3YRJYmCDsJ4sxDB4GsOb /Vng== X-Gm-Message-State: AIkVDXKNRRb/T+iJ8rfUsm7iCWvpGQZd09lsLg6HbxGFr2CWz8GjA4fiPmu5GW7uHgCRqg== X-Received: by 10.84.143.129 with SMTP id 1mr4063553plz.42.1484147539967; Wed, 11 Jan 2017 07:12:19 -0800 (PST) Received: from localhost (z192.220-213-15.ppp.wakwak.ne.jp. [220.213.15.192]) by smtp.gmail.com with ESMTPSA id w76sm8979280pfd.74.2017.01.11.07.12.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jan 2017 07:12:19 -0800 (PST) From: Stafford Horne To: Shuah Khan , Darren Hart Cc: Bamvor Jian Zhang , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Stafford Horne , Thomas Renninger , "Shreyas B. Prabhu" , "Rafael J. Wysocki" , linux-pm@vger.kernel.org Subject: [PATCH v2 2/6] cpupower: Restore format of frequency-info limit Date: Thu, 12 Jan 2017 00:11:15 +0900 Message-Id: X-Mailer: git-send-email 2.9.3 In-Reply-To: References: In-Reply-To: References: 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 The intel_pstate kselftest expects that the output of `cpupower frequency-info -l | tail -1 | awk ' { print $1 } '` to get frequency limits. This does not work after the following two changes. - 562e5f1a3: rework the "cpupower frequency-info" command (Jacob Tanenbaum) removed parsable limit output - ce512b840: Do not analyse offlined cpus (Thomas Renninger) added newline to break limit parsing more This change preserves human readable output if wanted as well as parsable output for scripts/tests. Cc: Thomas Renninger Cc: "Shreyas B. Prabhu" Cc: "Rafael J. Wysocki" Cc: linux-pm@vger.kernel.org Signed-off-by: Stafford Horne --- tools/power/cpupower/utils/cpufreq-info.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c index 590d12a..3e701f0 100644 --- a/tools/power/cpupower/utils/cpufreq-info.c +++ b/tools/power/cpupower/utils/cpufreq-info.c @@ -285,20 +285,24 @@ static int get_freq_hardware(unsigned int cpu, unsigned int human) /* --hwlimits / -l */ -static int get_hardware_limits(unsigned int cpu) +static int get_hardware_limits(unsigned int cpu, unsigned int human) { unsigned long min, max; - printf(_(" hardware limits: ")); if (cpufreq_get_hardware_limits(cpu, &min, &max)) { printf(_("Not Available\n")); return -EINVAL; } - print_speed(min); - printf(" - "); - print_speed(max); - printf("\n"); + if (human) { + printf(_(" hardware limits: ")); + print_speed(min); + printf(" - "); + print_speed(max); + printf("\n"); + } else { + printf("%lu %lu\n", min, max); + } return 0; } @@ -456,7 +460,7 @@ static void debug_output_one(unsigned int cpu) get_related_cpus(cpu); get_affected_cpus(cpu); get_latency(cpu, 1); - get_hardware_limits(cpu); + get_hardware_limits(cpu, 1); freqs = cpufreq_get_available_frequencies(cpu); if (freqs) { @@ -622,7 +626,7 @@ int cmd_freq_info(int argc, char **argv) ret = get_driver(cpu); break; case 'l': - ret = get_hardware_limits(cpu); + ret = get_hardware_limits(cpu, human); break; case 'w': ret = get_freq_hardware(cpu, human); @@ -639,7 +643,6 @@ int cmd_freq_info(int argc, char **argv) } if (ret) return ret; - printf("\n"); } return ret; }