public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Lukasz Luba <lukasz.luba@arm.com>, <linux-pm@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] thermal/sysfs: Always enable hysteresis write support
Date: Thu, 11 Jan 2024 19:39:34 +0530	[thread overview]
Message-ID: <e83c9db6-ccac-7546-e9bb-39d404c4aea5@quicinc.com> (raw)
In-Reply-To: <CAJZ5v0g4hnRqRCseRnTjfEF+-2=ZT8U9=2m9FODqh3G8eDd=Sw@mail.gmail.com>

Hi Rafael,

On 1/10/2024 6:18 PM, Rafael J. Wysocki wrote:
> Hi Manaf,
>
> On Wed, Jan 10, 2024 at 9:17 AM Manaf Meethalavalappu Pallikunhi
> <quic_manafm@quicinc.com> wrote:
>> Hi Rafael,
>>
>> On 1/9/2024 7:12 PM, Rafael J. Wysocki wrote:
>>
>> On Sat, Jan 6, 2024 at 8:16 PM Manaf Meethalavalappu Pallikunhi
>> <quic_manafm@quicinc.com> wrote:
>>
>> The commit 2e38a2a981b2("thermal/core: Add a generic
>> thermal_zone_set_trip() function") adds the support to update
>> trip hysteresis even if set_trip_hyst() operation is not defined.
>> But during hysteresis attribute creation, if this operation is
>> defined then only it enables hysteresis write access. It leads
>> to a case where hysteresis sysfs will be read only for a thermal
>> zone when its set_trip_hyst() operation is not defined.
>>
>> Which is by design.
>>
>> I think it is regression after recent re-work. If a sensor is registered with thermal framework via thermal_of,
>>
>> sensor driver doesn't need to know the trip configuration and nothing to do with set_trip_hyst() in driver.
>>
>> Without this change, if a sensor needs to be monitored from userspace(trip/hysteresis),
> What exactly do you mean by "monitored" here?

There can be userspace thermal manager/clients(eg: thermal HAL in 
android, thermal manager daemon etc. ) with different trip 
pairs(temperature and hysteresis) for its own thermal management, 
temperature reporting, thermal tuning etc.

This client can update trip and hysteresis dynamically via thermal zone 
trip point sysfs nodes for event violation notification irrespective of 
kernel thermal zone devicetree trip values.

This was supporting until this rework without any set_trip_* ops from 
sensor driver.

>
>> it is enforcing sensor driver to add  dummy set_trip_hyst() operation. Correct me otherwise
> With the current design, whether or not trip properties can be updated
> by user space is a thermal zone property expressed by the presence of
> the set_trip_* operations, so yes, whoever registers the thermal zone

If you look at current code, it is allowing to set trip temperature 
without set_trip_temp() operation, only hysteresis is not allowed.

As I mentioned above cases, userspace sysfs update is usecase/client 
driven, not always a sensor driver specific requirement especially a 
sensor is registered via thermal_of.  Not sure adding a dummy ops in 
every sensor driver to achieve above requirement is right solution here.

> needs to provide those so that user space can update the trip
> properties.
>
>> For some thermal zone types (eg. acpi), updating trip hysteresis via
>> sysfs might lead to incorrect behavior.
>>
>> To address this issue, is it okay to  guard  hysteresis write permission under CONFIG_THERMAL_WRITABLE_TRIPS defconfig ?
> Not really, because it would affect all of the thermal zones then.
>
> TBH, the exact scenario in which user space needs to update trip
> hysteresis is not particularly clear to me, so can you provide some
> more details, please?

I hope I explained more information in above comment. let me know otherwise.

Thanks,

Manaf

>
> Thanks!

  reply	other threads:[~2024-01-11 14:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-06 19:15 [PATCH] thermal/sysfs: Always enable hysteresis write support Manaf Meethalavalappu Pallikunhi
2024-01-09 13:42 ` Rafael J. Wysocki
2024-01-10 12:47   ` Manaf Meethalavalappu Pallikunhi
2024-01-10 12:49     ` Rafael J. Wysocki
     [not found]   ` <d7b82fc8-0ed8-80b8-9eb8-c77f9277178f@quicinc.com>
2024-01-10 12:48     ` Rafael J. Wysocki
2024-01-11 14:09       ` Manaf Meethalavalappu Pallikunhi [this message]
2024-01-17 16:57       ` Daniel Lezcano
2024-01-17 18:49         ` Rafael J. Wysocki
2024-01-18 10:25           ` Daniel Lezcano
2024-01-22 10:19             ` Rafael J. Wysocki
2024-01-29 17:07               ` Rafael J. Wysocki
2024-01-29 17:54                 ` Daniel Lezcano
2024-01-29 20:45                   ` Rafael J. Wysocki

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=e83c9db6-ccac-7546-e9bb-39d404c4aea5@quicinc.com \
    --to=quic_manafm@quicinc.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    /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