public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleksandr Natalenko <oleksandr@natalenko.name>
To: Stefan Lippers-Hollmann <s.l-h@gmx.de>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Eric Biggers <ebiggers@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux PM <linux-pm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>
Subject: Re: [PATCH v3] thermal: core: Call monitor_thermal_zone() if zone temperature is invalid
Date: Tue, 16 Jul 2024 18:37:30 +0200	[thread overview]
Message-ID: <12474042.O9o76ZdvQC@natalenko.name> (raw)
In-Reply-To: <CAJZ5v0gZ5611KXqfjSZOdjRi7v8num3P-vO82c7LGuS1Ak1=FQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5814 bytes --]

Hello.

On úterý 16. července 2024 16:04:16, SELČ Rafael J. Wysocki wrote:
> On Tue, Jul 16, 2024 at 3:20 PM Stefan Lippers-Hollmann <s.l-h@gmx.de> wrote:
> >
> > Hi
> >
> > On 2024-07-16, Rafael J. Wysocki wrote:
> > > On Tue, Jul 16, 2024 at 1:36 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > > > On Tue, Jul 16, 2024 at 1:15 PM Stefan Lippers-Hollmann <s.l-h@gmx.de> wrote:
> > > > > On 2024-07-16, Stefan Lippers-Hollmann wrote:
> > > > > > On 2024-07-16, Rafael J. Wysocki wrote:
> > > > > > > On Tue, Jul 16, 2024 at 1:48 AM Stefan Lippers-Hollmann <s.l-h@gmx.de> wrote:
> > > > > > > > On 2024-07-15, Rafael J. Wysocki wrote:
> > > > > > > > > On Mon, Jul 15, 2024 at 2:54 PM Stefan Lippers-Hollmann <s.l-h@gmx.de> wrote:
> > > > > > > > > > On 2024-07-15, Rafael J. Wysocki wrote:
> > > > > > > > > > > On Mon, Jul 15, 2024 at 11:09 AM Daniel Lezcano
> > > > > > > > > > > <daniel.lezcano@linaro.org> wrote:
> > > > > > > > > > > > On 15/07/2024 06:45, Eric Biggers wrote:
> > > > > > > > > > > > > On Thu, Jul 04, 2024 at 01:46:26PM +0200, Rafael J. Wysocki wrote:
> > > > > > > > > > > > >> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > > > > > > [...]
> > > > > > > > > > Silencing the warnings is already a big improvement - and that patch
> > > > > > > > > > works to this extent for me with an ax200, thanks.
> > > > > > > > >
> > > > > > > > > So attached is a patch that should avoid enabling the thermal zone
> > > > > > > > > when it is not ready for use in the first place, so it should address
> > > > > > > > > both the message and the useless polling.
> > > > > > > > >
> > > > > > > > > I would appreciate giving it a go (please note that it hasn't received
> > > > > > > > > much testing so far, though).
> > > > > > > >
> > > > > > > > Sadly this patch doesn't seem to help:
> > > > > > >
> > > > > > > This is likely because it is missing checks for firmware image type.
> > > > > > > I've added them to the attached new version.  Please try it.
> > > > > > >
> > > > > > > I've also added two pr_info() messages to get a better idea of what's
> > > > > > > going on, so please grep dmesg for "Thermal zone not ready" and
> > > > > > > "Enabling thermal zone".
> > > > > >
> > > > > > This is the output with the patch applied:
> > > > >
> > > > > The ax200 wlan interface is currently not up/ configured (system
> > > > > using its wired ethernet cards instead), the thermal_zone1 stops
> > > > > if I manually enable the interface (ip link set dev wlp4s0 up)
> > > > > after booting up:
> > > >
> > > > This explains it, thanks!
> > > >
> > > > The enabling of the thermal zone in iwl_mvm_load_ucode_wait_alive() is
> > > > premature or it should get disabled in the other two places that clear
> > > > the IWL_MVM_STATUS_FIRMWARE_RUNNING bit.
> > > >
> > > > I'm not sure why the thermal zone depends on whether or not this bit
> > > > is set, though. Is it really a good idea to return errors from it if
> > > > the interface is not up?
> > [...]
> > > > > [   22.033468] thermal thermal_zone1: failed to read out thermal zone (-61)
> > > > > [   22.213120] thermal thermal_zone1: Enabling thermal zone
> > > > > [   22.283954] iwlwifi 0000:04:00.0: Registered PHC clock: iwlwifi-PTP, with index: 0
> > > >
> > > > Thanks for this data point!
> > > >
> > > > AFAICS the thermal zone in iwlwifi is always enabled, but only valid
> > > > if the interface is up.  It looks to me like the thermal core needs a
> > > > special "don't poll me" error code to be returned in such cases.
> > >
> > > Attached is a thermal core patch with an iwlwifi piece along the lines
> > > above (tested lightly).  It adds a way for a driver to indicate that
> > > temperature cannot be provided at the moment, but that's OK and the
> > > core need not worry about that.
> > >
> > > Please give it a go.
> >
> > This seems to fail to build on top of v6.10, should I test Linus' HEAD
> > or some staging tree instead?
> 
> No, it's missing one hunk, sorry about that.
> 
> > [ I will be offline for the next few hours now, but will test it as soon
> >   as possible, probably in ~9-10 hours ]
> 
> No worries and thanks for your persistence!
> 
> >   CC      drivers/thermal/thermal_core.o
> > drivers/thermal/thermal_core.c: In function 'handle_thermal_trip':
> > drivers/thermal/thermal_core.c:383:37: error: 'THERMAL_TEMP_INIT' undeclared (first use in this function); did you mean 'THERMAL_TEMP_INVALID'?
> >   383 |             tz->last_temperature != THERMAL_TEMP_INIT) {
> >       |                                     ^~~~~~~~~~~~~~~~~
> >       |                                     THERMAL_TEMP_INVALID
> > drivers/thermal/thermal_core.c:383:37: note: each undeclared identifier is reported only once for each function it appears in
> > drivers/thermal/thermal_core.c: In function 'thermal_zone_device_init':
> > drivers/thermal/thermal_core.c:432:27: error: 'THERMAL_TEMP_INIT' undeclared (first use in this function); did you mean 'THERMAL_TEMP_INVALID'?
> >   432 |         tz->temperature = THERMAL_TEMP_INIT;
> >       |                           ^~~~~~~~~~~~~~~~~
> >       |                           THERMAL_TEMP_INVALID
> >
> 
> Attached is a new version that builds for me on top of plain 6.10.
> 

This builds and runs fine for me, no dmesg spamming any more. In `sensors` I get this:

```
iwlwifi_1-virtual-0
Adapter: Virtual device
temp1:       -274.0°C
```

(very beneficial during the heat wave)

There are no "thermal" messages in dmesg whatsoever, any other info you'd like me to provide?

Also, feel free to add:

Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>

Thank you.

-- 
Oleksandr Natalenko (post-factum)

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-07-16 16:37 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 11:46 [PATCH v3] thermal: core: Call monitor_thermal_zone() if zone temperature is invalid Rafael J. Wysocki
2024-07-04 12:49 ` Daniel Lezcano
2024-07-04 12:52   ` Neil Armstrong
2024-07-04 14:23     ` Rafael J. Wysocki
2024-07-04 14:21   ` Rafael J. Wysocki
2024-07-04 16:53     ` Daniel Lezcano
2024-07-04 16:58       ` Rafael J. Wysocki
2024-07-15  4:45 ` Eric Biggers
2024-07-15  9:06   ` Stefan Lippers-Hollmann
2024-07-15 10:52     ` Rafael J. Wysocki
2024-07-15  9:09   ` Daniel Lezcano
2024-07-15 11:21     ` Rafael J. Wysocki
2024-07-15 12:54       ` Stefan Lippers-Hollmann
2024-07-15 14:48         ` Rafael J. Wysocki
2024-07-15 21:12           ` Eric Biggers
2024-07-15 23:48           ` Stefan Lippers-Hollmann
2024-07-16 10:05             ` Rafael J. Wysocki
2024-07-16 10:55               ` Stefan Lippers-Hollmann
2024-07-16 11:15                 ` Stefan Lippers-Hollmann
2024-07-16 11:36                   ` Rafael J. Wysocki
2024-07-16 12:10                     ` Daniel Lezcano
2024-07-16 12:18                       ` Rafael J. Wysocki
2024-07-16 12:30                     ` Rafael J. Wysocki
2024-07-16 13:20                       ` Stefan Lippers-Hollmann
2024-07-16 14:04                         ` Rafael J. Wysocki
2024-07-16 16:37                           ` Oleksandr Natalenko [this message]
2024-07-16 17:03                             ` Rafael J. Wysocki
2024-07-16 23:30                           ` Stefan Lippers-Hollmann
2024-07-16 11:19                 ` Rafael J. Wysocki
2024-07-15 10:49   ` 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=12474042.O9o76ZdvQC@natalenko.name \
    --to=oleksandr@natalenko.name \
    --cc=daniel.lezcano@linaro.org \
    --cc=ebiggers@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=neil.armstrong@linaro.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    --cc=s.l-h@gmx.de \
    --cc=srinivas.pandruvada@linux.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