From: Matthias Kaehlcke <mka@chromium.org>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: rui.zhang@intel.com, rjw@rjwysocki.net, groeck@chromium.org,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
snanda@chromium.org, lenb@kernel.org,
Eduardo Valentin <edubezval@gmail.com>,
linux-pm@vger.kernel.org
Subject: Re: [RESEND PATCH v3 2/2] thermal: core: introduce thermal zone device mode control
Date: Thu, 28 Jun 2018 17:33:02 -0700 [thread overview]
Message-ID: <20180629003302.GT129942@google.com> (raw)
In-Reply-To: <20180226144118.24693-2-enric.balletbo@collabora.com>
Hi,
I stumbled across this patch since I'm currently poking around with
early thermal bringup on a platform and this patch has been integrated
in our development tree.
I'm seeing some unexpected behaviors, which could entirely due to
wrong expectation from my side. I only have some basic working
knowledge of the thermal framework, just want to double check and
perhaps learn a thing or two.
On Mon, Feb 26, 2018 at 03:41:18PM +0100, Enric Balletbo i Serra wrote:
> From: Zhang Rui <rui.zhang@intel.com>
>
> Thermal "mode" sysfs attribute is introduced to enable/disable a thermal
> zone, and .get_mode()/.set_mode() callback is introduced for platform
> thermal driver to enable/disable the hardware thermal control logic. And
> thermal core takes no action upon thermal zone enable/disable.
>
> Actually, this is not quite right because thermal core still pokes those
> disabled thermal zones occasionally, e.g. upon system resume.
>
> To fix this, a new flag 'mode' is introduced in struct thermal_zone_device
> to represent the thermal zone mode, and several decisions have been made
> based on this flag, including
> 1. check the thermal zone mode right after it's registered.
> 2. skip updating thermal zone if the zone is disabled
> 3. stop the polling timer when the thermal zone is disabled
>
> Note: basically, this patch doesn't affect the existing always-enabled
> thermal zones much, with just one exception -
> thermal zone .get_mode() must be well prepared to reflect the real thermal
> zone status upon the thermal zone registration.
>From my perspective this looks like a pretty significant change. For
the platform I'm working on I added a thermal zone to the device tree,
with the expectation that it would be enabled. Judging from the code
without this patch this expectation seems to be naive, since
of-thermal.c sets tz->mode to THERMAL_DEVICE_DISABLED, so apparently
either userspace or some driver should call _set_mode(tz,
THERMAL_DEVICE_ENABLED). However even without this the thermal zone
appears to be active (I didn't really test end-to-end yet, but at
least thermal_zone_device_update() is called and calls
handle_thermal_trip()). Not sure why this is the case with
THERMAL_DEVICE_DISABLED, but before I learned about the existence of
the flag my expectation was that the zone would be enabled.
With this patch thermal_zone_device_update() is skipped if the zone
hasn't been explictly enabled, which may be consistent with the state
of 'tz->mode', but effectively changes the previous/current behavior.
Not sure if I'm just dumbly overlooking something obvious or if there
is an actual problem with of_thermal (and maybe others).
Any insights?
Thanks
Matthias
WARNING: multiple messages have this Message-ID (diff)
From: Matthias Kaehlcke <mka@chromium.org>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: rui.zhang@intel.com, rjw@rjwysocki.net, groeck@chromium.org,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
snanda@chromium.org, lenb@kernel.org,
Eduardo Valentin <edubezval@gmail.com>,
linux-pm@vger.kernel.org
Subject: Re: [RESEND PATCH v3 2/2] thermal: core: introduce thermal zone device mode control
Date: Thu, 28 Jun 2018 17:33:02 -0700 [thread overview]
Message-ID: <20180629003302.GT129942@google.com> (raw)
In-Reply-To: <20180226144118.24693-2-enric.balletbo@collabora.com>
Hi,
I stumbled across this patch since I'm currently poking around with
early thermal bringup on a platform and this patch has been integrated
in our development tree.
I'm seeing some unexpected behaviors, which could entirely due to
wrong expectation from my side. I only have some basic working
knowledge of the thermal framework, just want to double check and
perhaps learn a thing or two.
On Mon, Feb 26, 2018 at 03:41:18PM +0100, Enric Balletbo i Serra wrote:
> From: Zhang Rui <rui.zhang@intel.com>
>
> Thermal "mode" sysfs attribute is introduced to enable/disable a thermal
> zone, and .get_mode()/.set_mode() callback is introduced for platform
> thermal driver to enable/disable the hardware thermal control logic. And
> thermal core takes no action upon thermal zone enable/disable.
>
> Actually, this is not quite right because thermal core still pokes those
> disabled thermal zones occasionally, e.g. upon system resume.
>
> To fix this, a new flag 'mode' is introduced in struct thermal_zone_device
> to represent the thermal zone mode, and several decisions have been made
> based on this flag, including
> 1. check the thermal zone mode right after it's registered.
> 2. skip updating thermal zone if the zone is disabled
> 3. stop the polling timer when the thermal zone is disabled
>
> Note: basically, this patch doesn't affect the existing always-enabled
> thermal zones much, with just one exception -
> thermal zone .get_mode() must be well prepared to reflect the real thermal
> zone status upon the thermal zone registration.
From my perspective this looks like a pretty significant change. For
the platform I'm working on I added a thermal zone to the device tree,
with the expectation that it would be enabled. Judging from the code
without this patch this expectation seems to be naive, since
of-thermal.c sets tz->mode to THERMAL_DEVICE_DISABLED, so apparently
either userspace or some driver should call _set_mode(tz,
THERMAL_DEVICE_ENABLED). However even without this the thermal zone
appears to be active (I didn't really test end-to-end yet, but at
least thermal_zone_device_update() is called and calls
handle_thermal_trip()). Not sure why this is the case with
THERMAL_DEVICE_DISABLED, but before I learned about the existence of
the flag my expectation was that the zone would be enabled.
With this patch thermal_zone_device_update() is skipped if the zone
hasn't been explictly enabled, which may be consistent with the state
of 'tz->mode', but effectively changes the previous/current behavior.
Not sure if I'm just dumbly overlooking something obvious or if there
is an actual problem with of_thermal (and maybe others).
Any insights?
Thanks
Matthias
next prev parent reply other threads:[~2018-06-29 0:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-26 14:41 [RESEND PATCH v3 1/2] acpi: thermal: initialize tz_enabled to 1 Enric Balletbo i Serra
2018-02-26 14:41 ` [RESEND PATCH v3 2/2] thermal: core: introduce thermal zone device mode control Enric Balletbo i Serra
2018-02-26 14:48 ` Andy Shevchenko
2018-06-29 0:33 ` Matthias Kaehlcke [this message]
2018-06-29 0:33 ` Matthias Kaehlcke
2018-07-03 17:13 ` Matthias Kaehlcke
2018-07-04 10:36 ` Enric Balletbo i Serra
2018-07-06 18:22 ` Matthias Kaehlcke
2018-02-27 16:17 ` [RESEND PATCH v3 1/2] acpi: thermal: initialize tz_enabled to 1 Rafael J. Wysocki
2018-02-28 3:06 ` Zhang Rui
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=20180629003302.GT129942@google.com \
--to=mka@chromium.org \
--cc=edubezval@gmail.com \
--cc=enric.balletbo@collabora.com \
--cc=groeck@chromium.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
--cc=snanda@chromium.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.