From patchwork Sun Dec 16 05:50:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 1884401 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 BC39EE00A4 for ; Sun, 16 Dec 2012 05:50:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750926Ab2LPFu1 (ORCPT ); Sun, 16 Dec 2012 00:50:27 -0500 Received: from mail-da0-f46.google.com ([209.85.210.46]:52069 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750919Ab2LPFuY (ORCPT ); Sun, 16 Dec 2012 00:50:24 -0500 Received: by mail-da0-f46.google.com with SMTP id p5so2231970dak.19 for ; Sat, 15 Dec 2012 21:50:21 -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:x-gm-message-state; bh=hVBwJem/toDUEj/eBkmWeyak7e3FNyuiVEFSKvP8+EI=; b=AJCs/Z5/fBhp7u8QTb56OGdnhIKMIY+EUQ97bh9BI+SN5lG92HPXTAUNSPVzMTptnX 7bXJ7uY2xBc3PgAcJRLYRjMTo12+LwDC8qCUcetkaUE6eUYGLiJo5FUHEBIq4QRh5R1+ FKrGg1FJUoktpHqKCvHSziueeQNcNmy9sxfFwvFZTtww9jANuJguwrWUhfKZGYhDiuzx HU+JAIWTwkhrH3aV9B1qHiOfMsHJoupFmOdpHlxN6aLHo2DnL5K75f15vgDmTaqZysnJ D7DyiHPzMo2qwBvelsWkq8Sum2zio4BebZFfVIOKy8hSQk4gnYqUqMfwA/8a93VincRl TejA== Received: by 10.68.134.130 with SMTP id pk2mr31111741pbb.31.1355637020874; Sat, 15 Dec 2012 21:50:20 -0800 (PST) Received: from localhost ([122.166.179.207]) by mx.google.com with ESMTPS id vs3sm5845026pbc.61.2012.12.15.21.50.16 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 15 Dec 2012 21:50:20 -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 1/3] cpufreq: Manage only online cpus Date: Sun, 16 Dec 2012 11:20:08 +0530 Message-Id: <98330b2deb910453a356404b8cf774c94326bc42.1355636864.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e X-Gm-Message-State: ALoCoQnz8tZj8ceeMPXp+52fjUYUlV6Yh80LWH6C4xYv/cTwS3EjZuXaCh4gqJTn4pAIATs6d3WK Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org cpufreq core doesn't manage offline cpus and if driver->init() has returned mask including offline cpus, it may result in unwanted behavior by cpufreq core or governors. We need to get only online cpus in this mask. There are two places to fix this mask, cpufreq core and cpufreq driver. It makes sense to do this at common place and hence is done in core. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 1f93dbd..de99517 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -970,6 +970,13 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) pr_debug("initialization failed\n"); goto err_unlock_policy; } + + /* + * affected cpus must always be the one, which are online. We aren't + * managing offline cpus here. + */ + cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); + policy->user_policy.min = policy->min; policy->user_policy.max = policy->max;