From patchwork Fri Sep 12 05:22:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lu X-Patchwork-Id: 4891851 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D35049F537 for ; Fri, 12 Sep 2014 05:18:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D81520266 for ; Fri, 12 Sep 2014 05:23:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E2AE2024F for ; Fri, 12 Sep 2014 05:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752111AbaILFXS (ORCPT ); Fri, 12 Sep 2014 01:23:18 -0400 Received: from mga09.intel.com ([134.134.136.24]:11698 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752107AbaILFXR (ORCPT ); Fri, 12 Sep 2014 01:23:17 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by orsmga102.jf.intel.com with ESMTP; 11 Sep 2014 22:16:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,510,1406617200"; d="scan'208";a="477042151" Received: from aaronlu.sh.intel.com ([10.239.37.127]) by azsmga001.ch.intel.com with ESMTP; 11 Sep 2014 22:22:55 -0700 Message-ID: <5412832E.7000406@intel.com> Date: Fri, 12 Sep 2014 13:22:54 +0800 From: Aaron Lu MIME-Version: 1.0 To: Viresh Kumar CC: Linux-pm mailing list , lkp@01.org, Fengguang Wu Subject: [LKP] Unable to change cpufreq governor Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Viresh, The script used in LKP to change cpufreq governor triggered a lot of errors on different test boxes with your branch: https://git.linaro.org/people/vireshk/linux cpufreq/governor-fixes [root@localhost cpufreq]# pwd /sys/devices/system/cpu/cpu3/cpufreq [root@localhost cpufreq]# echo ondemand > scaling_governor bash: echo: write error: Device or resource busy This only occurs for acpi-cpufreq scaling driver. After turned on the debug level: [root@localhost ~]# echo 'module cpufreq +pft' > /sys/kernel/debug/dynamic_debug/control And added a little more debug statements: the following output is printed with the above echo command: [ 61.869713] [1263] cpufreq_set_policy: cpufreq: setting new policy for CPU 3: 1600000 - 3401000 kHz [ 61.869732] [1263] cpufreq_set_policy: cpufreq: new min and max freqs are 1600000 - 3401000 kHz [ 61.869734] [1263] cpufreq_set_policy: cpufreq: governor switch [ 61.869736] [1263] __cpufreq_governor: cpufreq: __cpufreq_governor for CPU 3, event 2 [ 61.869739] [1263] __cpufreq_governor: cpufreq: state=5 [ 61.869741] [1263] __cpufreq_governor: cpufreq: busy=0 Please let me know if you need more information, thanks. -Aaron --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 051d566dc522..4175b1cf7995 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2009,7 +2009,7 @@ EXPORT_SYMBOL_GPL(cpufreq_driver_target); static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) { - int ret, state; + int ret, state, busy; /* Only must be defined when default governor is known to have latency restrictions, like e.g. conservative or ondemand. @@ -2046,9 +2046,12 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, mutex_lock(&cpufreq_governor_lock); state = get_governor_state(policy); + pr_debug("state=%u\n", state); /* Check if operation is permitted or not */ - if (is_governor_busy(policy) + busy = is_governor_busy(policy); + pr_debug("busy=%d\n", busy); + if (busy || (state == CPUFREQ_GOV_START && event != CPUFREQ_GOV_LIMITS && event != CPUFREQ_GOV_STOP) || (state == CPUFREQ_GOV_STOP && event != CPUFREQ_GOV_START && event != CPUFREQ_GOV_POLICY_EXIT) || (state == CPUFREQ_GOV_POLICY_INIT && event != CPUFREQ_GOV_START && event != CPUFREQ_GOV_POLICY_EXIT)