Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2559982ybk; Tue, 12 May 2020 02:25:16 -0700 (PDT) X-Google-Smtp-Source: APiQypIuxg41x0VKeFBTm2WHPTUOP/hXcHn066joe2XR9/bFiKHPT4lGkoimtowZENkiwLKpNvBC X-Received: by 2002:a17:906:5f99:: with SMTP id a25mr15652172eju.54.1589275516105; Tue, 12 May 2020 02:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589275516; cv=none; d=google.com; s=arc-20160816; b=n5oB/poOoly7AqDihxELP2VqMl4SEGt/vNV8skc8JhH/lfwZ/DZH0Ry6pT+uYriSGv vlpEHuNcijAMSlyijB89TQmjfQgCjOtXFSb4BSPWYXtZWRoWZD5oaFmdXC3GEMiEoIeI +fvNCW1X7L1UbiFCh9BVdQ4JhxpngrASxdxPUOnae66f5TYS9OZIOSKKQvt/L9dwxr2j RHR1EsY/rKpZ4s8EBbrmobNUruDaWn3ys/4EXwihzA7LhAQQC+mZNPzb6rdkorgRXPUE keiT7XKg4sRlhjFWF1LWbNnuC1cE0IkGNwmpKQ04pfSYWdH3hSNC0rY5zrSrlXfviVM8 KgXQ== 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=bdWxkcSeZh93XuC0UGrYFHnK296FbdQN8CbWu5it6XQ=; b=pc8lcXTRhvHUskHQco3mfrqWd5bc+CLuZRO91mdX2wvaZtG+Lmo8ip7BCDNC6rl1KH sq8LYKFK3/BuW0BDJ5l/B/Uioc8IuHNRS1WT5S70nPoJX1i2rRno3fG0ohv4TPebIk16 IoxKfgZsCy90qnvRwYFVQ6578SeXxwKtKQ9e/v+8zphuk4RmbpGU7rTYhtgAS1cdXdoz fD/yWd8iWJDHP4SdfpJT+rkSaypcp0H7spAsQ7soPmqi7hb17IdL6x7C0ccmcIQXMEA7 rdqSmJTiCiiDLbQICIVdCIqmIdecLe14RY/AGEoi0h9622uYcFKnkhu1OO9kfcnDxj/Y 2EkA== 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 r15si6920354ejr.33.2020.05.12.02.24.52; Tue, 12 May 2020 02:25:16 -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 S1729207AbgELJXI (ORCPT + 99 others); Tue, 12 May 2020 05:23:08 -0400 Received: from foss.arm.com ([217.140.110.172]:50852 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725889AbgELJXH (ORCPT ); Tue, 12 May 2020 05:23:07 -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 F221A1045; Tue, 12 May 2020 02:23:06 -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 65BAC3F305; Tue, 12 May 2020 02:23:05 -0700 (PDT) Subject: Re: [PATCH] memory/samsung: reduce unnecessary mutex lock area To: Krzysztof Kozlowski Cc: Bernard Zhao , 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 10:23:03 +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-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 On 5/12/20 10:05 AM, Krzysztof Kozlowski wrote: > On Tue, 12 May 2020 at 10:47, Lukasz Luba wrote: >> >> 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. > > I looked at this path (get_dev_status) and currently in devfreq it > will be only called from update_devfreq() -> get_target_freq()... at > least when looking at devfreq core and governors. On the other hand > you are right that this is public function and this call scenario > might change. It could be called directly from other paths sooner or > later. Indeed, I am currently changing this while I am adding devfreq devices to the Energy Model. > >> This patch should not be taken IMO. Maybe we can release lock before the >> if statement, just to speed-up. > > Yep. > > Bernard, you can send just this part of the patch. Thank you Bernard and please submit the patch v2. > > Best regards, > Krzysztof > Thank you Krzysztof for your time spent on this. Regards, Lukasz