Received: by 10.192.165.148 with SMTP id m20csp4355989imm; Tue, 24 Apr 2018 01:02:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+hg2643A3ZR5tuQv07BRgXsxusYXaxbzVJ+hBjktjU9U57aySOfZOw2iQyWYJPzvLJQcXr X-Received: by 10.101.93.7 with SMTP id e7mr19923043pgr.119.1524556950736; Tue, 24 Apr 2018 01:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524556950; cv=none; d=google.com; s=arc-20160816; b=0K6FV18yoB5yvBmUP5OZSds+MO5IeP8BH+FlowozZ0w4XPG4De/b6BdfecuLB9Qfrd fIvb/pxjLN5+jNx/Gy2AGgEY55PoaHs5DvPg6oD3/xvmzsp+hWh4etFkucDIxO/R4RL+ tgQF2/nCVaTXBUYlxyWA6Pd+HiVuDVZpK0CmZKaR+FRBjw6p1ozcZ7vfADQJZu2bgEIp L94E1RiM8oF5fOPhEHi7bm5rJl1Gkx6EzaSTpiqaHfFQU0D10VT1hYUxSHxTBrr3nCAJ WIZXLuswbL2MhUtcpY4f+hbCVqxMjso8bggVCaUtMDPCRmHV6qtMRcxoEhjIqpiwDQYj RdcA== 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:arc-authentication-results; bh=O+McDYdXNuHOePpQyqSXu1fBwS5FVhBFre9/xfKQH2Y=; b=MtfbvPYwZ8DpG1WkYYhcwbVw7isE+lEwosG6XyHAw5VlpGulirUNfnFQUIa9oJKT0T uPzoC33nVqRkE4K4NgJcK8Q6xuS/W5Ar06Y94dWNW4dsD/lGUnsRO2MknduYPfBLsqSd XjzZH6wNfGjcN+CZGi38tUQhWAhWwDQa3LDHWnHfB5ds7Wb7dXRT5+aVkt70NPmG2CHA PR0AmlH1fQ1+Q2U43ILr/GpNh9lMWtxgiIDQDStWZnbwrr4/5DMmxVljJkBGmVyynJxw BK7OXrZzz6hrvFqC8mU5pPqgggglmQO6GRLSueSvyJckjVAk7x7tlPzAxcqyr4+L5NUZ gvnQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si13516604pfi.87.2018.04.24.01.02.16; Tue, 24 Apr 2018 01:02:30 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756247AbeDXIBL (ORCPT + 99 others); Tue, 24 Apr 2018 04:01:11 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:45906 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752135AbeDXIBJ (ORCPT ); Tue, 24 Apr 2018 04:01:09 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 52D3327216E Subject: Re: [PATCH 6/6] devfreq: rk3399_dmc: register devfreq notification to dmc driver. To: myungjoo.ham@samsung.com, 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 References: <20180419104019.24406-7-enric.balletbo@collabora.com> <20180419104019.24406-1-enric.balletbo@collabora.com> <20180424042233epcms1p7b27cb007b11ed467d773ce93d8bc7ed4@epcms1p7> From: Enric Balletbo i Serra Message-ID: Date: Tue, 24 Apr 2018 10:01:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180424042233epcms1p7b27cb007b11ed467d773ce93d8bc7ed4@epcms1p7> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On 24/04/18 06:22, MyungJoo Ham wrote: >> 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. <<<< > Mmm, makes sense, but I did not detect this deadlock. As this patch is controversial let me remove this patch from these series and I'll send again with the other series that applies on top of these, the series I am working on are to add ddrfreq support in the drm rockchip driver. Thinking about it I guess makes more sense as 1-5 are just cleanups, 6 is a bit different, maybe more related to the work I am doing. Best regards, Enric > > Cheers, > MyungJoo >