Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+17 -7
+3
drivers/thermal/gov_power_allocator.c
··· 759 759 return; 760 760 } 761 761 762 + if (!params->trip_max) 763 + return; 764 + 762 765 allocate_power(tz, params->trip_max->temperature); 763 766 params->update_cdevs = true; 764 767 }
+8 -7
drivers/thermal/thermal_core.c
··· 300 300 thermal_zone_device_set_polling(tz, tz->passive_delay_jiffies); 301 301 else if (tz->polling_delay_jiffies) 302 302 thermal_zone_device_set_polling(tz, tz->polling_delay_jiffies); 303 + else if (tz->temperature == THERMAL_TEMP_INVALID) 304 + thermal_zone_device_set_polling(tz, msecs_to_jiffies(THERMAL_RECHECK_DELAY_MS)); 303 305 } 304 306 305 307 static struct thermal_governor *thermal_get_tz_governor(struct thermal_zone_device *tz) ··· 484 482 thermal_governor_trip_crossed(governor, tz, trip, crossed_up); 485 483 } 486 484 487 - static int thermal_trip_notify_cmp(void *ascending, const struct list_head *a, 485 + static int thermal_trip_notify_cmp(void *not_used, const struct list_head *a, 488 486 const struct list_head *b) 489 487 { 490 488 struct thermal_trip_desc *tda = container_of(a, struct thermal_trip_desc, 491 489 notify_list_node); 492 490 struct thermal_trip_desc *tdb = container_of(b, struct thermal_trip_desc, 493 491 notify_list_node); 494 - int ret = tdb->notify_temp - tda->notify_temp; 495 - 496 - return ascending ? ret : -ret; 492 + return tda->notify_temp - tdb->notify_temp; 497 493 } 498 494 499 495 void __thermal_zone_device_update(struct thermal_zone_device *tz, ··· 511 511 update_temperature(tz); 512 512 513 513 if (tz->temperature == THERMAL_TEMP_INVALID) 514 - return; 514 + goto monitor; 515 515 516 516 __thermal_zone_set_trips(tz); 517 517 ··· 520 520 for_each_trip_desc(tz, td) 521 521 handle_thermal_trip(tz, td, &way_up_list, &way_down_list); 522 522 523 - list_sort(&way_up_list, &way_up_list, thermal_trip_notify_cmp); 523 + list_sort(NULL, &way_up_list, thermal_trip_notify_cmp); 524 524 list_for_each_entry(td, &way_up_list, notify_list_node) 525 525 thermal_trip_crossed(tz, &td->trip, governor, true); 526 526 527 527 list_sort(NULL, &way_down_list, thermal_trip_notify_cmp); 528 - list_for_each_entry(td, &way_down_list, notify_list_node) 528 + list_for_each_entry_reverse(td, &way_down_list, notify_list_node) 529 529 thermal_trip_crossed(tz, &td->trip, governor, false); 530 530 531 531 if (governor->manage) ··· 533 533 534 534 thermal_debug_update_trip_stats(tz); 535 535 536 + monitor: 536 537 monitor_thermal_zone(tz); 537 538 } 538 539
+6
drivers/thermal/thermal_core.h
··· 133 133 struct thermal_trip_desc trips[] __counted_by(num_trips); 134 134 }; 135 135 136 + /* 137 + * Default delay after a failing thermal zone temperature check before 138 + * attempting to check it again. 139 + */ 140 + #define THERMAL_RECHECK_DELAY_MS 250 141 + 136 142 /* Default Thermal Governor */ 137 143 #if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE) 138 144 #define DEFAULT_THERMAL_GOVERNOR "step_wise"