From patchwork Sat Jan 12 05:14:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 1968591 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 C21D5DF230 for ; Sat, 12 Jan 2013 05:16:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753534Ab3ALFPK (ORCPT ); Sat, 12 Jan 2013 00:15:10 -0500 Received: from mail-pb0-f43.google.com ([209.85.160.43]:55499 "EHLO mail-pb0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750737Ab3ALFPF (ORCPT ); Sat, 12 Jan 2013 00:15:05 -0500 Received: by mail-pb0-f43.google.com with SMTP id um15so1307109pbc.16 for ; Fri, 11 Jan 2013 21:15:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received: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=PcEsj4mX126+L0OvOr7cnnndc15PaHfXe8iRMdBwZA9H//aP+FoEzG9tRgs6nRXcUk lVd7kj34Sd3KKHngYQ7w9fM5EIXAUtnSC6RSpXs3AqZxosI2kO6yp6lyJ5MIxbhoNnzJ isI26rm6hZ1oePvZoNeKqw2A/9jwGpLe5eOF/DYsV3sqw0xjQa2Ewys9HWueUON21o6W SkTBAWmCiWOYcgPgZdve8M1o6u4aXPIShcE0sW525WH992O0sUfn0Fh/HjbpeomHHBQp w13O/DP4rUzpNeGRcMRW8cBWpe5WvbHEvq7ays9MeH4MIp9Gf4R9+bGHf/G3LaBNm5PR ASGg== X-Received: by 10.68.197.135 with SMTP id iu7mr234030242pbc.71.1357967704822; Fri, 11 Jan 2013 21:15:04 -0800 (PST) Received: from localhost ([122.172.203.59]) by mx.google.com with ESMTPS id oj1sm4002739pbb.19.2013.01.11.21.15.01 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 11 Jan 2013 21:15:04 -0800 (PST) From: Viresh Kumar To: rjw@sisk.pl Cc: cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-dev@lists.linaro.org, patches@linaro.org, Viresh Kumar Subject: [PATCH 2/5] cpufreq: Notify governors when cpus are hot-[un]plugged Date: Sat, 12 Jan 2013 10:44:39 +0530 Message-Id: <6def83ce4bb23170d9c4fdf7a7105b90d3cb73b7.1357967566.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQkk/MFrs8WnaVgDiD4PYXmhUhMTRPjij0XHiAtA6mrZQ3jMMNKRsAUnVRTWg7wuBled+K1C 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);