From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: "Petr Benes" <petrben@gmail.com>,
"Michal Vokáč" <michal.vokac@ysoft.com>,
linux-pm@vger.kernel.org, "Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Amit Kucheria" <amitk@kernel.org>,
linux-kernel@vger.kernel.org,
"Andrzej Pietrasiewicz" <andrzej.p@collabora.com>,
"NXP Linux Team" <linux-imx@nxp.com>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"David Jander" <david@protonic.nl>,
"Zhang Rui" <rui.zhang@intel.com>,
"Fabio Estevam" <festevam@gmail.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] thermal: imx: implement runtime PM support
Date: Thu, 21 Oct 2021 09:56:15 +0200 [thread overview]
Message-ID: <dace17c6-a31a-9b52-3659-5b36e23f530e@linaro.org> (raw)
In-Reply-To: <20211021074456.GD2298@pengutronix.de>
On 21/10/2021 09:44, Oleksij Rempel wrote:
> On Thu, Oct 21, 2021 at 09:41:35AM +0200, Daniel Lezcano wrote:
>> On 21/10/2021 09:20, Oleksij Rempel wrote:
>>> Hi Petr,
>>>
>>> On Wed, Oct 20, 2021 at 05:53:03PM +0200, Petr Benes wrote:
>>>> On Wed, 20 Oct 2021 at 07:05, Oleksij Rempel <o.rempel@pengutronix.de> wrote:
>>>>>
>>>>> Hi Petr and Michal,
>>>>>
>>>>> I forgot to add you for v2 in CC. Please test/review this version.
>>>>
>>>> Hi Oleksij,
>>>>
>>>> It works good. with PM as well as without PM. The only minor issue I found is,
>>>> that the first temperature reading (when the driver probes) fails. That is
>>>> (val & soc_data->temp_valid_mask) == 0) holds true. How does
>>>> pm_runtime_resume_and_get() behave in imx_thermal_probe()?
>>>> Does it go through imx_thermal_runtime_resume() with usleep_range()?
>>>
>>> On the first temperature reading, the PM and part of HW is not
>>> initialized. Current probe sequence is racy and has at least following
>>> issues:
>>> - thermal_zone_device_register is executed before HW init was completed.
>>> It kind of worked before my patch, becaus part of reinit was done by
>>> temperature init. It worked, since the irq_enabled flag was not set,
>>> but potentially would run enable_irq() two times if device is
>>> overheated on probe.
>>> - the imx_thermal core is potentially disable after first race
>>> condition:
>>> CPU0 CPU1
>>> thermal_zone_device_register()
>>> imx_get_temp()
>>> irq_enabled == false
>>> power_up
>>> read_temp
>>> power_up
>>> power_down
>>> irq_enabled = true;
>>>
>>> ... at this point imx_thermal is powered down for some amount of time,
>>> over temperature IRQ will not be triggered for some amount of time.
>>>
>>> - if some part after thermal_zone_device_register() would fail or
>>> deferred, the worker polling temperature will run in to NULL pointer.
>>> This issue already happened...
>>>
>>> After migrating to runtime PM, one of issues started to be visible even
>>> on normal conditions.
>>> I'll send one more patch with reworking probe sequence.
>>
>> Are you planning to send a v3 with this patch? Or a separate patch?
>
> I'm OK with both variants. What do you prefer?
>
> I'll do i on top of PM patch to reduce refactoring overhead, if you OK
> about it.
I prefer you resend a couple of patches but change the subject of this
patch to something like "thermal/drivers/imx: Fix disabled sensor after
handling trip temperature" in order to reflect the problem, not the
solution.
btw: nice fix
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2021-10-21 7:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 13:08 Oleksij Rempel
2021-10-20 5:04 ` Oleksij Rempel
2021-10-20 15:53 ` Petr Benes
2021-10-21 7:20 ` Oleksij Rempel
2021-10-21 7:41 ` Daniel Lezcano
2021-10-21 7:44 ` Oleksij Rempel
2021-10-21 7:56 ` Daniel Lezcano [this message]
2021-10-21 17:20 ` Oleksij Rempel
2021-10-25 11:06 ` Petr Benes
2021-11-10 10:07 ` Michal Vokáč
2021-11-11 9:16 ` Oleksij Rempel
2021-11-15 15:02 ` Petr Benes
2021-11-17 10:24 ` Oleksij Rempel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dace17c6-a31a-9b52-3659-5b36e23f530e@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amitk@kernel.org \
--cc=andrzej.p@collabora.com \
--cc=david@protonic.nl \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=michal.vokac@ysoft.com \
--cc=o.rempel@pengutronix.de \
--cc=petrben@gmail.com \
--cc=rui.zhang@intel.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®