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=-10.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 4F3D0C433FF for ; Tue, 13 Aug 2019 20:06:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 2151720665 for ; Tue, 13 Aug 2019 20:06:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tWNk2uLC"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="E3Pt3KdL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2151720665 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=463uhitNiti09lTm6Aa+KM2HP0KKv+v/SAnObtk2UTw=; b=tWNk2uLCNhrE80 tQMPI2kFRij8OtAWDqTJJCfXJY7yX/Oy0/btvWp4u4LgsxI1DpI97mcSEVj2JThFLhmQ1MIlfZguI oEuY1RW3AbSaFU3lFDEVhOs+DAmC40x6z5MzPgN9Phpn0ybzOkfsiOfP2wRJnKcV80RmcCdI1TFTL 7voMdSnbwpKXp+hDYPriwlwXhCzPHMFSxhj8VzrOUakHNZrjoiieZqjNLpFHRSQaiVdKEnb3BfJdh CwIg4dU+WtQQL5OOMlCfp6hGiZrScnnXYJkN+5CnzlEKqiRKkUxoFGzmUZRcL/Gd5B0HRONy19+y7 mgFyhSWbAHiUXoutxYwg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hxd47-0006gJ-8Z; Tue, 13 Aug 2019 20:06:43 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hxd43-0006fo-D7 for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2019 20:06:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1565726784; bh=BJj4IKkIVoRjnCmUwYtLOi3KBn/hCwT44LH7rC3kdoM=; h=Date:From:To:Cc:Subject:References:X-My-GPG-KeyId:From; b=E3Pt3KdLd9W8HHq139AvIwYXOeG0lTAHVvI2JcIzZ1HZ915O+TzrXrcXhszIYQiUf uL64qv/She2OnBWhhScfJWgnm/L6Rbj4BNLcLnR4AaHzhUkA3fdth+dcQo2e0fJFGh BH/DXYmITMyqoSUb2Ghke0tTeWnHpqBU6p6VzpZk= Date: Tue, 13 Aug 2019 22:06:23 +0200 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Vasily Khoruzhick Subject: Re: [PATCH v5 08/18] thermal: sun8i: support mod clocks Message-ID: <20190813200623.2dmxcwibuyolnuhh@core.my.home> Mail-Followup-To: Vasily Khoruzhick , Frank Lee , Mark Rutland , devicetree , Linux PM , Maxime Ripard , Greg Kroah-Hartman , Daniel Lezcano , linux-kernel , Eduardo Valentin , Chen-Yu Tsai , Rob Herring , Jonathan.Cameron@huawei.com, Mauro Carvalho Chehab , rui.zhang@intel.com, "David S. Miller" , arm-linux References: <20190810052829.6032-1-tiny.windzz@gmail.com> <20190810052829.6032-9-tiny.windzz@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190813_130639_784904_708FD881 X-CRM114-Status: GOOD ( 28.32 ) 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: Mark Rutland , devicetree , Linux PM , Frank Lee , Greg Kroah-Hartman , Daniel Lezcano , linux-kernel , Eduardo Valentin , Maxime Ripard , Chen-Yu Tsai , Rob Herring , Jonathan.Cameron@huawei.com, Mauro Carvalho Chehab , rui.zhang@intel.com, "David S. Miller" , arm-linux Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Aug 12, 2019 at 04:54:15PM -0700, Vasily Khoruzhick wrote: > On Mon, Aug 12, 2019 at 4:46 PM Frank Lee wrote: > > > > HI Vasily, > > > > On Sat, Aug 10, 2019 at 2:17 PM Vasily Khoruzhick wrote: > > > > > > On Fri, Aug 9, 2019 at 10:31 PM Yangtao Li wrote: > > > > > > > > H3 has extra clock, so introduce something in ths_thermal_chip/ths_device > > > > and adds the process of the clock. > > > > > > > > This is pre-work for supprt it. > > > > > > > > Signed-off-by: Yangtao Li > > > > --- > > > > drivers/thermal/sun8i_thermal.c | 17 ++++++++++++++++- > > > > 1 file changed, 16 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c > > > > index b934bc81eba7..6f4294c2aba7 100644 > > > > --- a/drivers/thermal/sun8i_thermal.c > > > > +++ b/drivers/thermal/sun8i_thermal.c > > > > @@ -54,6 +54,7 @@ struct tsensor { > > > > }; > > > > > > > > struct ths_thermal_chip { > > > > + bool has_mod_clk; > > > > int sensor_num; > > > > int offset; > > > > int scale; > > > > @@ -69,6 +70,7 @@ struct ths_device { > > > > struct regmap *regmap; > > > > struct reset_control *reset; > > > > struct clk *bus_clk; > > > > + struct clk *mod_clk; > > > > struct tsensor sensor[MAX_SENSOR_NUM]; > > > > }; > > > > > > > > @@ -274,6 +276,12 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev) > > > > if (IS_ERR(tmdev->bus_clk)) > > > > return PTR_ERR(tmdev->bus_clk); > > > > > > > > + if (tmdev->chip->has_mod_clk) { > > > > + tmdev->mod_clk = devm_clk_get(&pdev->dev, "mod"); > > > > + if (IS_ERR(tmdev->mod_clk)) > > > > + return PTR_ERR(tmdev->mod_clk); > > > > + } > > > > + > > > > ret = reset_control_deassert(tmdev->reset); > > > > if (ret) > > > > return ret; > > > > @@ -282,12 +290,18 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev) > > > > if (ret) > > > > goto assert_reset; > > > > > > > > - ret = sun50i_ths_calibrate(tmdev); > > > > + ret = clk_prepare_enable(tmdev->mod_clk); > > > > > > You have to set rate of modclk before enabling it since you can't rely > > > on whatever bootloader left for you. > > > > > > Also I found that parameters you're using for PC_TEMP_PERIOD, ACQ0 and > > > ACQ1 are too aggressive and may result in high interrupt rate to the > > > point when it may stall RCU. I changed driver a bit to use params from > > > Philipp Rossak's work (modclk set to 4MHz, PC_TEMP_PERIOD is 7, ACQ0 > > > is 255, ACQ1 is 63) and it fixed RCU stalls for me, see [1] for > > > details. > > > > Why is the RCU stall happening, is it caused by a deadlock? > > Can you provide log information and your configuration? > > I am a bit curious. > > It's not deadlock, I believe it just can't handle that many interrupts > when running at lowest CPU frequency. Even with Philipp's settings > there's ~20 interrupts a second from ths. I don't remember how many > interrupts were there with your settings. > > Unfortunately there's nothing interesting in backtraces, I'm using > Pine64-LTS board. Recently there was a similar issue, with buggy CCU driver that caused CIR interrupts being fired constantly, and it also resulted in RCU stalls. Looks like a comon cause of RCU stalls. THS timing settings probably need to be made specific to the SoC, because I noticed that the same settings lead to wildly different timings on different SoCs. It would be good to measure how often ths interrupt fires with this driver on various SoCs. 20 times a second and more sounds like overkill. I'd expect a useful range to be at most 5-10 times a second. That should be enough to stop overheating the SoC due to suddenly increased load, even without a heatsink. regards, o. > > Thx, > > Yangtao > > > > > > > > [1] https://github.com/anarsoul/linux-2.6/commit/46b8bb0fe2ccd1cd88fa9181a2ecbf79e8d513b2 > > > > > > > > > > if (ret) > > > > goto bus_disable; > > > > > > > > + ret = sun50i_ths_calibrate(tmdev); > > > > + if (ret) > > > > + goto mod_disable; > > > > + > > > > return 0; > > > > > > > > +mod_disable: > > > > + clk_disable_unprepare(tmdev->mod_clk); > > > > bus_disable: > > > > clk_disable_unprepare(tmdev->bus_clk); > > > > assert_reset: > > > > @@ -395,6 +409,7 @@ static int sun8i_ths_remove(struct platform_device *pdev) > > > > { > > > > struct ths_device *tmdev = platform_get_drvdata(pdev); > > > > > > > > + clk_disable_unprepare(tmdev->mod_clk); > > > > clk_disable_unprepare(tmdev->bus_clk); > > > > reset_control_assert(tmdev->reset); > > > > > > > > -- > > > > 2.17.1 > > > > > > > > > > > > _______________________________________________ > > > > linux-arm-kernel mailing list > > > > linux-arm-kernel@lists.infradead.org > > > > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel