From patchwork Sun Sep 4 22:44:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Noonan X-Patchwork-Id: 9312919 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 D33946075E for ; Sun, 4 Sep 2016 22:44:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEFDC284B1 for ; Sun, 4 Sep 2016 22:44:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF1D7286BF; Sun, 4 Sep 2016 22:44:56 +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_SIGNED, 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 15FBB284B1 for ; Sun, 4 Sep 2016 22:44:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753244AbcIDWoy (ORCPT ); Sun, 4 Sep 2016 18:44:54 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36161 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752551AbcIDWoy (ORCPT ); Sun, 4 Sep 2016 18:44:54 -0400 Received: by mail-pf0-f196.google.com with SMTP id a143so5429707pfa.3 for ; Sun, 04 Sep 2016 15:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uplinklabs-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=/wChuseFWk5ZHw8Lw9Fy3vZ72U5bFG7FBP+1wya/550=; b=Un7imvOsxu9/LjorIccqVGIDbe6hg+i3o+/2Lv1fg1+LGW5ASA5IR3OnFVGhnklaaX WZuWT844zRbZXTe54xr5X4zqso4WhYnye+yFuISlyr6EMsOGTMXSumvtGeyQWz6hz9Fu bXB8NSxVxRlSZH8Q3dRXYY7+3AGGm2UfZlvSnSjAHa23iMw9LEO0SGthX0gZ8qvhqozx 3vZRsdcB/SuXxgVw50yiYZsACyIuUTWsmBU18B/7j8s5mgJAC/0z2EJ5IqXRGSCLNVXO mLFhIpopI3A6h2lZaSUdvJmEd40gKqzUcGf5AueXl9Y8WkmaMe7n01J1DLYjPFOmtA/9 JwOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/wChuseFWk5ZHw8Lw9Fy3vZ72U5bFG7FBP+1wya/550=; b=erP7OqIKMxLbonqLsOn+pz+CJXf+lTDX5qQS63LPMz6XJBdAUJreqTHGlI9FRtWqGw tz411TEQGz1Mue5yYrQkF4ek4BWzN8n47B29QG6cpb9ov1TdpdnuTZ3u3ZJdWzisu11F 0xRxoT5NjSeD9DYp5VVf2I3FgiT471J28hAmyl+ma+z98z0Q9UeZos1Yqd0afokmR4JP CWIYqfchF4D0Fzmoh54W8nBS421ULSGVwnkS4bS7XSfq+Owy7k0WqaIKQbx5cb06Eejq Jme67dcIH67Rk9mvglnlfCeRD0itmB9scjsMTYxwQ7mo2BHM0mDj6os3c+TsifhTGU8q zNYQ== X-Gm-Message-State: AE9vXwPQxFhJA6ScUpTpG+sw7LQVLdYx6UXD4NnMTLYf2DxHqKTd7H4xjUN3+uUEQLtaKA== X-Received: by 10.98.38.4 with SMTP id m4mr57763501pfm.47.1473029057117; Sun, 04 Sep 2016 15:44:17 -0700 (PDT) Received: from localhost ([2604:4080:1004:0:225:90ff:fe15:52df]) by smtp.gmail.com with ESMTPSA id u89sm11851221pfi.0.2016.09.04.15.44.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 15:44:15 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Sun, 04 Sep 2016 15:44:13 -0700 From: Steven Noonan To: linux-pm@vger.kernel.org Cc: Thomas Renninger , Steven Noonan Subject: [PATCH] cpupower: fix frequency-set check for online CPUs Date: Sun, 4 Sep 2016 15:44:04 -0700 Message-Id: <20160904224404.29863-1-steven@uplinklabs.net> X-Mailer: git-send-email 2.9.3 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 It used to look at whether the cpuN directory existed (a function which returned 0 on success, nonzero on failure), but the cpupower_is_cpu_online function returns 1 when the CPU is online. This caused it to skip all online CPUs since it was expecting 0 to mean 'online'. We also had a redundant (and also wrong) check on cpupower_is_cpu_online when iterating over the bitmask to run the set operations. Signed-off-by: Steven Noonan --- tools/power/cpupower/utils/cpufreq-set.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c index b4bf769..ec7d7da 100644 --- a/tools/power/cpupower/utils/cpufreq-set.c +++ b/tools/power/cpupower/utils/cpufreq-set.c @@ -296,7 +296,7 @@ int cmd_freq_set(int argc, char **argv) struct cpufreq_affected_cpus *cpus; if (!bitmask_isbitset(cpus_chosen, cpu) || - cpupower_is_cpu_online(cpu)) + cpupower_is_cpu_online(cpu) != 1) continue; cpus = cpufreq_get_related_cpus(cpu); @@ -315,8 +315,7 @@ int cmd_freq_set(int argc, char **argv) for (cpu = bitmask_first(cpus_chosen); cpu <= bitmask_last(cpus_chosen); cpu++) { - if (!bitmask_isbitset(cpus_chosen, cpu) || - cpupower_is_cpu_online(cpu)) + if (!bitmask_isbitset(cpus_chosen, cpu)) continue; if (cpupower_is_cpu_online(cpu) != 1)