From patchwork Fri Nov 17 18:20:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 10063127 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 920206023A for ; Fri, 17 Nov 2017 18:20:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DEF92A7AC for ; Fri, 17 Nov 2017 18:20:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E8712A7CF; Fri, 17 Nov 2017 18:20:25 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 C3E332A752 for ; Fri, 17 Nov 2017 18:20:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760229AbdKQSUR (ORCPT ); Fri, 17 Nov 2017 13:20:17 -0500 Received: from osg.samsung.com ([64.30.133.232]:58584 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752501AbdKQSUQ (ORCPT ); Fri, 17 Nov 2017 13:20:16 -0500 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id 103762C81A; Fri, 17 Nov 2017 10:20:16 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WeOvYeKn9rTb; Fri, 17 Nov 2017 10:20:14 -0800 (PST) Received: from [192.168.1.87] (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) by osg.samsung.com (Postfix) with ESMTPSA id 721CE2C80D; Fri, 17 Nov 2017 10:20:14 -0800 (PST) To: rafael@kernel.org Cc: Thomas Renninger , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Shuah Khan From: Shuah Khan Subject: [GIT PULL] cpupower update for 4.15-rc2 Message-ID: Date: Fri, 17 Nov 2017 11:20:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-US 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 Hi Rafael, Please pull the cpupower update for 4.15-rc2 This update consists of fixes to tool's handling of offline cpus. The first patch fixes the tool to find information on the cpu it is running on, instead of always looking for cpu0 and failing if cpu0 happens to be offline. The second patch fixes the incorrect check for offline cpu status. Diff is attached. thanks, -- Shuah ------------------------------------------------------------------------------------------ The following changes since commit 69b6f8a9b7961efd7dcc11ab9b1d5be55ed8a15e: tools/power/cpupower: add libcpupower.so.0.0.1 to .gitignore (2017-11-09 10:52:22 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-cpupower-4.15-rc2 for you to fetch changes up to dbdc468f35ee827cab2753caa1c660bdb832243a: cpupower : Fix cpupower working when cpu0 is offline (2017-11-15 08:37:42 -0700) ---------------------------------------------------------------- linux-cpupower-4.15-rc2 This update consists of fixes to tool's handling of offline cpus. The first patch fixes the tool to find information on the cpu it is running on, instead of always looking for cpu0 and failing if cpu0 happens to be offline. The second patch fixes the incorrect check for offline cpu status. ---------------------------------------------------------------- Abhishek Goel (2): cpupowerutils: bench - Fix cpu online check cpupower : Fix cpupower working when cpu0 is offline tools/power/cpupower/bench/system.c | 2 +- tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) ------------------------------------------------------------------------------------------ diff --git a/tools/power/cpupower/bench/system.c b/tools/power/cpupower/bench/system.c index c25a74ae51ba..2bb3eef7d5c1 100644 --- a/tools/power/cpupower/bench/system.c +++ b/tools/power/cpupower/bench/system.c @@ -61,7 +61,7 @@ int set_cpufreq_governor(char *governor, unsigned int cpu) dprintf("set %s as cpufreq governor\n", governor); - if (cpupower_is_cpu_online(cpu) != 0) { + if (cpupower_is_cpu_online(cpu) != 1) { perror("cpufreq_cpu_exists"); fprintf(stderr, "error: cpu %u does not exist\n", cpu); return -1; diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c index 1b5da0066ebf..5b3205f16217 100644 --- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c @@ -130,15 +130,18 @@ static struct cpuidle_monitor *cpuidle_register(void) { int num; char *tmp; + int this_cpu; + + this_cpu = sched_getcpu(); /* Assume idle state count is the same for all CPUs */ - cpuidle_sysfs_monitor.hw_states_num = cpuidle_state_count(0); + cpuidle_sysfs_monitor.hw_states_num = cpuidle_state_count(this_cpu); if (cpuidle_sysfs_monitor.hw_states_num <= 0) return NULL; for (num = 0; num < cpuidle_sysfs_monitor.hw_states_num; num++) { - tmp = cpuidle_state_name(0, num); + tmp = cpuidle_state_name(this_cpu, num); if (tmp == NULL) continue; @@ -146,7 +149,7 @@ static struct cpuidle_monitor *cpuidle_register(void) strncpy(cpuidle_cstates[num].name, tmp, CSTATE_NAME_LEN - 1); free(tmp); - tmp = cpuidle_state_desc(0, num); + tmp = cpuidle_state_desc(this_cpu, num); if (tmp == NULL) continue; strncpy(cpuidle_cstates[num].desc, tmp, CSTATE_DESC_LEN - 1);