linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build failure after merge of the thermal tree
@ 2020-12-15  1:58 Stephen Rothwell
  2020-12-15  8:35 ` [PATCH] thermal/drivers/devfreq: Fix missing dependency with the energy model Daniel Lezcano
  2020-12-15 15:42 ` [PATCH] thermal: devfreq_cooling: fix the build when !ENERGY_MODEL Lukasz Luba
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Rothwell @ 2020-12-15  1:58 UTC (permalink / raw)
  To: Daniel Lezcano, Zhang Rui
  Cc: Lukasz Luba, Linux Kernel Mailing List, Linux Next Mailing List

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

Hi all,

After merging the thermal tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

drivers/thermal/devfreq_cooling.c: In function 'devfreq_cooling_set_cur_state':
drivers/thermal/devfreq_cooling.c:102:9: error: 'struct device' has no member named 'em_pd'
  102 |  if (dev->em_pd) {
      |         ^~
drivers/thermal/devfreq_cooling.c:104:13: error: 'struct device' has no member named 'em_pd'
  104 |   freq = dev->em_pd->table[perf_idx].frequency * 1000;
      |             ^~
drivers/thermal/devfreq_cooling.c: In function 'devfreq_cooling_get_requested_power':
drivers/thermal/devfreq_cooling.c:207:23: error: 'struct device' has no member named 'em_pd'
  207 |    dfc->res_util = dev->em_pd->table[state].power;
      |                       ^~
drivers/thermal/devfreq_cooling.c:217:30: error: 'struct device' has no member named 'em_pd'
  217 |   perf_idx = get_perf_idx(dev->em_pd, freq / 1000);
      |                              ^~
drivers/thermal/devfreq_cooling.c:226:15: error: 'struct device' has no member named 'em_pd'
  226 |   *power = dev->em_pd->table[perf_idx].power;
      |               ^~
drivers/thermal/devfreq_cooling.c: In function 'devfreq_cooling_state2power':
drivers/thermal/devfreq_cooling.c:252:14: error: 'struct device' has no member named 'em_pd'
  252 |  *power = dev->em_pd->table[perf_idx].power;
      |              ^~
drivers/thermal/devfreq_cooling.c: In function 'devfreq_cooling_power2state':
drivers/thermal/devfreq_cooling.c:290:23: error: 'struct device' has no member named 'em_pd'
  290 |   if (est_power >= dev->em_pd->table[i].power)
      |                       ^~
drivers/thermal/devfreq_cooling.c: In function 'of_devfreq_cooling_register_power':
drivers/thermal/devfreq_cooling.c:377:9: error: 'struct device' has no member named 'em_pd'
  377 |  if (dev->em_pd) {
      |         ^~
drivers/thermal/devfreq_cooling.c:385:38: error: 'struct device' has no member named 'em_pd'
  385 |   num_opps = em_pd_nr_perf_states(dev->em_pd);
      |                                      ^~

Caused by commit

  615510fe13bd ("thermal: devfreq_cooling: remove old power model and use EM")

em_pd is only available when CONFIG_ENERGY_MODEL is set.

I have used the thermal tree from next-20201214 for today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [PATCH] thermal/drivers/devfreq: Fix missing dependency with the energy model
  2020-12-15  1:58 linux-next: build failure after merge of the thermal tree Stephen Rothwell
@ 2020-12-15  8:35 ` Daniel Lezcano
  2020-12-15  8:41   ` Daniel Lezcano
  2020-12-15  8:48   ` Stephen Rothwell
  2020-12-15 15:42 ` [PATCH] thermal: devfreq_cooling: fix the build when !ENERGY_MODEL Lukasz Luba
  1 sibling, 2 replies; 6+ messages in thread
From: Daniel Lezcano @ 2020-12-15  8:35 UTC (permalink / raw)
  To: daniel.lezcano, rui.zhang, lukasz.luba; +Cc: sfr, linux-kernel, linux-next

The devfreq cooling device has been converted to use the energy model.

Add the dependency on the ENERGY_MODEL option to reflect this change
and prevent build failure if the option is not set.

Fixes: 615510fe13bd2 ("thermal: devfreq_cooling: remove old power model and use EM")
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 7edc8dc6bbab..ee62d51ef351 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -193,6 +193,7 @@ config DEVFREQ_THERMAL
 	bool "Generic device cooling support"
 	depends on PM_DEVFREQ
 	depends on PM_OPP
+	depends on ENERGY_MODEL
 	help
 	  This implements the generic devfreq cooling mechanism through
 	  frequency reduction for devices using devfreq.
-- 
2.25.1


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

* Re: [PATCH] thermal/drivers/devfreq: Fix missing dependency with the energy model
  2020-12-15  8:35 ` [PATCH] thermal/drivers/devfreq: Fix missing dependency with the energy model Daniel Lezcano
@ 2020-12-15  8:41   ` Daniel Lezcano
  2020-12-15  8:48   ` Stephen Rothwell
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Lezcano @ 2020-12-15  8:41 UTC (permalink / raw)
  To: rui.zhang, lukasz.luba; +Cc: sfr, linux-kernel, linux-next, Arnd Bergmann


A separate patch should add the select ENERGY_MODEL in the
multi_v7_defconfig so the devfreq cooling device continues to build by
default as before.

Arnd?

On 15/12/2020 09:35, Daniel Lezcano wrote:
> The devfreq cooling device has been converted to use the energy model.
> 
> Add the dependency on the ENERGY_MODEL option to reflect this change
> and prevent build failure if the option is not set.
> 
> Fixes: 615510fe13bd2 ("thermal: devfreq_cooling: remove old power model and use EM")
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/thermal/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index 7edc8dc6bbab..ee62d51ef351 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -193,6 +193,7 @@ config DEVFREQ_THERMAL
>  	bool "Generic device cooling support"
>  	depends on PM_DEVFREQ
>  	depends on PM_OPP
> +	depends on ENERGY_MODEL
>  	help
>  	  This implements the generic devfreq cooling mechanism through
>  	  frequency reduction for devices using devfreq.
> 


-- 
<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] 6+ messages in thread

* Re: [PATCH] thermal/drivers/devfreq: Fix missing dependency with the energy model
  2020-12-15  8:35 ` [PATCH] thermal/drivers/devfreq: Fix missing dependency with the energy model Daniel Lezcano
  2020-12-15  8:41   ` Daniel Lezcano
@ 2020-12-15  8:48   ` Stephen Rothwell
  2020-12-15 10:44     ` Lukasz Luba
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2020-12-15  8:48 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: rui.zhang, lukasz.luba, linux-kernel, linux-next

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

Hi Daniel,

On Tue, 15 Dec 2020 09:35:20 +0100 Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
> The devfreq cooling device has been converted to use the energy model.
> 
> Add the dependency on the ENERGY_MODEL option to reflect this change
> and prevent build failure if the option is not set.
> 
> Fixes: 615510fe13bd2 ("thermal: devfreq_cooling: remove old power model and use EM")

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>

> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/thermal/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index 7edc8dc6bbab..ee62d51ef351 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -193,6 +193,7 @@ config DEVFREQ_THERMAL
>  	bool "Generic device cooling support"
>  	depends on PM_DEVFREQ
>  	depends on PM_OPP
> +	depends on ENERGY_MODEL
>  	help
>  	  This implements the generic devfreq cooling mechanism through
>  	  frequency reduction for devices using devfreq.

Looks good to me.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] thermal/drivers/devfreq: Fix missing dependency with the energy model
  2020-12-15  8:48   ` Stephen Rothwell
@ 2020-12-15 10:44     ` Lukasz Luba
  0 siblings, 0 replies; 6+ messages in thread
From: Lukasz Luba @ 2020-12-15 10:44 UTC (permalink / raw)
  To: Stephen Rothwell, Daniel Lezcano; +Cc: rui.zhang, linux-kernel, linux-next



On 12/15/20 8:48 AM, Stephen Rothwell wrote:
> Hi Daniel,
> 
> On Tue, 15 Dec 2020 09:35:20 +0100 Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>>
>> The devfreq cooling device has been converted to use the energy model.
>>
>> Add the dependency on the ENERGY_MODEL option to reflect this change
>> and prevent build failure if the option is not set.
>>
>> Fixes: 615510fe13bd2 ("thermal: devfreq_cooling: remove old power model and use EM")
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> 
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>>   drivers/thermal/Kconfig | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
>> index 7edc8dc6bbab..ee62d51ef351 100644
>> --- a/drivers/thermal/Kconfig
>> +++ b/drivers/thermal/Kconfig
>> @@ -193,6 +193,7 @@ config DEVFREQ_THERMAL
>>   	bool "Generic device cooling support"
>>   	depends on PM_DEVFREQ
>>   	depends on PM_OPP
>> +	depends on ENERGY_MODEL
>>   	help
>>   	  This implements the generic devfreq cooling mechanism through
>>   	  frequency reduction for devices using devfreq.
> 
> Looks good to me.
> 

My apologies. I've tested it on odroidxu3 with
exynos_defconfig which has the energy model set.

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

Regards,
Lukasz

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

* [PATCH] thermal: devfreq_cooling: fix the build when !ENERGY_MODEL
  2020-12-15  1:58 linux-next: build failure after merge of the thermal tree Stephen Rothwell
  2020-12-15  8:35 ` [PATCH] thermal/drivers/devfreq: Fix missing dependency with the energy model Daniel Lezcano
@ 2020-12-15 15:42 ` Lukasz Luba
  1 sibling, 0 replies; 6+ messages in thread
From: Lukasz Luba @ 2020-12-15 15:42 UTC (permalink / raw)
  To: linux-kernel, daniel.lezcano, sfr; +Cc: linux-next, rui.zhang, lukasz.luba

Prevent build failure if the option CONFIG_ENERGY_MODEL is not set. The
devfreq cooling is able to operate without the Energy Model.
Don't use dev->em_pd directly and use local pointer.

Fixes: 615510fe13bd2 ("thermal: devfreq_cooling: remove old power model and use EM")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
Hi Daniel,

The devfreq cooling implementation can work without the EM and it has been
design to handle it. There is only one bit that needs to be changed and
used as in v2 (where there was this 'em' private field).
Implementation is similar to the cpufreq cooling.
We don't need to put the ENERGY_MODEL dependency in Kconfig.

Regards,
Lukasz


 drivers/thermal/devfreq_cooling.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c
index df1049a34777..fed3121ff2a1 100644
--- a/drivers/thermal/devfreq_cooling.c
+++ b/drivers/thermal/devfreq_cooling.c
@@ -48,6 +48,7 @@ static DEFINE_IDA(devfreq_ida);
  * @capped_state:	index to cooling state with in dynamic power budget
  * @req_max_freq:	PM QoS request for limiting the maximum frequency
  *			of the devfreq device.
+ * @em_pd:		Energy Model for the associated Devfreq device
  */
 struct devfreq_cooling_device {
 	int id;
@@ -60,6 +61,7 @@ struct devfreq_cooling_device {
 	u32 res_util;
 	int capped_state;
 	struct dev_pm_qos_request req_max_freq;
+	struct em_perf_domain *em_pd;
 };
 
 static int devfreq_cooling_get_max_state(struct thermal_cooling_device *cdev,
@@ -99,9 +101,9 @@ static int devfreq_cooling_set_cur_state(struct thermal_cooling_device *cdev,
 	if (state > dfc->max_state)
 		return -EINVAL;
 
-	if (dev->em_pd) {
+	if (dfc->em_pd) {
 		perf_idx = dfc->max_state - state;
-		freq = dev->em_pd->table[perf_idx].frequency * 1000;
+		freq = dfc->em_pd->table[perf_idx].frequency * 1000;
 	} else {
 		freq = dfc->freq_table[state];
 	}
@@ -181,7 +183,6 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd
 {
 	struct devfreq_cooling_device *dfc = cdev->devdata;
 	struct devfreq *df = dfc->devfreq;
-	struct device *dev = df->dev.parent;
 	struct devfreq_dev_status status;
 	unsigned long state;
 	unsigned long freq;
@@ -204,7 +205,7 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd
 		res = dfc->power_ops->get_real_power(df, power, freq, voltage);
 		if (!res) {
 			state = dfc->capped_state;
-			dfc->res_util = dev->em_pd->table[state].power;
+			dfc->res_util = dfc->em_pd->table[state].power;
 			dfc->res_util *= SCALE_ERROR_MITIGATION;
 
 			if (*power > 1)
@@ -214,7 +215,7 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd
 		}
 	} else {
 		/* Energy Model frequencies are in kHz */
-		perf_idx = get_perf_idx(dev->em_pd, freq / 1000);
+		perf_idx = get_perf_idx(dfc->em_pd, freq / 1000);
 		if (perf_idx < 0) {
 			res = -EAGAIN;
 			goto fail;
@@ -223,7 +224,7 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd
 		_normalize_load(&status);
 
 		/* Scale power for utilization */
-		*power = dev->em_pd->table[perf_idx].power;
+		*power = dfc->em_pd->table[perf_idx].power;
 		*power *= status.busy_time;
 		*power >>= 10;
 	}
@@ -241,15 +242,13 @@ static int devfreq_cooling_state2power(struct thermal_cooling_device *cdev,
 				       unsigned long state, u32 *power)
 {
 	struct devfreq_cooling_device *dfc = cdev->devdata;
-	struct devfreq *df = dfc->devfreq;
-	struct device *dev = df->dev.parent;
 	int perf_idx;
 
 	if (state > dfc->max_state)
 		return -EINVAL;
 
 	perf_idx = dfc->max_state - state;
-	*power = dev->em_pd->table[perf_idx].power;
+	*power = dfc->em_pd->table[perf_idx].power;
 
 	return 0;
 }
@@ -259,7 +258,6 @@ static int devfreq_cooling_power2state(struct thermal_cooling_device *cdev,
 {
 	struct devfreq_cooling_device *dfc = cdev->devdata;
 	struct devfreq *df = dfc->devfreq;
-	struct device *dev = df->dev.parent;
 	struct devfreq_dev_status status;
 	unsigned long freq;
 	s32 est_power;
@@ -287,7 +285,7 @@ static int devfreq_cooling_power2state(struct thermal_cooling_device *cdev,
 	 * budget. The EM power table is sorted ascending.
 	 */
 	for (i = dfc->max_state; i > 0; i--)
-		if (est_power >= dev->em_pd->table[i].power)
+		if (est_power >= dfc->em_pd->table[i].power)
 			break;
 
 	*state = dfc->max_state - i;
@@ -374,7 +372,8 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
 
 	dfc->devfreq = df;
 
-	if (dev->em_pd) {
+	dfc->em_pd = em_pd_get(dev);
+	if (dfc->em_pd) {
 		devfreq_cooling_ops.get_requested_power =
 			devfreq_cooling_get_requested_power;
 		devfreq_cooling_ops.state2power = devfreq_cooling_state2power;
@@ -382,7 +381,7 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
 
 		dfc->power_ops = dfc_power;
 
-		num_opps = em_pd_nr_perf_states(dev->em_pd);
+		num_opps = em_pd_nr_perf_states(dfc->em_pd);
 	} else {
 		/* Backward compatibility for drivers which do not use IPA */
 		dev_dbg(dev, "missing EM for cooling device\n");
-- 
2.17.1


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

end of thread, other threads:[~2020-12-15 15:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15  1:58 linux-next: build failure after merge of the thermal tree Stephen Rothwell
2020-12-15  8:35 ` [PATCH] thermal/drivers/devfreq: Fix missing dependency with the energy model Daniel Lezcano
2020-12-15  8:41   ` Daniel Lezcano
2020-12-15  8:48   ` Stephen Rothwell
2020-12-15 10:44     ` Lukasz Luba
2020-12-15 15:42 ` [PATCH] thermal: devfreq_cooling: fix the build when !ENERGY_MODEL Lukasz Luba

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