mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
Thermal control fixes for 6.10-rc8
- Prevent the Power Allocator thermal governor from dereferencing a NULL
pointer if it is bound to a tripless thermal zone (Nícolas Prado).
- Prevent thermal zones enabled too early from staying effectively
dormant forever because their temperature cannot be determined
initially (Rafael Wysocki).
- Fix list sorting during thermal zone temperature updates to ensure
the proper ordering of trip crossing notifications (Rafael Wysocki).
-----BEGIN PGP SIGNATURE-----
iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmaOZdQSHHJqd0Byand5
c29ja2kubmV0AAoJEILEb/54YlRxV0gQALKvi36z4lCF2NpZtncnS0TCwiqknb3h
I5W7O28EeED/qKxtUhT0rKaFJA5py9Civ2J1xfccnsO2KLlLtZxzL2yNrHHnewGZ
SCdVDommTh0zIw01d7h4dzFPE73cYWoX5kwsto9ty0/xi6IBt019LLCIJgB6OmqA
pu4RoESkhxoVFNrV8dtB7Fj+IT9rIGHtC0c4DZXqIgz6MJkiNAXzwyhL2N7icxlx
zPhDSBWv2CLTqVxFAFxSc0Hq5FUieU/vMjkrpT4liR4KuTnbqmxOw2pFdgsCf/AJ
CKhef9aqXeoQYIMTbCreOdgAYMtNekjnUuta8OMwCxop9HCVhh1O1asMURiIX5VT
8SRal1nDgmTXG5NR0V6TVJ2VYQ6amfqSux0B2lyxcMxr4VsY4kekpsnXXPO68rHB
ZVCSIza/fH13dyYOrd0GC7Qz2bGRKYstiXXDZc6s69ij7ulDNpG61M49M3W1V7wk
v2p0SZwjFax3H5DPyd7b9pvBEeAsKGCco2wm/BLauYtnciSsIQBw3Q330DGzsXBm
EN7vGq8q/w6D6Y3S0syiRyGcaDpDK3FmZerXdASaBRNkWvnXn3fhsOngBY62+3iX
LqVbvXar2Of//Q9NkvF3S1ko4tJF78vplqz+ScjHUnIE6kfpoby+CVupIcbVXceB
bcsyCAFYcYlL
=o+Gb
-----END PGP SIGNATURE-----
Merge tag 'thermal-6.10-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull thermal control fixes from Rafael Wysocki:
"These fix a possible NULL pointer dereference in a thermal governor,
fix up the handling of thermal zones enabled before their temperature
can be determined and fix list sorting during thermal zone temperature
updates.
Specifics:
- Prevent the Power Allocator thermal governor from dereferencing a
NULL pointer if it is bound to a tripless thermal zone (Nícolas
Prado)
- Prevent thermal zones enabled too early from staying effectively
dormant forever because their temperature cannot be determined
initially (Rafael Wysocki)
- Fix list sorting during thermal zone temperature updates to ensure
the proper ordering of trip crossing notifications (Rafael
Wysocki)"
* tag 'thermal-6.10-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
thermal: core: Fix list sorting in __thermal_zone_device_update()
thermal: core: Call monitor_thermal_zone() if zone temperature is invalid
thermal: gov_power_allocator: Return early in manage if trip_max is NULL
This commit is contained in:
commit
d045c46c52
|
|
@ -759,6 +759,9 @@ static void power_allocator_manage(struct thermal_zone_device *tz)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!params->trip_max)
|
||||
return;
|
||||
|
||||
allocate_power(tz, params->trip_max->temperature);
|
||||
params->update_cdevs = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,6 +300,8 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz)
|
|||
thermal_zone_device_set_polling(tz, tz->passive_delay_jiffies);
|
||||
else if (tz->polling_delay_jiffies)
|
||||
thermal_zone_device_set_polling(tz, tz->polling_delay_jiffies);
|
||||
else if (tz->temperature == THERMAL_TEMP_INVALID)
|
||||
thermal_zone_device_set_polling(tz, msecs_to_jiffies(THERMAL_RECHECK_DELAY_MS));
|
||||
}
|
||||
|
||||
static struct thermal_governor *thermal_get_tz_governor(struct thermal_zone_device *tz)
|
||||
|
|
@ -482,16 +484,14 @@ static void thermal_trip_crossed(struct thermal_zone_device *tz,
|
|||
thermal_governor_trip_crossed(governor, tz, trip, crossed_up);
|
||||
}
|
||||
|
||||
static int thermal_trip_notify_cmp(void *ascending, const struct list_head *a,
|
||||
static int thermal_trip_notify_cmp(void *not_used, const struct list_head *a,
|
||||
const struct list_head *b)
|
||||
{
|
||||
struct thermal_trip_desc *tda = container_of(a, struct thermal_trip_desc,
|
||||
notify_list_node);
|
||||
struct thermal_trip_desc *tdb = container_of(b, struct thermal_trip_desc,
|
||||
notify_list_node);
|
||||
int ret = tdb->notify_temp - tda->notify_temp;
|
||||
|
||||
return ascending ? ret : -ret;
|
||||
return tda->notify_temp - tdb->notify_temp;
|
||||
}
|
||||
|
||||
void __thermal_zone_device_update(struct thermal_zone_device *tz,
|
||||
|
|
@ -511,7 +511,7 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
|
|||
update_temperature(tz);
|
||||
|
||||
if (tz->temperature == THERMAL_TEMP_INVALID)
|
||||
return;
|
||||
goto monitor;
|
||||
|
||||
__thermal_zone_set_trips(tz);
|
||||
|
||||
|
|
@ -520,12 +520,12 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
|
|||
for_each_trip_desc(tz, td)
|
||||
handle_thermal_trip(tz, td, &way_up_list, &way_down_list);
|
||||
|
||||
list_sort(&way_up_list, &way_up_list, thermal_trip_notify_cmp);
|
||||
list_sort(NULL, &way_up_list, thermal_trip_notify_cmp);
|
||||
list_for_each_entry(td, &way_up_list, notify_list_node)
|
||||
thermal_trip_crossed(tz, &td->trip, governor, true);
|
||||
|
||||
list_sort(NULL, &way_down_list, thermal_trip_notify_cmp);
|
||||
list_for_each_entry(td, &way_down_list, notify_list_node)
|
||||
list_for_each_entry_reverse(td, &way_down_list, notify_list_node)
|
||||
thermal_trip_crossed(tz, &td->trip, governor, false);
|
||||
|
||||
if (governor->manage)
|
||||
|
|
@ -533,6 +533,7 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
|
|||
|
||||
thermal_debug_update_trip_stats(tz);
|
||||
|
||||
monitor:
|
||||
monitor_thermal_zone(tz);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,6 +133,12 @@ struct thermal_zone_device {
|
|||
struct thermal_trip_desc trips[] __counted_by(num_trips);
|
||||
};
|
||||
|
||||
/*
|
||||
* Default delay after a failing thermal zone temperature check before
|
||||
* attempting to check it again.
|
||||
*/
|
||||
#define THERMAL_RECHECK_DELAY_MS 250
|
||||
|
||||
/* Default Thermal Governor */
|
||||
#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
|
||||
#define DEFAULT_THERMAL_GOVERNOR "step_wise"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user