All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/8] Introduce warming in thermal framework
@ 2020-09-17  3:22 Thara Gopinath
  2020-09-17  3:22 ` [PATCH RFC 1/8] dt-bindings: thermal: Introduce monitor-falling parameter to thermal trip point binding Thara Gopinath
                   ` (8 more replies)
  0 siblings, 9 replies; 17+ messages in thread
From: Thara Gopinath @ 2020-09-17  3:22 UTC (permalink / raw)
  To: rui.zhang, daniel.lezcano, robh+dt, agross, bjorn.andersson
  Cc: linux-pm, devicetree, linux-kernel, linux-arm-msm, lukasz.luba,
	amitk

Thermal framework today supports monitoring for rising temperatures and
subsequently initiating cooling action in case of a thermal trip point
being crossed. There are scenarios where a SoC need warming mitigating
action to be activated if the temperature falls below a cetain permissible
limit.  Since warming action can be considered mirror opposite of cooling
action, most of the thermal framework can be re-used to achieve this. The
key assumption in this patch series is that a device can act either as a
warming device or a cooling device and not as both.

In order to support warming three extensions are needed in the thermal
framework.

1. Indication that a trip point is being monitored for falling temperature
and not rising temperature. We discussed two different ways to achieve this
during LPC. First option is to introduce a new trip type to indicate that a
trip is a cold trip(THERMAL_TRIP_COLD). The second option is to introduce a
new property for trip point that will indicate whether a trip point is
being monitored for rising temperature or falling temperature. The patch
series(patches 1-4) chooses the second approach since it allows trip points
of any type to be monitored for rising or falling temperature.Also this was
the preferred approach when discussed during LPC. The approach that
introduces a new cold trip type was posted on the list earlier as a RFC and
can be found at [1].

2. Extend the exisitng governors to handle monitoring of falling
temperature. The patch series(patches 5 & 6) extends the step wise governor
to monitor the falling temperature.Other governors return doing nothing if
the trip point they are being called for is being monitored for falling
temperature. The governors' mitigate function is called "throttle" in the
thermal framework and with this patch series it is a misnomer as the
function is called for both throttling and warming up. Ideally
"throttle" should be renamed to "mitigate" to improve readability of code.
The renaming is not part of this series.

3. Finally, the cooling device framework itself can be reused for a warming
device. As stated before a device can act either as a warming device or a
cooling device and not as both.  With this the cooling state in the
framework can be considered as mitigating state with 0 as the state with no
thermal mitigation and higher the number higher the thermal mitigation.
Again what affects the code readability and comprehension is the term
"cooling" which is a misnomer here. Ideally the term "cooling" should be
renamed to "mitigating" and hence thermal_cooling_device will become
thermal_mitgating_device. The renaming is not part of the patch series as
even though the renaming is a simple search-replace, it will change a lot
of files.  The patch series(patches 7 & 8) instead introduces a minimal set
of _warming_device_ apis to register and unregister warming devices which
internally is identical to the _cooling_device_ counterpart.

1. https://lkml.org/lkml/2020/7/10/639

Thara Gopinath (8):
  dt-bindings: thermal: Introduce monitor-falling parameter to thermal
    trip point binding
  thermal: Introduce new property monitor_type for trip point.
  thermal: thermal_of: Extend thermal dt driver to support
    bi-directional monitoring of a thermal trip point.
  thermal:core:Add genetlink notifications for monitoring falling
    temperature
  thermal: gov_step_wise: Extend thermal step-wise governor to monitor
    falling temperature.
  thermal: Modify thermal governors to do nothing for trip points being
    monitored for falling temperature
  thermal:core: Add is_warming_dev and supporting warming device api's
    to the cooling dev framework.
  soc:qcom:qcom_aoss: Change cooling_device_register to
    warming_device_register

 .../bindings/thermal/thermal-zones.yaml       |   7 ++
 drivers/soc/qcom/qcom_aoss.c                  |   6 +-
 drivers/thermal/gov_bang_bang.c               |  12 ++
 drivers/thermal/gov_fair_share.c              |  12 ++
 drivers/thermal/gov_power_allocator.c         |  12 ++
 drivers/thermal/gov_step_wise.c               |  62 +++++++---
 drivers/thermal/thermal_core.c                | 113 +++++++++++++++---
 drivers/thermal/thermal_core.h                |   2 +
 drivers/thermal/thermal_of.c                  |  22 ++++
 include/linux/thermal.h                       |   9 ++
 include/uapi/linux/thermal.h                  |   5 +
 11 files changed, 226 insertions(+), 36 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: [PATCH RFC 4/8] thermal:core:Add genetlink notifications for monitoring falling temperature
@ 2020-09-17 11:19 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2020-09-17 11:19 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200917032226.820371-5-thara.gopinath@linaro.org>
References: <20200917032226.820371-5-thara.gopinath@linaro.org>
TO: Thara Gopinath <thara.gopinath@linaro.org>

Hi Thara,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v5.9-rc5 next-20200916]
[cannot apply to thermal/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Thara-Gopinath/Introduce-warming-in-thermal-framework/20200917-113050
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago
config: x86_64-randconfig-m001-20200917 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/thermal/thermal_core.c:436 handle_thermal_trip() error: uninitialized symbol 'mon_type'.

# https://github.com/0day-ci/linux/commit/602ffc327f610db12c9657821c144d359c9d1f7f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Thara-Gopinath/Introduce-warming-in-thermal-framework/20200917-113050
git checkout 602ffc327f610db12c9657821c144d359c9d1f7f
vim +/mon_type +436 drivers/thermal/thermal_core.c

0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  416  
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  417  static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  418  {
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  419  	enum thermal_trip_type type;
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  420  	enum thermal_trip_monitor_type mon_type;
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  421  	int trip_temp, hyst = 0;
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  422  
81ad4276b505e98 drivers/thermal/thermal_core.c Zhang Rui      2016-03-18  423  	/* Ignore disabled trip points */
81ad4276b505e98 drivers/thermal/thermal_core.c Zhang Rui      2016-03-18  424  	if (test_bit(trip, &tz->trips_disabled))
81ad4276b505e98 drivers/thermal/thermal_core.c Zhang Rui      2016-03-18  425  		return;
81ad4276b505e98 drivers/thermal/thermal_core.c Zhang Rui      2016-03-18  426  
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  427  	tz->ops->get_trip_temp(tz, trip, &trip_temp);
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  428  	tz->ops->get_trip_type(tz, trip, &type);
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  429  	if (tz->ops->get_trip_hyst)
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  430  		tz->ops->get_trip_hyst(tz, trip, &hyst);
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  431  
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  432  	if (tz->ops->get_trip_mon_type)
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  433  		tz->ops->get_trip_mon_type(tz, trip, &mon_type);
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  434  
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  435  	if (tz->last_temperature != THERMAL_TEMP_INVALID) {
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16 @436  		if (mon_type == THERMAL_TRIP_MONITOR_FALLING) {
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  437  			if (tz->last_temperature > trip_temp &&
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  438  			    tz->temperature <= trip_temp)
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  439  				thermal_notify_tz_trip_down(tz->id, trip);
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  440  			if (tz->last_temperature <= trip_temp &&
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  441  			    tz->temperature > (trip_temp + hyst))
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  442  				thermal_notify_tz_trip_up(tz->id, trip);
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  443  		} else {
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  444  			if (tz->last_temperature < trip_temp &&
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  445  			    tz->temperature >= trip_temp)
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  446  				thermal_notify_tz_trip_up(tz->id, trip);
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  447  			if (tz->last_temperature >= trip_temp &&
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  448  			    tz->temperature < (trip_temp - hyst))
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  449  				thermal_notify_tz_trip_down(tz->id, trip);
55cdf0a283b8760 drivers/thermal/thermal_core.c Daniel Lezcano 2020-07-06  450  		}
602ffc327f610db drivers/thermal/thermal_core.c Thara Gopinath 2020-09-16  451  	}
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  452  
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  453  	if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT)
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  454  		handle_critical_trips(tz, trip, type);
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  455  	else
5be52fccaf3d218 drivers/thermal/thermal_core.c Lukasz Luba    2018-10-15  456  		handle_non_critical_trips(tz, trip);
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  457  	/*
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  458  	 * Alright, we handled this trip successfully.
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  459  	 * So, start monitoring again.
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  460  	 */
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  461  	monitor_thermal_zone(tz);
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  462  }
0c01ebbfd3caf1d drivers/thermal/thermal_sys.c  Durgadoss R    2012-09-18  463  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 30048 bytes --]

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

end of thread, other threads:[~2020-10-19 19:23 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-17  3:22 [PATCH RFC 0/8] Introduce warming in thermal framework Thara Gopinath
2020-09-17  3:22 ` [PATCH RFC 1/8] dt-bindings: thermal: Introduce monitor-falling parameter to thermal trip point binding Thara Gopinath
2020-09-23 16:03   ` Rob Herring
2020-09-28 11:21     ` Thara Gopinath
2020-09-17  3:22 ` [PATCH RFC 2/8] thermal: Introduce new property monitor_type for trip point Thara Gopinath
2020-09-17  3:22 ` [PATCH RFC 3/8] thermal: thermal_of: Extend thermal dt driver to support bi-directional monitoring of a thermal " Thara Gopinath
2020-09-17  3:22 ` [PATCH RFC 4/8] thermal:core:Add genetlink notifications for monitoring falling temperature Thara Gopinath
2020-09-17 12:08   ` Dan Carpenter
2020-09-17 12:08     ` Dan Carpenter
2020-09-17  3:22 ` [PATCH RFC 5/8] thermal: gov_step_wise: Extend thermal step-wise governor to monitor " Thara Gopinath
2020-09-17  3:22 ` [PATCH RFC 6/8] thermal: Modify thermal governors to do nothing for trip points being monitored for " Thara Gopinath
2020-09-17  3:22 ` [PATCH RFC 7/8] thermal:core: Add is_warming_dev and supporting warming device api's to the cooling dev framework Thara Gopinath
2020-09-17  3:22 ` [PATCH RFC 8/8] soc:qcom:qcom_aoss: Change cooling_device_register to warming_device_register Thara Gopinath
2020-09-17  7:36   ` kernel test robot
2020-10-19 18:42 ` [PATCH RFC 0/8] Introduce warming in thermal framework Thara Gopinath
2020-10-19 19:22   ` Daniel Lezcano
  -- strict thread matches above, loose matches on Subject: below --
2020-09-17 11:19 [PATCH RFC 4/8] thermal:core:Add genetlink notifications for monitoring falling temperature kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.