• Rafael J. Wysocki's avatar
    thermal: core: Back off when polling thermal zones on errors · f7c1b0e4
    Rafael J. Wysocki authored
    Commit a8a26177 ("thermal: core: Call monitor_thermal_zone() if zone
    temperature is invalid") introduced a polling mechanism by which the
    thermal core attampts to get a valid temperature value for thermal zones
    where the .get_temp() callback returns errors to start with (for
    example, due to initialization ordering woes).  However, this polling is
    carried out periodically ad infinitum and every iteration of it causes
    a message to be printed to the kernel log which means a lot of log noise
    on systems where there are thermal zones that never get ready for some
    reason.  It is also not really useful to continuously poll thermal zones
    that never respond.
    
    To address this, modify the thermal core to increase the delay between
    consecutive thermal zone temperature checks after every check that fails
    until it reaches a certain maximum value.  At that point, the thermal
    zone in question will be disabled, but user space will be able to
    reenable it if it believes that the failure is transient.
    
    Also change the code to print messages regarding failed temperature
    checks to the kernel log only twice, once when the thermal zone's
    .get_temp() callback returns an error for the first time and once when
    disabling the given thermal zone.  In addition, a dev_crit() message
    will be printed at that point if the given thermal zone contains a
    critical trip point to notify the system operator about the situation.
    
    Fixes: a8a26177 ("thermal: core: Call monitor_thermal_zone() if zone temperature is invalid")
    Link: https://lore.kernel.org/linux-acpi/CAGnHSE=RyPK++UG0-wAtVKgeJxe0uzFYgLxm+RUOKKoQquW=Ow@mail.gmail.com/Reported-by: default avatarTom Yan <tom.ty89@gmail.com>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Link: https://patch.msgid.link/2962033.e9J7NaK4W3@rjwysocki.net
    f7c1b0e4
thermal_core.c 47.6 KB