From patchwork Mon Jun 22 08:02:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50135 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C0F0B21594 for ; Mon, 22 Jun 2015 08:03:24 +0000 (UTC) Received: by wgfj7 with SMTP id j7sf38935823wgf.1 for ; Mon, 22 Jun 2015 01:03:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=oiPoZpNIJD7gCeWmiFpwF6dbykPQI4cVgidICdPY3yc=; b=amsrZ9x7Qff3xFqeGsy25LQ02eUqQcPa3RyCsX0KT9WiqYhidyD+dYmH8jS9ZnpoLq cPwYZwicl2Q7HcK28cQv6+bA89VExP2/UJfe787c1XNTvoVvu9E+oPQ/pE0Q0+k/yHGL xO5dDawI9YFhEFJ9plMBNef9T3Aes6CtS7A04zV+Gka/pEDzeheTYMoHgCNYaeqksqoW la1luantUE1ywXtwcq0KDefpT5YT7KTwHzdHp7WEZbo7xVPwgrWUgX45LA8MiKomtw3v wtnE9gBFGg7kf7H+/dF9uYbLw60M0weQlQ9PzvgwKbnJ7gN+1MXEzUR3nEqciBLXxrGV WiPw== X-Gm-Message-State: ALoCoQnp9F5ajY1rS8dywov15cUt36sibLThmWEOgeaN7vEdwcoXFe1KUzZya2xhV0NwFygZ7Nui X-Received: by 10.194.5.229 with SMTP id v5mr18860024wjv.0.1434960204019; Mon, 22 Jun 2015 01:03:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.65 with SMTP id r1ls869657lag.61.gmail; Mon, 22 Jun 2015 01:03:23 -0700 (PDT) X-Received: by 10.112.12.102 with SMTP id x6mr22109811lbb.80.1434960203845; Mon, 22 Jun 2015 01:03:23 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id b1si15897707laf.78.2015.06.22.01.03.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jun 2015 01:03:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lagi2 with SMTP id i2so15151893lag.2 for ; Mon, 22 Jun 2015 01:03:23 -0700 (PDT) X-Received: by 10.152.87.33 with SMTP id u1mr29406924laz.35.1434960203421; Mon, 22 Jun 2015 01:03:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2208721lbb; Mon, 22 Jun 2015 01:03:22 -0700 (PDT) X-Received: by 10.66.192.1 with SMTP id hc1mr56566751pac.38.1434960201570; Mon, 22 Jun 2015 01:03:21 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si28342941pbq.257.2015.06.22.01.03.20; Mon, 22 Jun 2015 01:03:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756041AbbFVIDT (ORCPT + 11 others); Mon, 22 Jun 2015 04:03:19 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:35184 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755999AbbFVIDS (ORCPT ); Mon, 22 Jun 2015 04:03:18 -0400 Received: by pdbci14 with SMTP id ci14so75091533pdb.2 for ; Mon, 22 Jun 2015 01:03:18 -0700 (PDT) X-Received: by 10.68.180.67 with SMTP id dm3mr19759470pbc.167.1434960198353; Mon, 22 Jun 2015 01:03:18 -0700 (PDT) Received: from localhost ([122.167.71.211]) by mx.google.com with ESMTPSA id fk5sm14281960pab.40.2015.06.22.01.03.17 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 22 Jun 2015 01:03:17 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Preeti U Murthy Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar Subject: [PATCH 03/10] cpufreq: conservative: remove 'enable' field Date: Mon, 22 Jun 2015 13:32:50 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Conservative governor has its own 'enable' field to check two things: - If conservative governor is used for a CPU or not - If governor is currently enabled or not, as there can be a race around the notifier being called while it was getting unregistered from cpufreq_governor_dbs(). The first one can be checked by comparing policy->governor with 'cpufreq_gov_conservative' and the second one isn't that important. In the worst case, we will end up updating dbs_info->requested_freq. And that wouldn't do any harm. Lets get rid of this field. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_conservative.c | 26 +++++++++++++++----------- drivers/cpufreq/cpufreq_governor.c | 12 +----------- drivers/cpufreq/cpufreq_governor.h | 1 - 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 1e3cabfb2b57..f53719e5bed9 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c @@ -23,6 +23,19 @@ static DEFINE_PER_CPU(struct cs_cpu_dbs_info_s, cs_cpu_dbs_info); +static int cs_cpufreq_governor_dbs(struct cpufreq_policy *policy, + unsigned int event); + +#ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE +static +#endif +struct cpufreq_governor cpufreq_gov_conservative = { + .name = "conservative", + .governor = cs_cpufreq_governor_dbs, + .max_transition_latency = TRANSITION_LATENCY_LIMIT, + .owner = THIS_MODULE, +}; + static inline unsigned int get_freq_target(struct cs_dbs_tuners *cs_tuners, struct cpufreq_policy *policy) { @@ -124,7 +137,8 @@ static int dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val, if (!policy) return 0; - if (!dbs_info->enable) + /* policy isn't governed by conservative governor */ + if (policy->governor != &cpufreq_gov_conservative) goto policy_put; /* @@ -371,16 +385,6 @@ static int cs_cpufreq_governor_dbs(struct cpufreq_policy *policy, return cpufreq_governor_dbs(policy, &cs_dbs_cdata, event); } -#ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE -static -#endif -struct cpufreq_governor cpufreq_gov_conservative = { - .name = "conservative", - .governor = cs_cpufreq_governor_dbs, - .max_transition_latency = TRANSITION_LATENCY_LIMIT, - .owner = THIS_MODULE, -}; - static int __init cpufreq_gov_dbs_init(void) { return cpufreq_register_governor(&cpufreq_gov_conservative); diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index af63402a94a9..836aefd03c1b 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -463,7 +463,6 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy, cdata->get_cpu_dbs_info_s(cpu); cs_dbs_info->down_skip = 0; - cs_dbs_info->enable = 1; cs_dbs_info->requested_freq = policy->cur; } else { struct od_ops *od_ops = cdata->gov_ops; @@ -482,9 +481,7 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy, static int cpufreq_governor_stop(struct cpufreq_policy *policy, struct dbs_data *dbs_data) { - struct common_dbs_data *cdata = dbs_data->cdata; - unsigned int cpu = policy->cpu; - struct cpu_dbs_info *cdbs = cdata->get_cpu_cdbs(cpu); + struct cpu_dbs_info *cdbs = dbs_data->cdata->get_cpu_cdbs(policy->cpu); struct cpu_common_dbs_info *ccdbs = cdbs->ccdbs; /* State should be equivalent to START */ @@ -493,13 +490,6 @@ static int cpufreq_governor_stop(struct cpufreq_policy *policy, gov_cancel_work(dbs_data, policy); - if (cdata->governor == GOV_CONSERVATIVE) { - struct cs_cpu_dbs_info_s *cs_dbs_info = - cdata->get_cpu_dbs_info_s(cpu); - - cs_dbs_info->enable = 0; - } - ccdbs->policy = NULL; mutex_destroy(&ccdbs->timer_mutex); return 0; diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 2125c299c602..a0d24149f18c 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h @@ -170,7 +170,6 @@ struct cs_cpu_dbs_info_s { struct cpu_dbs_info cdbs; unsigned int down_skip; unsigned int requested_freq; - unsigned int enable:1; }; /* Per policy Governors sysfs tunables */