Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2539669ybk; Tue, 12 May 2020 01:51:20 -0700 (PDT) X-Google-Smtp-Source: APiQypLXgP26xihydS8CsirOxtWZ/v1jdkBo3KHHmtI2Yfu8JIqv4g05fjoNC+8ItvDOdGabpq1S X-Received: by 2002:a05:6402:2d5:: with SMTP id b21mr16060737edx.291.1589273480093; Tue, 12 May 2020 01:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589273480; cv=none; d=google.com; s=arc-20160816; b=sufPtPF3g3tFAzC4e5NIFj4OQTGd1RWvU1XAB/D8n8OZGQEgSInCtgb1GHb+oALeU/ FULdFYHoPngbbvjnFy80/8BVxQNGswVP/5UHBPum8JPAfpijWn+a0WSiYC02lU0la6vz uNuTekhfo+oXtEbVr/3NMYzJ5HkZxpPKY+PRtshnvXzkkex7Q9379opHr1J6cLW5hwPe RYnibk3BjOO9k30xbj3psfoqPbingXOwUHCTxmHV9COdfzWdbRP3RL8UTfOvY/CXlcVa M4RcaEssnoCayjz320SCRXlaI8Ep9cMsCbYoQniOKcGaEaxkhnsDM/aX7JCNuzUrxFdx zS7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=NlNBL4sjSrfiyHQmO8AKKdaZawhYt/bH5RTCoNqNlXk=; b=vPtWTGOWgnl2dEVd9C9I6xWgu2M5OUGwvUlVt2j8YojfkR5rfRh6FWB5EpfsS1aaDX BEIzUvQYsvIsz05WSF/qGzJxJoMpQTnuqfQKXK6aOR+kYrT0hJyZEVVN/xnGirP2rf/g t2JQhRFpUB0th+SjeDojMF8Zq2ziOPwygUs7ff/iZ8wzSlS6Fg0NEsncREft9wDcc/1w S0Znow9RB22wrNeOjyR9kP2VdYknzjswTE1dJT3iov6pWPKkAPeJR1a27E5dseKXtLsU 0E3b/6AMBxia8rBi1ef7HFYih9Sc0t7pRmsJ5r6Kw1WvAxjDaN4IUCAGeHgFgN8aTMC5 mJIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si7570653edg.149.2020.05.12.01.50.56; Tue, 12 May 2020 01:51:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729120AbgELIrY (ORCPT + 99 others); Tue, 12 May 2020 04:47:24 -0400 Received: from foss.arm.com ([217.140.110.172]:49504 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbgELIrY (ORCPT ); Tue, 12 May 2020 04:47:24 -0400 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 B14F21FB; Tue, 12 May 2020 01:47:23 -0700 (PDT) Received: from [10.37.12.83] (unknown [10.37.12.83]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A066F3F305; Tue, 12 May 2020 01:47:21 -0700 (PDT) Subject: Re: [PATCH] memory/samsung: reduce unnecessary mutex lock area To: Krzysztof Kozlowski , Bernard Zhao Cc: Kukjin Kim , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com References: <20200508131338.32956-1-bernard@vivo.com> <20200512065023.GA10741@kozik-lap> From: Lukasz Luba Message-ID: Date: Tue, 12 May 2020 09:47:19 +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: <20200512065023.GA10741@kozik-lap> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Krzysztof, I am sorry, I was a bit busy recently. On 5/12/20 7:50 AM, Krzysztof Kozlowski wrote: > On Fri, May 08, 2020 at 06:13:38AM -0700, Bernard Zhao wrote: >> Maybe dmc->df->lock is unnecessary to protect function >> exynos5_dmc_perf_events_check(dmc). If we have to protect, >> dmc->lock is more better and more effective. >> Also, it seems not needed to protect "if (ret) & dev_warn" >> branch. >> >> Signed-off-by: Bernard Zhao >> --- >> drivers/memory/samsung/exynos5422-dmc.c | 6 ++---- >> 1 file changed, 2 insertions(+), 4 deletions(-) > > I checked the concurrent accesses and it looks correct. > > Lukasz, any review from your side? The lock from devfreq lock protects from a scenario when concurrent access from devfreq framework uses internal dmc fields 'load' and 'total' (which are set to 'busy_time', 'total_time'). The .get_dev_status can be called at any time (even due to thermal devfreq cooling action) and reads above fields. That's why the calculation of the new values inside dmc is protected. This patch should not be taken IMO. Maybe we can release lock before the if statement, just to speed-up. Regards, Lukasz > > Best regards, > Krzysztof >