From patchwork Wed Aug 6 08:10:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 34971 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A564D21137 for ; Wed, 6 Aug 2014 08:10:38 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf13029648pde.7 for ; Wed, 06 Aug 2014 01:10:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=6hgtq9ZC0sgrvTr8M5MsHUenfqWwMHkJNExJPyvBTmA=; b=FoIvHTSIq3IwflDk49Tx7OuBCNOnwBnafDvhOD9com2s8TvC7FSb//eUe4xYItA/dh zf2jlS9avgQ8LW/oKsp1y4vNhqSBaJQGpj6dexynMT7CMK192mMcJQmydYDoypPV6XU5 2ErHnlxgebcy24kAwZyFTGYBL21jgStptf8OznQ5LqTV8er7qomaaj9Vm6br3qwuAHTL BqxZeIFuH4vLFo9XoSn3LhyQVld2UcVwQpqjD3Sg3Znd3vLbq++3RVt90KZLweA19BOg FySq+AamSpcd1PECaewaaET1tgGP7FgjpNKZY3i6XeA3k+Sc7CO2CnwW30SN9qg1I8Qb ALrA== X-Gm-Message-State: ALoCoQk9mSoExRRH8IgDJZnk8JTLR/ls4DLtiKwWkCgb92EWqPXhxFG6pxJ/lzHCE18CLyK9y+qN X-Received: by 10.67.23.197 with SMTP id ic5mr4957427pad.24.1407312637964; Wed, 06 Aug 2014 01:10:37 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.11 with SMTP id 11ls69126qgm.98.gmail; Wed, 06 Aug 2014 01:10:37 -0700 (PDT) X-Received: by 10.220.2.136 with SMTP id 8mr9092602vcj.17.1407312637801; Wed, 06 Aug 2014 01:10:37 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id ol3si118501vcb.30.2014.08.06.01.10.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Aug 2014 01:10:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id la4so3510392vcb.33 for ; Wed, 06 Aug 2014 01:10:37 -0700 (PDT) X-Received: by 10.220.97.5 with SMTP id j5mr9286333vcn.16.1407312637712; Wed, 06 Aug 2014 01:10:37 -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.221.37.5 with SMTP id tc5csp6181vcb; Wed, 6 Aug 2014 01:10:37 -0700 (PDT) X-Received: by 10.68.164.4 with SMTP id ym4mr9862190pbb.53.1407312636045; Wed, 06 Aug 2014 01:10:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pu3si107796pdb.427.2014.08.06.01.10.35 for ; Wed, 06 Aug 2014 01:10:36 -0700 (PDT) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754817AbaHFIKd (ORCPT + 14 others); Wed, 6 Aug 2014 04:10:33 -0400 Received: from mail-ob0-f175.google.com ([209.85.214.175]:48114 "EHLO mail-ob0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753959AbaHFIKc (ORCPT ); Wed, 6 Aug 2014 04:10:32 -0400 Received: by mail-ob0-f175.google.com with SMTP id wp18so1554603obc.34 for ; Wed, 06 Aug 2014 01:10:30 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.159.164 with SMTP id xd4mr13026735oeb.19.1407312630738; Wed, 06 Aug 2014 01:10:30 -0700 (PDT) Received: by 10.182.233.166 with HTTP; Wed, 6 Aug 2014 01:10:30 -0700 (PDT) In-Reply-To: <53E1556B.5070304@codeaurora.org> References: <1406634362-811-1-git-send-email-prarit@redhat.com> <2066166.pXm4lKLOID@vostro.rjw.lan> <53DA8389.80804@redhat.com> <1917362.abr2Y4p7vh@vostro.rjw.lan> <53DA8A41.2030601@redhat.com> <53DAA60B.6040802@codeaurora.org> <53DAA749.5080506@redhat.com> <53DAA95B.2040505@codeaurora.org> <53DAB038.3050007@redhat.com> <53DABFA6.6090503@codeaurora.org> <53DACA26.1000908@redhat.com> <53DAE592.2030909@codeaurora.org> <53DB6B81.6050400@redhat.com> <53DBCBE8.6010809@codeaurora.org> <53DBE764.8050109@redhat.com> <53DBEC27.7050803@codeaurora.org> <53E0B657.4070007@redhat.com> <53E1556B.5070304@codeaurora.org> Date: Wed, 6 Aug 2014 13:40:30 +0530 Message-ID: Subject: Re: [PATCH] cpufreq, store_scaling_governor requires policy->rwsem to be held for duration of changing governors [v2] From: Viresh Kumar To: Saravana Kannan Cc: Prarit Bhargava , Stephen Boyd , "Rafael J. Wysocki" , Linux Kernel Mailing List , Lenny Szubowicz , "linux-pm@vger.kernel.org" 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.220.174 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: , On 6 August 2014 03:36, Saravana Kannan wrote: > Stephen and I looked into this. This is not a sysfs framework difference. > The reason we don't have this issue when we use global tunables is because > we add the attribute group to the cpufreq_global_kobject and that kobject > doesn't have a kobj_type ops similar to the per policy kobject. So, > read/write to those attributes do NOT go through the generic show/store ops > that wrap every other cpufreq framework attribute read/writes. > > So, none of those read/write do any kind of locking. They don't race with > POLICY_EXIT (because we remove the sysfs group first thing in POLICY_EXIT) > but might still race with START/STOPs (not sure, haven't looked closely > yet). > > For example, writing to sampling_rate of ondemand governor might cause a > race in update_sampling_rate(). It could race and happen between a STOP and > POLICY_EXIT (triggered by hotplug, gov change, etc). This sounds good but I couldn't prove it. Doing this on my dual core exynos doesn't give me that crash report and it should? .target_index = exynos_target, .get = cpufreq_generic_get, --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index 1e0ec57..027b6f7 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c @@ -139,7 +139,7 @@ static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy) } static struct cpufreq_driver exynos_driver = { - .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, + .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK | CPUFREQ_HAVE_GOVERNOR_PER_POLICY, .verify = cpufreq_generic_frequency_table_verify,