From patchwork Wed Jan 11 15:16:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 9510411 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 57B63601E7 for ; Wed, 11 Jan 2017 15:16:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C7D92865F for ; Wed, 11 Jan 2017 15:16:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4150228666; Wed, 11 Jan 2017 15:16:47 +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=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 A11782865F for ; Wed, 11 Jan 2017 15:16:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754789AbdAKPQp (ORCPT ); Wed, 11 Jan 2017 10:16:45 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:34458 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753133AbdAKPQo (ORCPT ); Wed, 11 Jan 2017 10:16:44 -0500 Received: by mail-pg0-f67.google.com with SMTP id b1so53996672pgc.1; Wed, 11 Jan 2017 07:16:43 -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; bh=HcRX3N37y1nF6y5EjQwgF6Ahx4Rccoa3MqVgeLEj/MY=; b=duR05jaFbXvlZ1y39OqCSUwVrUGxD8h9C4ovSpAfP3ztQPvbAWtMgZHAOVxDt7nVh0 wYb7973QMpMFiU1l06HZ/j3wBg/2fZW5QljZZwY7ll8F1NHmmxaTWTsyruQpasVoCwNd gh5sgawOX9WbAijOHnsfJB5OULB6EDeX3Fucb8dNipWEwBEfsNyrnfUJnZc37YxvGURE c2MhUmMWMs0H9kL6N1KcuJHyRt/rDZ7PvFIk0jIx+bW+W8YUrP8mqPkAEc1RMPOM0nvF BFGi/p2i3WF6lo5oQXIUHBiXG64qYEKXofIeEiQbDAuOW7EewC3aazQXB9MD8rvnsTjp BIEA== 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; bh=HcRX3N37y1nF6y5EjQwgF6Ahx4Rccoa3MqVgeLEj/MY=; b=IG/AY+a5SXagYA0tw5U+QT9gljpPJ/Sj3vuBb03pn/pAxy3nW5lsIjQiYquE5nSsSO 5kzJoe7exwPbXKaiZ4T/PSRK1EiWrE6F9enhcwwsKFXMnRPZuWX0XKePGodoNhdrFwKU rWVegN1AHGHpRjwYHFv5ayROPGgTtkB4qOL+qA7ajdMiDHs9/jHi478D3P/IOiurukHY zxzAwxgybAw4/0vJpe+AaBJtqYQqHcDSNoTily8hBdHLevmoiLCDFIcLnsvAL5E5xyMu +aB39N5x+u1MllCieDKWcwGQjZdLfPxUG2jmbrCqmqRlr7ZgbsNjkAKRCfjMo2XT1sms Uwow== X-Gm-Message-State: AIkVDXIl5mq8uTsuEEtbi19Qf49cgJecYL+TzBhd6naVZhALXSYWAsMLe4mkZNGw8QBvug== X-Received: by 10.99.125.65 with SMTP id m1mr11497398pgn.159.1484147803511; Wed, 11 Jan 2017 07:16:43 -0800 (PST) Received: from localhost (z192.220-213-15.ppp.wakwak.ne.jp. [220.213.15.192]) by smtp.gmail.com with ESMTPSA id g85sm14692407pfe.38.2017.01.11.07.16.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jan 2017 07:16:43 -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 3/6] cpupower: Restore format of frequency-info limit Date: Thu, 12 Jan 2017 00:16:04 +0900 Message-Id: <9f3d11fc1f75e2589aee67cbafac6ead3adf0f23.1484147115.git.shorne@gmail.com> X-Mailer: git-send-email 2.9.3 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; }