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=-11.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 A1E06C31E40 for ; Mon, 12 Aug 2019 23:54:50 +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 6F1FC2063F for ; Mon, 12 Aug 2019 23:54:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OrLYN5Py"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MURQZflg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F1FC2063F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v3v02aiD62OdTVAP6VMCsjR++g+ebDzYLPqKleYL96c=; b=OrLYN5Pyd00Sdp n63h17IKgABio9QDLpPatUVS/guKAQDoi4/nwHKcYpcjJuJRpGfbDNDvEhgFpWMEi77fuiDpZXoDP aWSdopJNJ4KuSQvFAUEFk72eLoSTqDg+qInkaJK4DXqxX1+xOwz99pqoPWTNdO2GiqbZaf2JMzhDy +q2kDd5N3VjSH1Ary3+0fofmycuJFcbnWlewg6KECCMqoKg2MjPWiQOzkNenUJZjt6vm/jNUGN3dj zUA1EZf89G5N1XHL672QhmCHqp+ngUsDQBhSOQDsm0+eqiEdLYCdbDtbJU6F89fAlYoE4DqTYGY35 ZjM2u332GqAF8G6X1eNQ==; 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 1hxK9A-0005Do-6E; Mon, 12 Aug 2019 23:54:40 +0000 Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hxK97-0005DI-02 for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2019 23:54:38 +0000 Received: by mail-ot1-x343.google.com with SMTP id b7so115509297otl.11 for ; Mon, 12 Aug 2019 16:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=w2kdR+7b7KvFC+HWFUinAh+s80F0DWNtdCahrnarn44=; b=MURQZflgt53gZwpL/adUQPWglHlq+Vte6KXRI0z/ItnHLIbuIWVx+AHjTIX3e2/2XJ AgQauFkwH8PiW27qaftBzb8SjEZ22PQqEWa+nCPvevt0Be+071pvDuvfrffhPLtBRpdA LBIdY9YYHhtIhRwH3KeCIhyxenjmm3/uupxNakiv2kKJarsmfSyGbsbA9DFnwaS0ukVe W1bFdGY9LnSQmBVakQlpzuluvXvyRyG+GjF+BMnQ3AsRKnDVSirB6IyXN29SEnjYM10Q Kg+r75M1tzmCtWw+PxSZkLBjos7xfe2rDFrJIyNyazO4H6GArHp+JAU+pZqjWawZp4oF m2ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=w2kdR+7b7KvFC+HWFUinAh+s80F0DWNtdCahrnarn44=; b=fnTAQ8VqcloNSCQuYzckLr+9bW0t+Rzu35jokqhRmmFPD2raUbKsPyQn2X6BsPgLed pr0+YPHI3fpScFDE7xh/P7u4cKVTHeCsIQYQVccijQn4yJneKGR66BGz0d9CAdb/+vXw b3kcvqo9EExLNMpr7OhYgO5vLk+b1SnLKGQsd0gU1B+o6JOlyQA+G4hs+uBO5q1/0uRX Bp5bW7Dsi0Y2W8OauL9DfRUcGcslkFCRL8urCFmJWj+6LCqe0N7xkZCI+hOPs4kHq1Ac nbaxMRdXfX/W3AYmYC5nDd1x19t1WwIeyF0FmLO/5btGNtULz7PJrm+u01FFlllr2oD0 O+5Q== X-Gm-Message-State: APjAAAXWtGotW+gooJwRGA9QrrQ2Vf95+Sx7bP9icG5TUHI338bZJJeB byltt7mwhppwiqlSK2eoZbYT9dDZUjUro5KNljA= X-Google-Smtp-Source: APXvYqz72zUtIykO8D1IdH6U+dE5fed0U7T2C3hqJGnZx13Lu2B8gFOyDxVqs3R/+r4Eq6F8rMwsnza3cbCy+u/sHjs= X-Received: by 2002:a05:6830:1f0b:: with SMTP id u11mr23846230otg.263.1565654075918; Mon, 12 Aug 2019 16:54:35 -0700 (PDT) MIME-Version: 1.0 References: <20190810052829.6032-1-tiny.windzz@gmail.com> <20190810052829.6032-9-tiny.windzz@gmail.com> In-Reply-To: From: Vasily Khoruzhick Date: Mon, 12 Aug 2019 16:54:15 -0700 Message-ID: Subject: Re: [PATCH v5 08/18] thermal: sun8i: support mod clocks To: Frank Lee X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190812_165437_069069_01EDC4FA X-CRM114-Status: GOOD ( 26.83 ) 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 , 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 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 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. > 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