Received: by 10.192.165.148 with SMTP id m20csp4193736imm; Mon, 23 Apr 2018 21:24:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx488/xuO1gRgfk6HkuOBfiaRS5P/aDTp/CxWhaYrjJHaRJXlDVkKZWm5ob5A8XaiWLyDRspl X-Received: by 10.99.2.199 with SMTP id 190mr19504359pgc.11.1524543842491; Mon, 23 Apr 2018 21:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524543842; cv=none; d=google.com; s=arc-20160816; b=EWF4mKwxYgRuZBiDq3lapYy5WXEoqdDjH6Zp9aE3q5qvwyuwQw39Uuy7rw8q7wZcAA gaO2t67vEFUzM9z0BaGRyH+bqRB2WohM/aJstzky7K/nFYloHdXFyBfBg1M2mmdM9G7Z LefgYrGMvDT7ZV7BfQ+a4SWSYl3wmzywXM76AHQnI8f7rfn2oPXoudeVXBiKR8jzHSXb V0b6+9MaiZhOaKmK0UyhE2xprQTSsA2p7tkEjZ+gfDnT0doniLe37WSLfUsdhRVeb89a QvrEagAYtmk7xMekZriMpQ24ce9RH02nUOI886dpWezYVs7iqCuhwZZmbHX91vNv0O4w 78rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:cc:to:from :reply-to:subject:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=Og3YOrum1hE7IJK+JEAd8+3WSci9nSDqsTQrhuOdzZA=; b=Gl1CeQpyuE1pK+83dNRZVbzXYWTiAawu80KS0HLiW1AAj/PhmaYVBYlS5d1q2fhBS7 0ieV+Rn7tKDN8Sr77lbeMjOb72C7ZBiyD4XoA5URqKfhSKJCh+qZ194BFvRSkNxVfHrH 5gD8659ETa9ktdiFo0BzUGAlzvRIyL+cXDr/mtp/HMXJv/rTdpwo3YSMkbTbyJYkt8wG dXJrsTbcdOLly4R9J8ikYjNtPCdTpcTXqT0GTJtLKFlJKm4zIK/bePixVZiPjlvSTXQt r5oQAkLqLEF9Oz9nvCkl8BjF6p5+Qq0uRBMiMgiqaWlXPEbVfWa+ftpgN8882/hZvuX8 K74w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=e3/HCQuV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o128si12861348pfg.5.2018.04.23.21.23.47; Mon, 23 Apr 2018 21:24:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=e3/HCQuV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752030AbeDXEWm (ORCPT + 99 others); Tue, 24 Apr 2018 00:22:42 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:41047 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751089AbeDXEWi (ORCPT ); Tue, 24 Apr 2018 00:22:38 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20180424042237epoutp01d73aa94b72538bdb6a98b078c36a5b25~oRHg_OKjH2077920779epoutp01G for ; Tue, 24 Apr 2018 04:22:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20180424042237epoutp01d73aa94b72538bdb6a98b078c36a5b25~oRHg_OKjH2077920779epoutp01G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1524543757; bh=Og3YOrum1hE7IJK+JEAd8+3WSci9nSDqsTQrhuOdzZA=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=e3/HCQuVd683uZg6E8fnKkKykNJE1H9jzR3B0w5fo10AyVle3Pm+/6wW2NhGhxE2Y oR4mPi0LZRPvtTgLyoJoQYselAsjLv6e5EqubUmV58K3WC2zi87Lf7O2wOGEuGXX3x cCz6PJUDFxToe6fv1XAoZU2QybMfU2L+lVB2e+gk= Received: from epsmges1p2.samsung.com (unknown [182.195.40.157]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20180424042234epcas1p1285404f5d75903bff2ab00087f0958ef~oRHeYVLVU2206922069epcas1p1U; Tue, 24 Apr 2018 04:22:34 +0000 (GMT) X-AuditID: b6c32a36-b55ff70000001027-ee-5adeb10a44ab Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 33.4E.04135.A01BEDA5; Tue, 24 Apr 2018 13:22:34 +0900 (KST) Mime-Version: 1.0 Subject: RE: [PATCH 6/6] devfreq: rk3399_dmc: register devfreq notification to dmc driver. Reply-To: myungjoo.ham@samsung.com From: MyungJoo Ham To: Enric Balletbo i Serra , Kyungmin Park , "robh+dt@kernel.org" CC: "devicetree@vger.kernel.org" , "heiko@sntech.de" , "linux-pm@vger.kernel.org" , "dbasehore@chromium.org" , "linux-kernel@vger.kernel.org" , "dianders@google.com" , "groek@google.com" , "kernel@collabora.com" , Lin Huang , Elaine Zhang , Chanwoo Choi , "linux-rockchip@lists.infradead.org" , "linux-arm-kernel@lists.infradead.org" , Geert Uytterhoeven , Jeffy Chen , Ulf Hansson X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20180419104019.24406-7-enric.balletbo@collabora.com> X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20180424042233epcms1p7b27cb007b11ed467d773ce93d8bc7ed4@epcms1p7> Date: Tue, 24 Apr 2018 13:22:33 +0900 X-CMS-MailID: 20180424042233epcms1p7b27cb007b11ed467d773ce93d8bc7ed4 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-CPGSPASS: Y X-CPGSPASS: Y X-MTR: 20180424042233epcms1p7b27cb007b11ed467d773ce93d8bc7ed4 CMS-TYPE: 101P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFJsWRmVeSWpSXmKPExsWy7bCmgS7XxntRBmu3c1u8PKRpcf3Lc1aL V5v3sFnMP3KO1WLB9pVMFmtuH2K0mDt7EqNF09vtLBb/H71mtfix4RSzxfcbZ9ksNp/rYbU4 2/SG3WLT42usFpd3zWGz+Nx7hNHi04P/zBate4+wWxxfG25xa+JNJgcRj9kNF1k8dtxdwugx 8ayux4JNpR6bVnWyedy5tofNY/OSeo+/s/azePRtWcXosf3aPGaPz5vkArijUm0yUhNTUosU UvOS81My89JtlbyD453jTc0MDHUNLS3MlRTyEnNTbZVcfAJ03TJzgB5UUihLzCkFCgUkFhcr 6dvZFOWXlqQqZOQXl9gqRRsaGukZGpjrGRkBaeNYKyNToJKE1Ixzh9+zF6zhrdjy6A9rA+Nh 7i5GTg4JAROJo1PmsnQxcnEICexglOi+sI69i5GDg1dAUOLvDmGQGmGBGIkNPUtZQWwhASWJ hpv7mCHi+hIdD7YxgthsAroSWzfcBZsjIjCRUeLY5TZWEIdZYBWbxLOmm6wQ23glZrQ/ZYGw pSW2L98K1s0p4CQx9eheqLioxM3Vb9lh7PfH5jNC2CISrffOMkPYghIPfu6GiktJPHm7EKq+ XuL650VMIIslBCYwSvy+8R8qoS/x6MpsNhCbV8BXovvOJrA4i4CqRNNikAaQGheJjdO2gcWZ BeQltr+dwwwKCWYBTYn1u/Rh7m/Y+Jsdk20rMXHuTyaIVj6Jd1974P7dMe8J1Hg1iUO7l0DV y0icnr6QeQKj8ixEWM9CsngWwuIFjMyrGMVSC4pz01OLDQuM9IoTc4tL89L1kvNzNzGC07mW 2Q7GRed8DjEKcDAq8fAu+Hk3Sog1say4MvcQowQHs5II7165e1FCvCmJlVWpRfnxRaU5qcWH GE2B/p/ILCWanA/MNXkl8YamRsbGxhYmhmamhoZK4rxPfc5ECQmkJ5akZqemFqQWwfQxcXBK NTAuFnkgO/t/07p40c9rTfu1BL/7214N8bNy5Wq7fvnCi/2n8zn4ud8can/acm3m/UqpFXGp RxZfEWSaV5Xrv/xRvcWB1xnsf43avQpmbT7/2ojTO9vK+WVqfIbp6tUGTd6/Y9fyTVnIsX4G Q+/Hgtd2M511SxLdLD5KGr5L27foc9jvcpPVG3OVWIozEg21mIuKEwF4rAAd/QMAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180419104059epcas2p3fe5aba95859e02307556200a42bc1ac2 X-RootMTR: 20180419104059epcas2p3fe5aba95859e02307556200a42bc1ac2 References: <20180419104019.24406-7-enric.balletbo@collabora.com> <20180419104019.24406-1-enric.balletbo@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >From: Lin Huang > >Because dmc may also access the PMU_BUS_IDLE_REQ register, we need to >ensure that the pd driver and the dmc driver will not access at this >register at the same time. > >Signed-off-by: Lin Huang >Signed-off-by: Enric Balletbo i Serra >--- > > drivers/devfreq/rk3399_dmc.c | 47 +---------------------- > drivers/soc/rockchip/pm_domains.c | 31 +++++++++++++++ > include/soc/rockchip/rk3399_dmc.h | 63 +++++++++++++++++++++++++++++++ > 3 files changed, 96 insertions(+), 45 deletions(-) > create mode 100644 include/soc/rockchip/rk3399_dmc.h > >diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c >index 5bfca028eaaf..a1f320634d69 100644 >--- a/drivers/devfreq/rk3399_dmc.c >+++ b/drivers/devfreq/rk3399_dmc.c [] >diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c >index 53efc386b1ad..7acc836e7eb7 100644 >--- a/drivers/soc/rockchip/pm_domains.c >+++ b/drivers/soc/rockchip/pm_domains.c [] >+static int dmc_notify(struct notifier_block *nb, unsigned long event, >+ void *data) >+{ >+ if (event == DEVFREQ_PRECHANGE) >+ mutex_lock(&dmc_pmu->mutex); >+ else if (event == DEVFREQ_POSTCHANGE) >+ mutex_unlock(&dmc_pmu->mutex); >+ >+ return NOTIFY_OK; >+} >+ Doesn't this incur a deadlock? 1. devfreq.c:update_freq calls devfreq_notify_transition(DEVFREQ_PRECHANGE) 2. pm_domain.c:dmc_notify calls mutex_lock(dmc_pmu->mutex) 3. devfreq.c:update_freq calls target callback 4. rk3399_dmc.c:rk3399_dmcfreq_target calls mutex_lock(&dmcfreq->lock) >>>>>> update_freq cannot proceed. <<<< Cheers, MyungJoo