From patchwork Sun Dec 16 05:50:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 1884411 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id DF8BBE0173 for ; Sun, 16 Dec 2012 05:50:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751727Ab2LPFua (ORCPT ); Sun, 16 Dec 2012 00:50:30 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:65235 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750919Ab2LPFu2 (ORCPT ); Sun, 16 Dec 2012 00:50:28 -0500 Received: by mail-pa0-f46.google.com with SMTP id bh2so3327198pad.19 for ; Sat, 15 Dec 2012 21:50:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=6ZM9p6YiFPwUO/wHdcPkpXFCi3N9pUeB8vZynpmVdQU=; b=C9Ghei4mbaTbzaB+wUuHIVSKi8dbPNVd4n/IwxAMq2e0lnvOp7MzwiGY9vB88eBCFL uPzE/Z2ZBU9VrZy7sdwecBSc8t7dBPZB/TQ7nbYHcq0KiRFaPs5FlFTFKxiCifBHZ85b nVFPX/sGclex/umbr4pLMrI174Mre9Ve2k1guR9rCJRYceuAyl4+uFjLd97f1L5GZ8Gq VF84eGCXiPyF0ddyPbLHDsnnERQZ1dsuzn5Pg6Zd1vGwUL/2ixdY7pGITdepBLExpzOx mrmVFa9fkW7EgyUPvXPFviGpzz/BzjWR9GntTFLoJJl1mSA/36lkYwhWGO+zkVcbsjdc PmBQ== Received: by 10.68.135.99 with SMTP id pr3mr31284198pbb.151.1355637027994; Sat, 15 Dec 2012 21:50:27 -0800 (PST) Received: from localhost ([122.166.179.207]) by mx.google.com with ESMTPS id ir4sm5850128pbc.41.2012.12.15.21.50.23 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 15 Dec 2012 21:50:27 -0800 (PST) From: Viresh Kumar To: rjw@sisk.pl, rafael.j.wysocki@intel.com Cc: linaro-dev@lists.linaro.org, nicolas.pitre@linaro.org, amit.kucheria@linaro.org, mathieu.poirier@linaro.org, linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, pdsw-power-team@arm.com, linux-pm@vger.kernel.org, Viresh Kumar Subject: [PATCH 2/3] cpufreq: Notify governors when cpus are hot-[un]plugged Date: Sun, 16 Dec 2012 11:20:09 +0530 Message-Id: <0464826f8b1fff4555fb0f38032220d1cc591396.1355636864.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <98330b2deb910453a356404b8cf774c94326bc42.1355636864.git.viresh.kumar@linaro.org> References: <98330b2deb910453a356404b8cf774c94326bc42.1355636864.git.viresh.kumar@linaro.org> In-Reply-To: <98330b2deb910453a356404b8cf774c94326bc42.1355636864.git.viresh.kumar@linaro.org> References: <98330b2deb910453a356404b8cf774c94326bc42.1355636864.git.viresh.kumar@linaro.org> X-Gm-Message-State: ALoCoQk0yspLOS6Yxq+M3r3npAwooXie222JYAsbnnN9TbzmGqxt99K8ljfN4o9O7ps3yys5VB4R Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Because cpufreq core and governors worry only about the online cpus, if a cpu is hot [un]plugged, we must notify governors about it, otherwise be ready to expect something unexpected. We already have notifiers in the form of CPUFREQ_GOV_START/CPUFREQ_GOV_STOP, we just need to call them now. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index de99517..a0a33bd 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -751,11 +751,16 @@ static int cpufreq_add_dev_policy(unsigned int cpu, return -EBUSY; } + __cpufreq_governor(managed_policy, CPUFREQ_GOV_STOP); + spin_lock_irqsave(&cpufreq_driver_lock, flags); cpumask_copy(managed_policy->cpus, policy->cpus); per_cpu(cpufreq_cpu_data, cpu) = managed_policy; spin_unlock_irqrestore(&cpufreq_driver_lock, flags); + __cpufreq_governor(managed_policy, CPUFREQ_GOV_START); + __cpufreq_governor(managed_policy, CPUFREQ_GOV_LIMITS); + pr_debug("CPU already managed, adding link\n"); ret = sysfs_create_link(&dev->kobj, &managed_policy->kobj, @@ -1066,8 +1071,13 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif */ if (unlikely(cpu != data->cpu)) { pr_debug("removing link\n"); + __cpufreq_governor(data, CPUFREQ_GOV_STOP); cpumask_clear_cpu(cpu, data->cpus); spin_unlock_irqrestore(&cpufreq_driver_lock, flags); + + __cpufreq_governor(data, CPUFREQ_GOV_START); + __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); + kobj = &dev->kobj; cpufreq_cpu_put(data); unlock_policy_rwsem_write(cpu);