All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Zhang Rui <rui.zhang@intel.com>, linux-pm@vger.kernel.org
Cc: tiwai@suse.de, viresh.kumar@linaro.org
Subject: Re: [RFC PATCH 5/5] ACPI: processor: do update when maximum cooling state changed
Date: Sun, 12 Apr 2020 12:07:48 +0200	[thread overview]
Message-ID: <e264d4a2-b0d9-8adf-b44f-7501c4407029@linaro.org> (raw)
In-Reply-To: <fee68438572796c71089571e0ff0add6cbbd3e0c.camel@intel.com>






Hi Rui,

On 12/04/2020 08:13, Zhang Rui wrote:
> On Fri, 2020-04-10 at 14:10 +0200, Daniel Lezcano wrote:

[ ... ]

>>> And to fix this, it's better to
>>> a. unregister and re-register the cooling device as you suggested.
>>> or
>>> b. introduce an API that updates the cooling device entirely
>>> instead of
>>> statistics table only.
>>>
>>> For either of the above solutions, we'd better to cleanup the code
>>> to 
>>> invoke .get_max_state() during registration/max_state_reset phase,
>>> once, and then always use cached value later.
>>> And plus, if we want to follow solution a), it's better to remove
>>> .get_max_state() callback and use an integer instead so that every
>>> driver knows this limitation.
>>> I'd vote for solution a) if there is no soc thermal driver that may
>>> return dynamic max_states.
>>>
>>> Do I still miss something?
>>
>> I agree for the a) solution too.
>>
>> But regarding the get_max_state() callback being converted to a
>> integer,
>> the driver int3406_thermal.c computes the upper and lower limits
>> which
>> are updated on a INT3406_BRIGHTNESS_LIMITS_CHANGED notification and
>> get_max_state() does uppper - lower.
> 
> Right, this is another case shows that it's better to support dynamic
> max_state.
> IMO, this is not difficult to do. We just need to introduce a new API,
> which reuses the current cdev device, and reset its every thermal
> instance, and update all the thermal zones the cdev is involved.
> what do you think?

I like how the thermal framework is designed but I think there are too
many API for the thermal framework and it deserves a simplification
rather than adding more of them.

There is no place where the get_max_state is cached except in the stats
structure.

In the function thermal_cooling_device_stats_update():

  Is it possible to just compare the 'new_state' parameter with
stats->max_state and if it is greater increase the stats table and
update max_state to the new_state ?



-- 
<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

  reply	other threads:[~2020-04-12 10:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08  4:19 [RFC PATCH 1/5] thermal: rename thermal_cooling_device_stats_update() Zhang Rui
2020-04-08  4:19 ` [RFC PATCH 2/5] thermal: create statistics table in two steps Zhang Rui
2020-04-08  4:19 ` [RFC PATCH 3/5] thermal: support statistics table resizing at runtime Zhang Rui
2020-04-08  9:45   ` Takashi Iwai
2020-04-09  2:57     ` Zhang Rui
2020-04-08  4:19 ` [RFC PATCH 4/5] thermal: Add a sanity check for invalid state at stats update Zhang Rui
2020-04-08  4:19 ` [RFC PATCH 5/5] ACPI: processor: do update when maximum cooling state changed Zhang Rui
2020-04-09 13:34   ` Daniel Lezcano
2020-04-10  8:02     ` Zhang Rui
2020-04-10 12:10       ` Daniel Lezcano
2020-04-12  6:13         ` Zhang Rui
2020-04-12 10:07           ` Daniel Lezcano [this message]
2020-04-13  2:01             ` Zhang Rui
2020-04-13 18:06               ` Daniel Lezcano
2020-04-16  4:46                 ` Zhang Rui
2020-04-16  7:58                   ` Daniel Lezcano
2020-04-17  2:09                     ` Zhang Rui
2020-04-10 14:10       ` Rafael J. Wysocki
2020-04-11  4:41         ` Zhang Rui
2020-04-13 16:16   ` kbuild test robot
2020-04-14 12:37   ` Dan Carpenter
2020-04-14 12:37     ` Dan Carpenter
2020-04-08  9:47 ` [RFC PATCH 1/5] thermal: rename thermal_cooling_device_stats_update() Takashi Iwai
2020-04-09  2:59   ` Zhang Rui
2020-05-06 12:07 ` Amit Kucheria
2020-04-13  5:07 [RFC PATCH 5/5] ACPI: processor: do update when maximum cooling state changed kbuild test robot

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=e264d4a2-b0d9-8adf-b44f-7501c4407029@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=tiwai@suse.de \
    --cc=viresh.kumar@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.