From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A6D4C433DF for ; Tue, 11 Aug 2020 09:29:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E70E020772 for ; Tue, 11 Aug 2020 09:29:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="l0GxU/h2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E70E020772 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CHOTvgLuafVnX5usclDMaHgDIKeW6yQFWLPaC50T/V8=; b=l0GxU/h2O5ioHS+HF4U6cg3wc H1+evaH1CBDQQ38PC2Aj0zP1+x3RID+uR3dIH1h6O1v8oDMgnNJmO1Kb8YcRv4LjVkPw0ckUshF2o qAeXlVewsKM9J1boHxVLLPD3xlPKzMCDylircuZu6j4yIDhsGaFXMMbeOBY4k8yRGiWvU9LA1NoYs 58DDKlJN2NjRZDWc4syJfUKhFl4nX/A2HUbzEogipksoYa7OvTokxCvlhU3oLrDZP0X4wwWR3MEMg tYryON8QYrYf61L8M80K6wVWGU2vaysFnNiCHttx+1QiuCnZQQJYx8VwqHO4t6EpguXiXcQCsykee MNK+VyYAA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k5QZL-0007Vd-Am; Tue, 11 Aug 2020 09:27:43 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k5QZI-0007VG-RB for linux-arm-kernel@lists.infradead.org; Tue, 11 Aug 2020 09:27:41 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3F0DC1063; Tue, 11 Aug 2020 02:27:35 -0700 (PDT) Received: from [10.37.12.49] (unknown [10.37.12.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CED8D3F22E; Tue, 11 Aug 2020 02:27:33 -0700 (PDT) Subject: Re: [RFC] memory: exynos5422-dmc: Document mutex scope To: Krzysztof Kozlowski References: <20200724180857.22119-1-krzk@kernel.org> <3522860a-8158-6e71-9d65-01d0e0c15f0d@arm.com> From: Lukasz Luba Message-ID: <6db3a6a4-fe56-d448-14c7-ed43de809acb@arm.com> Date: Tue, 11 Aug 2020 10:27:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200811_052740_935695_B320D745 X-CRM114-Status: GOOD ( 17.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-samsung-soc@vger.kernel.org" , Kukjin Kim , "linux-kernel@vger.kernel.org" , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 8/9/20 10:12 AM, Krzysztof Kozlowski wrote: > On Tue, Aug 04, 2020 at 11:40:07AM +0100, Lukasz Luba wrote: >> Hi Krzysztof, >> >> On 7/24/20 7:08 PM, Krzysztof Kozlowski wrote: >>> Document scope of the mutex used by driver. >>> >>> Signed-off-by: Krzysztof Kozlowski >>> >>> --- >>> >>> It seems mutex was introduced to protect: >>> 1. setting actual frequency/voltage, >>> 2. dmc->curr_rate (in exynos5_dmc_get_cur_freq()). >>> >>> However dmc->curr_rate in exynos5_dmc_get_status() is not protected. Is >>> it a bug? >> >> The callback get_dev_status() from devfreq->profile, which here is the >> exynos5_dmc_get_status() should be already called with devfreq->lock >> mutex hold, like e.g from simple_ondemand governor or directly >> using update_devfreq exported function: >> update_devfreq() >> ->get_target_freq() >> devfreq_update_stats() >> df->profile->get_dev_status() >> >> The dmc->curr_rate is also used from sysfs interface from devfreq. >> The local dmc lock serializes also this use case (when the HW freq >> has changed but not set yet into curr_rate. > > These are different locks. You cannot protect dmc->curr_rate with > devfreq->lock in one place and dmc-lock in other place. This won't > protect it. There are different paths that framework goes and mainly they are protected by the df->lock. But I tend to agree, I will send a patch which adds some locking. Regards, Lukasz _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel