Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp307217ybl; Mon, 12 Aug 2019 16:55:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdPx/nUUwtTCUi/LId1QDqifMoaCGKKXonLbo4AppmCKGRSaT94h06j+uB5NzMbFXC37xQ X-Received: by 2002:a17:90b:d8b:: with SMTP id bg11mr1667054pjb.30.1565654126773; Mon, 12 Aug 2019 16:55:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565654126; cv=none; d=google.com; s=arc-20160816; b=mD7spbbNjr/EzMB9uTPKGY1EraBfFBvJbQ5Rr4nDL27VpJR2el4oK3yLMv5GSWH/9G Q91ubCskhl/PbKBZYNA32UfJOwJn/c6uuY6Xt4N/naypelnTfwyPz7xGhJkw4kEiwUG/ vvJ3LbSjSXl6EjNecDd5bXLppGvK0Q5pR3oCPJcJespgGObi2jGPWBNew1sUaFInSmBr +2R50UGMzhUTTBvM+4cjcXAwvcg1heIpwGAxpgPF/sutbH8DGaI4hYzp3gHyIUOOGPs+ mjX9zhMQmdhIfPx80VkW0pD9r+44Hb/LtJfE+kDZlwqjl+sOj2NvaZVH+qor5zfsaYnm HDmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=w2kdR+7b7KvFC+HWFUinAh+s80F0DWNtdCahrnarn44=; b=bJS33rHAaKaRjPmzv6FwCYUxqRwQ0kB6RxOHbN2c/DPQaLXjsqx7HFExALHi+dhEQ7 cMI0uZrEmACoXxcyDNLfsfTYFYSvOjZ5Fgx/F8bKT1lo37ahtRUESiuq49o50QA1eSLM 7ElFAVJuJBeXDhy+5dB3IZ4RTTLuUFO5BBR9RoM62u5UWPEGMfG8UIo4SHWWapNzR/mn f4OYO7gcJJPHd9N7BKUNvB0cKy28jIF4pgfd8dV99D6lBqMeq1jv2FUHb/d3sSq1U+Lm 9Yut1PEl/jl4FmsIn+BQUERwYQCz+T46n1n5+dtgvcgONQcXQeWaORkudONrNyIdM7zR Qk6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MURQZflg; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v19si608937pjn.96.2019.08.12.16.55.11; Mon, 12 Aug 2019 16:55:26 -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=@gmail.com header.s=20161025 header.b=MURQZflg; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727025AbfHLXyh (ORCPT + 99 others); Mon, 12 Aug 2019 19:54:37 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:46892 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726578AbfHLXyh (ORCPT ); Mon, 12 Aug 2019 19:54:37 -0400 Received: by mail-ot1-f67.google.com with SMTP id z17so47325350otk.13; 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=V9s9vJUc2ceaccAPpSEc85odBC0MXUNSVC7Y4m6nL8EsmlzVI69PnHsPK1oawq8Dcy tadoWeuWmIjF4Id7G8mKWnQTk0E131wfZ0sytTC8YZZPfbM240OReedPywq/8+ruEM+L nS8GjYFjrJ8kA3qt4q+SYey8TMBQ+lOwIuvPI4RqiH98t8LviB/JYqxQ6T9OR2/+xnem LktKRuwXUKpYRiaGiNYnH86+TkMc7zj+HFD/28YfROYZB4CSP9Xhl5z5+b3xbIfQnmUz o6ur5QC3VTQZ4Xc0k28QjI2orut7QjAtsMGPZyn3MgWqiUf04rC13P0LqSwybm8VVY0Y j9kg== X-Gm-Message-State: APjAAAUlFqjsrnlMsd8bS5hT+xo5eUXNU26lIUY+V8SNHLO3icvuggbN Ic8cC6txMZu5vadJs3QZf649/DDN1uFhdrzni7w= 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 Cc: rui.zhang@intel.com, Eduardo Valentin , Daniel Lezcano , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Mauro Carvalho Chehab , "David S. Miller" , Greg Kroah-Hartman , Jonathan.Cameron@huawei.com, Nicolas Ferre , devicetree , linux-kernel , arm-linux , Linux PM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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