linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* thermal driver patch
       [not found] <DL9RGR.8W3XFSCFFYXI2.ref@att.net>
@ 2022-08-17 10:39 ` Steven J Abner
  2022-08-29  5:47   ` Randy Dunlap
  0 siblings, 1 reply; 7+ messages in thread
From: Steven J Abner @ 2022-08-17 10:39 UTC (permalink / raw)
  To: linux-kernel

Didn't actually create patch, for you to do and review:

for drivers/thermal/thermal_core.c:397 :

static void update_temperature(struct thermal_zone_device *tz)
{
  (void)tz;
}

stops kernel dmesg of unused function,
from include/linux/thermal.h:429 :

static inline int thermal_zone_get_temp(
  struct thermal_zone_device *tz, int *temp)
{ return -ENODEV; }

If this is a bother, sorry I troubled you.
Per 'Do I have to be subscribed to post to the list?':
I wish to be personally CC'ed the answers/comments posted to the list
in response to your posting, please.
Steve




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: thermal driver patch
  2022-08-17 10:39 ` thermal driver patch Steven J Abner
@ 2022-08-29  5:47   ` Randy Dunlap
  2022-08-29 12:20     ` Steven J Abner
  0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2022-08-29  5:47 UTC (permalink / raw)
  To: Steven J Abner, linux-kernel

Hi--

On 8/17/22 03:39, Steven J Abner wrote:
> Didn't actually create patch, for you to do and review:
> 
> for drivers/thermal/thermal_core.c:397 :
> 
> static void update_temperature(struct thermal_zone_device *tz)
> {
>  (void)tz;
> }
> 
> stops kernel dmesg of unused function,
> from include/linux/thermal.h:429 :
> 
> static inline int thermal_zone_get_temp(
>  struct thermal_zone_device *tz, int *temp)
> { return -ENODEV; }
> 
> If this is a bother, sorry I troubled you.
> Per 'Do I have to be subscribed to post to the list?':
> I wish to be personally CC'ed the answers/comments posted to the list
> in response to your posting, please.
> Steve

I haven't seen any such messages, but if this is still a problem,
please post:

a. the exact message(s) [copy-paste]
b. how to reproduce the problem
c. what kernel version is causing the problem

Thanks.
-- 
~Randy

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: thermal driver patch
  2022-08-29  5:47   ` Randy Dunlap
@ 2022-08-29 12:20     ` Steven J Abner
  2022-08-29 22:06       ` Randy Dunlap
  0 siblings, 1 reply; 7+ messages in thread
From: Steven J Abner @ 2022-08-29 12:20 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: linux-kernel



On Mon, Aug 29, 2022 at 05:47, Randy Dunlap <rdunlap@infradead.org> 
wrote:
> a. the exact message(s) [copy-paste]
> c. what kernel version is causing the problem

[    0.000000] Linux version 5.18.12-051812-generic (kernel@sita) (gcc 
(Ubuntu 11.3.0-4ubuntu1) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 
2.38.50.20220629) #202207150942 SMP PREEMPT_DYNAMIC Fri Jul 15 10:10:55 
UTC 2022
[    5.244369] thermal thermal_zone0: failed to read out thermal zone 
(-61)

[    0.000000] Linux version 5.4.204-0504204-generic (kernel@kathleen) 
(gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #202207071639 SMP 
Thu Jul 7 16:59:09 UTC 2022
[    5.207243] thermal thermal_zone0: failed to read out thermal zone 
(-61)

as to reproduce, can only think of saying: boot up kernel without 
patched?

additional info that may? help:
I did not trace what calls 'update_temperature', just saw any call to it
will cause message due to it's call to 'thermal_zone_get_temp', which 
states
no thermal_zone_device should provide or be requesting an update.
It may be that if 'thermal_zone_get_temp' where removed was actual 
function's
intent, and all instances in this file and other function's use was a 
case of designer debugging or signaling a deprecated API? That was my 
intent on saying
'for you to do and review', because it looked like a lot of functions 
could be
updated to take into account that no device should call functions that 
start off
by calling 'thermal_zone_get_temp'.
  It is more probable that my patch suggestion is wrong and calls to
'update_temperature' are suppose to fail with return -ENODEV always 
allowing
other calls to 'update_temperature' to fail also. With proposed code, 
I've not
seen adverse side effects. It just removed dmesg error, but was hoping 
I would
get lucky and it was the reason for CPUTIN -62C without actually hard 
work of
finding real reason.

additional dmesg info:
only other 'thermal' are 'thermal_sys' loading governors
smpboot: CPU0: AMD Ryzen 5 2400G with Radeon Vega Graphics (family: 
0x17, model: 0x11, stepping: 0x0)
from lspci:
Kernel driver in use: k10temp
from lsmod:
nct6775
hwmon_vid
these 2 removed in personal configs, but used in the two ubuntu kernel 
builds:
wmi
wmi_bmof

Steve



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: thermal driver patch
  2022-08-29 12:20     ` Steven J Abner
@ 2022-08-29 22:06       ` Randy Dunlap
  2022-09-01  5:59         ` Daniel Lezcano
  0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2022-08-29 22:06 UTC (permalink / raw)
  To: Steven J Abner, Rafael J. Wysocki, Daniel Lezcano; +Cc: linux-kernel, Linux PM

Hi Steven,

[adding Rafael, Daniel, linux-pm]


> [    5.244369] thermal thermal_zone0: failed to read out thermal zone (-61)

Some driver is returning -ENODATA to the thermal core....

Any suggestions?


On 8/29/22 05:20, Steven J Abner wrote:
> 
> 
> On Mon, Aug 29, 2022 at 05:47, Randy Dunlap <rdunlap@infradead.org> wrote:
>> a. the exact message(s) [copy-paste]
>> c. what kernel version is causing the problem
> 
> [    0.000000] Linux version 5.18.12-051812-generic (kernel@sita) (gcc (Ubuntu 11.3.0-4ubuntu1) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38.50.20220629) #202207150942 SMP PREEMPT_DYNAMIC Fri Jul 15 10:10:55 UTC 2022
> [    5.244369] thermal thermal_zone0: failed to read out thermal zone (-61)
> 
> [    0.000000] Linux version 5.4.204-0504204-generic (kernel@kathleen) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #202207071639 SMP Thu Jul 7 16:59:09 UTC 2022
> [    5.207243] thermal thermal_zone0: failed to read out thermal zone (-61)
> 
> as to reproduce, can only think of saying: boot up kernel without patched?
> 
> additional info that may? help:
> I did not trace what calls 'update_temperature', just saw any call to it
> will cause message due to it's call to 'thermal_zone_get_temp', which states
> no thermal_zone_device should provide or be requesting an update.
> It may be that if 'thermal_zone_get_temp' where removed was actual function's
> intent, and all instances in this file and other function's use was a case of designer debugging or signaling a deprecated API? That was my intent on saying
> 'for you to do and review', because it looked like a lot of functions could be
> updated to take into account that no device should call functions that start off
> by calling 'thermal_zone_get_temp'.
>  It is more probable that my patch suggestion is wrong and calls to
> 'update_temperature' are suppose to fail with return -ENODEV always allowing
> other calls to 'update_temperature' to fail also. With proposed code, I've not
> seen adverse side effects. It just removed dmesg error, but was hoping I would
> get lucky and it was the reason for CPUTIN -62C without actually hard work of
> finding real reason.
> 
> additional dmesg info:
> only other 'thermal' are 'thermal_sys' loading governors
> smpboot: CPU0: AMD Ryzen 5 2400G with Radeon Vega Graphics (family: 0x17, model: 0x11, stepping: 0x0)
> from lspci:
> Kernel driver in use: k10temp
> from lsmod:
> nct6775
> hwmon_vid
> these 2 removed in personal configs, but used in the two ubuntu kernel builds:
> wmi
> wmi_bmof
> 
> Steve
> 
> 

-- 
~Randy

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: thermal driver patch
  2022-08-29 22:06       ` Randy Dunlap
@ 2022-09-01  5:59         ` Daniel Lezcano
  2022-09-01 12:14           ` Steven J Abner
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Lezcano @ 2022-09-01  5:59 UTC (permalink / raw)
  To: Randy Dunlap, Steven J Abner, Rafael J. Wysocki; +Cc: linux-kernel, Linux PM

On 30/08/2022 00:06, Randy Dunlap wrote:
> Hi Steven,
> 
> [adding Rafael, Daniel, linux-pm]
> 
> 
>> [    5.244369] thermal thermal_zone0: failed to read out thermal zone (-61)
> 
> Some driver is returning -ENODATA to the thermal core....
> 
> Any suggestions?

Could it be related to this bug?

https://bugzilla.kernel.org/show_bug.cgi?id=201761

Is it possible to give the thermal zone 'type'


> On 8/29/22 05:20, Steven J Abner wrote:
>>
>>
>> On Mon, Aug 29, 2022 at 05:47, Randy Dunlap <rdunlap@infradead.org> wrote:
>>> a. the exact message(s) [copy-paste]
>>> c. what kernel version is causing the problem
>>
>> [    0.000000] Linux version 5.18.12-051812-generic (kernel@sita) (gcc (Ubuntu 11.3.0-4ubuntu1) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38.50.20220629) #202207150942 SMP PREEMPT_DYNAMIC Fri Jul 15 10:10:55 UTC 2022
>> [    5.244369] thermal thermal_zone0: failed to read out thermal zone (-61)
>>
>> [    0.000000] Linux version 5.4.204-0504204-generic (kernel@kathleen) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #202207071639 SMP Thu Jul 7 16:59:09 UTC 2022
>> [    5.207243] thermal thermal_zone0: failed to read out thermal zone (-61)
>>
>> as to reproduce, can only think of saying: boot up kernel without patched?
>>
>> additional info that may? help:
>> I did not trace what calls 'update_temperature', just saw any call to it
>> will cause message due to it's call to 'thermal_zone_get_temp', which states
>> no thermal_zone_device should provide or be requesting an update.
>> It may be that if 'thermal_zone_get_temp' where removed was actual function's
>> intent, and all instances in this file and other function's use was a case of designer debugging or signaling a deprecated API? That was my intent on saying
>> 'for you to do and review', because it looked like a lot of functions could be
>> updated to take into account that no device should call functions that start off
>> by calling 'thermal_zone_get_temp'.
>>   It is more probable that my patch suggestion is wrong and calls to
>> 'update_temperature' are suppose to fail with return -ENODEV always allowing
>> other calls to 'update_temperature' to fail also. With proposed code, I've not
>> seen adverse side effects. It just removed dmesg error, but was hoping I would
>> get lucky and it was the reason for CPUTIN -62C without actually hard work of
>> finding real reason.
>>
>> additional dmesg info:
>> only other 'thermal' are 'thermal_sys' loading governors
>> smpboot: CPU0: AMD Ryzen 5 2400G with Radeon Vega Graphics (family: 0x17, model: 0x11, stepping: 0x0)
>> from lspci:
>> Kernel driver in use: k10temp
>> from lsmod:
>> nct6775
>> hwmon_vid
>> these 2 removed in personal configs, but used in the two ubuntu kernel builds:
>> wmi
>> wmi_bmof
>>
>> Steve
>>
>>
> 


-- 
<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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: thermal driver patch
  2022-09-01  5:59         ` Daniel Lezcano
@ 2022-09-01 12:14           ` Steven J Abner
  2022-09-07 11:15             ` Steven J Abner
  0 siblings, 1 reply; 7+ messages in thread
From: Steven J Abner @ 2022-09-01 12:14 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: Randy Dunlap, Rafael J. Wysocki, linux-kernel, Linux PM


On Thu, Sep 1, 2022 at 05:59, Daniel Lezcano 
<daniel.lezcano@linaro.org> wrote:
> Could it be related to this bug?
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=201761
> 
> Is it possible to give the thermal zone 'type'

Did verify that that my thermal_zone0 is my wifi:
used lm-sensor and cat /sys/class/thermal/thermal_zone0/temp
along with wifi load to heat to temps different then others to check 
outputs.
The above mentioned bug page could have lead to this, I can't say or 
track.

Prefix the following with I'm not an expert, just info provider:

My guess is not supposed to be calling function during initial kernel 
loading, based on following:

from thermal_core.c:
18:
#include <linux/thermal.h>

397:
static void update_temperature(struct thermal_zone_device *tz)
{
	int temp, ret;

	ret = thermal_zone_get_temp(tz, &temp);
	if (ret) {
		if (ret != -EAGAIN)
			dev_warn(&tz->device,
				 "failed to read out thermal zone (%d)\n",
				 ret);
		return;
	}

	mutex_lock(&tz->lock);
	tz->last_temperature = tz->temperature;
	tz->temperature = temp;
	mutex_unlock(&tz->lock);

	trace_thermal_temperature(tz);

	thermal_genl_sampling_temp(tz->id, temp);
}

from linux/thermal.h:
429:
static inline int thermal_zone_get_temp(
		struct thermal_zone_device *tz, int *temp)
{ return -ENODEV; }


compiler should then read:
static void update_temperature(struct thermal_zone_device *tz)
{
	int temp, ret;

	ret = -ENODEV;
	if (ret) {
		if (ret != -EAGAIN)
			dev_warn(&tz->device,
				 "failed to read out thermal zone (%d)\n",
				 ret);
		return;
	}

however did find with extra search:
in /drivers/thermal/thermal_helpers.c:
78:
int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
and
115:
EXPORT_SYMBOL_GPL(thermal_zone_get_temp);


so is this bootup vs system hand off?
where bootup call thermal_zone_get_temp() shouldn't occur?

Steve



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: thermal driver patch
  2022-09-01 12:14           ` Steven J Abner
@ 2022-09-07 11:15             ` Steven J Abner
  0 siblings, 0 replies; 7+ messages in thread
From: Steven J Abner @ 2022-09-07 11:15 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: Randy Dunlap, Rafael J. Wysocki, linux-kernel, Linux PM

Additional info:
After an automatic overnight suspend, from dmesg:
[23668.033055] thermal thermal_zone0: failed to read out thermal zone 
(-61)
[23668.033197] PM: suspend exit

So is it possible that driver iwlwifi is built with 'return -ENODEV;' 
into
its init/reset code?
Also this code from kernel 5.18.19 instead of 5.18.12 initial report 
messaging.

Steve



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-07 11:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <DL9RGR.8W3XFSCFFYXI2.ref@att.net>
2022-08-17 10:39 ` thermal driver patch Steven J Abner
2022-08-29  5:47   ` Randy Dunlap
2022-08-29 12:20     ` Steven J Abner
2022-08-29 22:06       ` Randy Dunlap
2022-09-01  5:59         ` Daniel Lezcano
2022-09-01 12:14           ` Steven J Abner
2022-09-07 11:15             ` Steven J Abner

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).