From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Chris Down <chris@chrisdown.name>, linux-pm@vger.kernel.org
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
Guenter Roeck <linux@roeck-us.net>
Subject: Re: Thermal notifications without setting thermal governor to userspace?
Date: Wed, 30 Mar 2022 20:08:18 +0200 [thread overview]
Message-ID: <f48f8bcc-0d1c-0a36-0e50-2e6b17a645a2@linaro.org> (raw)
In-Reply-To: <YkR6/KnH/f9U+2qf@chrisdown.name>
Hi Chris,
I'll answer to your email but meanwhile this can have some interest for you:
https://lore.kernel.org/all/20220330100444.3846661-1-daniel.lezcano@linaro.org/
Regards
-- Daniel
On 30/03/2022 17:45, Chris Down wrote:
> Hey thermal folks,
>
> I'm hoping that you'll be able to provide some guidance on what options
> are available for getting thermal notifications without changing the
> policy to userspace control.
>
> To be clear, my intent is to have a userspace daemon which can set
> multiple temperature trips at runtime on which it can receive a
> notification (preferably by a simple mechanism like uevents), and to be
> able to distinguish which threshold was tripped. For example, to be able
> to set trips at 50C, 70C, and 90C, getting events both when the
> temperature exceeds that and when it dips back under the specified
> threshold.
>
> Right now I am polling /sys/class/thermal/thermal_zone*/temp but this
> can be expensive, especially for the ACPI thermal zone.
>
> As it is, I see four options:
>
> 1. Set thermal_zone to use user_space governor and use uevents
>
> As I understand it, this means that the default critical temperature
> will no longer be respected and user space is now responsible for taking
> action to control thermal events.
>
> If that's correct, then it seems dangerous to set it to user_space for
> userspace applications which only want to monitor their own trip
> temperatures, but not take direct action.
>
> 2. Use hwmon thermal events
>
> I see that commit 1597b374af22 ("hwmon: Add notification support") adds
> notification support to hwmon, but as far as I can tell this is based on
> statically defined trip temperatures from ACPI or similar inputs. I see
> you can change it with the thermal.crt boot option, but that's too early
> for a normal userspace daemon to do anything (and it doesn't allow any
> dynamic reconfiguration).
>
> 3. Use thermal over netlink
>
> I see that commit 1ce50e7d408e ("thermal: core: genetlink support for
> events/cmd/sampling") which was merged a couple of years ago adds
> support for thermal netlink events.
>
> I also see articles suggesting that support for this new netlink
> interface will be or was added to libnl, but I can't seem to find
> anything about it in the libnl sources.
>
> Is this mature enough to use? If so, does one have to hack up their own
> userspace netlink library for now, or what's the plan there?
>
> In general I would prefer something simpler that fits into the existing
> strong tooling around uevents/etc though, this looks useful, but it does
> a lot more than I need and requires adding another userspace dependency
> on libnl.
>
> 4. Poll /sys/class/thermal/thermal_zone*/temp or hwmon
>
> This is what I'm currently doing. It's slow, and often unnecessarily
> costly on weaker systems.
>
> Are there other options I'm not considering here that might help me out
> here?
>
> Thanks,
>
> Chris
--
<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:[~2022-03-30 18:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 15:45 Thermal notifications without setting thermal governor to userspace? Chris Down
2022-03-30 18:08 ` Daniel Lezcano [this message]
2022-03-30 18:11 ` Chris Down
2022-03-30 22:24 ` Daniel Lezcano
2022-04-04 15:17 ` Chris Down
2022-04-04 16:17 ` Daniel Lezcano
2022-04-04 17:17 ` Chris Down
2022-04-04 20:27 ` Daniel Lezcano
2022-04-04 20:50 ` Chris Down
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=f48f8bcc-0d1c-0a36-0e50-2e6b17a645a2@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amitk@kernel.org \
--cc=chris@chrisdown.name \
--cc=linux-pm@vger.kernel.org \
--cc=linux@roeck-us.net \
--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;
as well as URLs for NNTP newsgroup(s).