linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasilis Liaskovitis <vliaskovitis@suse.com>
To: linux-pm@vger.kernel.org, rjw@rjwysocki.net
Subject: [RFC] docs: thermal/drivers/intel: Reading trip point previously set to 0
Date: Fri, 22 Sep 2023 13:15:21 +0200	[thread overview]
Message-ID: <eaf4ab5f-2ce1-4e87-a31c-f2b5ebd15c19@suse.com> (raw)

Hi,

Since commit:
eb8500b8 "thermal/drivers/intel: Initialize RW trip to THERMAL_TEMP_INVALID"

writing 0 into thermal trip point temp sysfs files cannot be read back:
~ # echo 0  > /sys/devices/virtual/thermal/thermal_zone1/trip_point_0_temp
~ # cat /sys/devices/virtual/thermal/thermal_zone1/trip_point_0_temp 

-274000

Prior to this change, the value 0 could be "read". Afaict only because 0 
was always returned for uninitialized trip points, and not only when 0 
was actually written into the trip_point_*_temp by userspace.

A customer uses scripts to set the trip_point_*_temp value to 0, and 
then checks that the value is indeed 0. Their userspace test suite 
breaks because of this change.

Should userspace still be able to read the set value of 0 (meaning the 
thermal subsystem confirms no notifications will be sent)? I understand 
this is a corner case (maybe it's even non-sensical to check a value of 
0 is returned, after setting it), but I wanted to ask since the sysfs 
value read by userspace is now THERMAL_TEMP_INVALID.

Or should we instead update documentation to reflect the fact that 
uninitialized trip points and trip points set to 0 return an invalid 
value THERMAL_TEMP_INVALID? E.g.:


diff --git 
a/Documentation/driver-api/thermal/x86_pkg_temperature_thermal.rst 
b/Documentation/driver-api/thermal/x86_pkg_temperature_thermal.rst
index 2ac42ccd236f6..2e6f2728b5b94 100644
--- a/Documentation/driver-api/thermal/x86_pkg_temperature_thermal.rst
+++ b/Documentation/driver-api/thermal/x86_pkg_temperature_thermal.rst
@@ -43,8 +43,10 @@ User can set any temperature between 0 to TJ-Max 
temperature. Temperature units
  are in milli-degree Celsius. Refer to 
"Documentation/driver-api/thermal/sysfs-api.rst" for
  thermal sys-fs details.

+An uninitialized trip_point_*_temp returns an invalid value 
(THERMAL_TEMP_INVALID).
  Any value other than 0 in these trip points, can trigger thermal 
notifications.
-Setting 0, stops sending thermal notifications.
+Setting 0, stops sending thermal notifications. Having set 0, the value 
returned by the
+trip point remains invalid (THERMAL_TEMP_INVALID).

  Thermal notifications:
  To get kobject-uevent notifications, set the thermal zone


             reply	other threads:[~2023-09-22 11:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 11:15 Vasilis Liaskovitis [this message]
2023-09-28 18:05 ` [RFC] docs: thermal/drivers/intel: Reading trip point previously set to 0 Vasilis LIaskovitis
2023-09-30 12:56   ` srinivas pandruvada

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=eaf4ab5f-2ce1-4e87-a31c-f2b5ebd15c19@suse.com \
    --to=vliaskovitis@suse.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).