From patchwork Thu May 16 09:28:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 16981 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7A24A2391B for ; Thu, 16 May 2013 09:31:04 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id bv4sf649744qab.10 for ; Thu, 16 May 2013 02:30:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe; bh=uTjRMGgEToquszcA53pe4rSFNRvT8cptg6RFxBSas6s=; b=PSGrmT0Vd7RDZ6CwqKd0Ui6TFe3sNHEwPOeC9hNXb+31z+Z3AVCfpjoXk89wwcQrAb dAQUB4lVrNv/WaHROrggFdRWiuZm/oUZGNTrxzzJjg+7dE6Goo9Yp3Mpg+ChMguEzPGq kg13PckomF53mzu3oMDdkJMJ0QOpv8ApFvVuIcdgr+vmInNGf9GcD8h1af0P2+iG/iuJ ftkaPb5huwF36sIYov0uEZH7VU9jgmG2CXAI9suAnH1wnP9U2vbhoZLFQ/bMlxGNM+9+ QgaCfvyzn1ddCirEp0DC1PIMi2iqdy+q3GqSRNLp7NQJt1kRi2VmbqRNkPW7XdQbcPxg uE3g== X-Received: by 10.236.21.198 with SMTP id r46mr20093032yhr.12.1368696625670; Thu, 16 May 2013 02:30:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.74.137 with SMTP id t9ls1137604qev.23.gmail; Thu, 16 May 2013 02:30:25 -0700 (PDT) X-Received: by 10.52.68.49 with SMTP id s17mr23262416vdt.92.1368696625479; Thu, 16 May 2013 02:30:25 -0700 (PDT) Received: from mail-vb0-x236.google.com (mail-vb0-x236.google.com [2607:f8b0:400c:c02::236]) by mx.google.com with ESMTPS id i3si3498789vez.15.2013.05.16.02.30.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 02:30:25 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::236; Received: by mail-vb0-f54.google.com with SMTP id f12so1226514vbg.13 for ; Thu, 16 May 2013 02:30:25 -0700 (PDT) X-Received: by 10.58.172.67 with SMTP id ba3mr26974519vec.58.1368696625301; Thu, 16 May 2013 02:30:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp55972vcs; Thu, 16 May 2013 02:30:24 -0700 (PDT) X-Received: by 10.68.224.65 with SMTP id ra1mr41954533pbc.103.1368696624155; Thu, 16 May 2013 02:30:24 -0700 (PDT) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by mx.google.com with ESMTPS id wu3si4087033pbc.340.2013.05.16.02.30.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 02:30:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.43 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.43; Received: by mail-pa0-f43.google.com with SMTP id hz10so2348381pad.2 for ; Thu, 16 May 2013 02:30:23 -0700 (PDT) X-Received: by 10.68.88.129 with SMTP id bg1mr42021156pbb.10.1368696623754; Thu, 16 May 2013 02:30:23 -0700 (PDT) Received: from localhost ([106.197.193.133]) by mx.google.com with ESMTPSA id ya4sm6125999pbb.24.2013.05.16.02.30.18 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 May 2013 02:30:23 -0700 (PDT) From: Viresh Kumar To: toddpoynor@google.com Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, robin.randhawa@arm.com, Steve.Bannister@arm.com, Liviu.Dudau@arm.com, charles.garcia-tobin@arm.com, arvind.chauhan@arm.com, android-kernel@googlegroups.com, viresh.kumar@linaro.org Subject: [PATCH 04/16] cpufreq: Call __cpufreq_governor() with correct policy->cpus mask Date: Thu, 16 May 2013 14:58:42 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQnlmClJCO1Hu/rIBoJPEJmFVzIYl/mnzvfC+5q7yupH2itau3n6oTmPUkfARoXeq/HPPtJQ X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , __cpufreq_governor() must be called with a correct policy->cpus mask. In __cpufreq_remove_dev() we initially clear policy->cpus with cpumask_clear_cpu() and then call __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT). If the governor is doing some per-cpu stuff in EXIT callback, this can create uncertain behavior. Generic governors in drivers/cpufreq/ doesn't do any per-cpu stuff in EXIT callback and so we don't face any issues currently. But its better to keep the code clean, so we don't face any issues in future. Now, we call cpumask_clear_cpu() only when multiple cpus are managed by policy. Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cpufreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 85963fc..0072b46 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1036,7 +1036,9 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif WARN_ON(lock_policy_rwsem_write(cpu)); cpus = cpumask_weight(data->cpus); - cpumask_clear_cpu(cpu, data->cpus); + + if (cpus > 1) + cpumask_clear_cpu(cpu, data->cpus); unlock_policy_rwsem_write(cpu); if (cpu != data->cpu) {