public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [rafael-pm:bleeding-edge 103/108] drivers/powercap/dtpm_cpu.c:83:15: error: call to undeclared function 'sched_cpu_util'; ISO C99 and later do not support implicit function declarations
@ 2025-03-06 19:34 kernel test robot
  2025-03-10  2:56 ` [RFC PATCH] drivers/powercap: fix build error when CONFIG_SMP is not set Xuewen Yan
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2025-03-06 19:34 UTC (permalink / raw)
  To: Jeson Gao
  Cc: llvm, oe-kbuild-all, linux-acpi, devel, linux-pm,
	Rafael J. Wysocki, Lukasz Luba

Hi Jeson,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head:   96791086aa226b85fe090573b9e3668ac53d5364
commit: 9144584c375e73a4fef6bde3ce399ad43e011b37 [103/108] PM: EM: Rework the depends on for CONFIG_ENERGY_MODEL
config: um-allmodconfig (https://download.01.org/0day-ci/archive/20250307/202503070326.9hEUez42-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 14170b16028c087ca154878f5ed93d3089a965c6)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250307/202503070326.9hEUez42-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503070326.9hEUez42-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/powercap/dtpm_cpu.c:83:15: error: call to undeclared function 'sched_cpu_util'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      83 |                 sum_util += sched_cpu_util(cpu);
         |                             ^
   1 error generated.


vim +/sched_cpu_util +83 drivers/powercap/dtpm_cpu.c

0e8f68d7f04856 Daniel Lezcano   2020-12-08  70  
eb82bace893169 Daniel Lezcano   2021-03-12  71  static u64 scale_pd_power_uw(struct cpumask *pd_mask, u64 power)
eb82bace893169 Daniel Lezcano   2021-03-12  72  {
bb4479994945e9 Dietmar Eggemann 2022-06-21  73  	unsigned long max, sum_util = 0;
eb82bace893169 Daniel Lezcano   2021-03-12  74  	int cpu;
eb82bace893169 Daniel Lezcano   2021-03-12  75  
eb82bace893169 Daniel Lezcano   2021-03-12  76  	/*
eb82bace893169 Daniel Lezcano   2021-03-12  77  	 * The capacity is the same for all CPUs belonging to
bb4479994945e9 Dietmar Eggemann 2022-06-21  78  	 * the same perf domain.
eb82bace893169 Daniel Lezcano   2021-03-12  79  	 */
bb4479994945e9 Dietmar Eggemann 2022-06-21  80  	max = arch_scale_cpu_capacity(cpumask_first(pd_mask));
eb82bace893169 Daniel Lezcano   2021-03-12  81  
bb4479994945e9 Dietmar Eggemann 2022-06-21  82  	for_each_cpu_and(cpu, pd_mask, cpu_online_mask)
bb4479994945e9 Dietmar Eggemann 2022-06-21 @83  		sum_util += sched_cpu_util(cpu);
bb4479994945e9 Dietmar Eggemann 2022-06-21  84  
bb4479994945e9 Dietmar Eggemann 2022-06-21  85  	return (power * ((sum_util << 10) / max)) >> 10;
eb82bace893169 Daniel Lezcano   2021-03-12  86  }
eb82bace893169 Daniel Lezcano   2021-03-12  87  

:::::: The code at line 83 was first introduced by commit
:::::: bb4479994945e9170534389a7762eb56149320ac sched, drivers: Remove max param from effective_cpu_util()/sched_cpu_util()

:::::: TO: Dietmar Eggemann <dietmar.eggemann@arm.com>
:::::: CC: Peter Zijlstra <peterz@infradead.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* [RFC PATCH] drivers/powercap: fix build error when CONFIG_SMP is not set
  2025-03-06 19:34 [rafael-pm:bleeding-edge 103/108] drivers/powercap/dtpm_cpu.c:83:15: error: call to undeclared function 'sched_cpu_util'; ISO C99 and later do not support implicit function declarations kernel test robot
@ 2025-03-10  2:56 ` Xuewen Yan
  0 siblings, 0 replies; 2+ messages in thread
From: Xuewen Yan @ 2025-03-10  2:56 UTC (permalink / raw)
  To: lkp, rjw, daniel.lezcano
  Cc: devel, jeson.gao, linux-acpi, linux-pm, llvm, lukasz.luba,
	oe-kbuild-all, rafael, ke.wang, di.shen, xuewen.yan94

When CONFIG_ENERGY_MODEL=y and CONFIG_SMP=n, there is build error:

>> drivers/powercap/dtpm_cpu.c:83:15: error: call to undeclared function 'sched_cpu_util';
ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      83 |                 sum_util += sched_cpu_util(cpu);
         |                             ^
   1 error generated.

This is because the sched_cpu_util depends on CONFIG_SMP,
so using the #ifdef to guarantee the dependence.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202503070326.9hEUez42-lkp@intel.com/
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
---
 drivers/powercap/dtpm_cpu.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c
index 6b6f51b21550..b935e8c38b45 100644
--- a/drivers/powercap/dtpm_cpu.c
+++ b/drivers/powercap/dtpm_cpu.c
@@ -68,6 +68,7 @@ static u64 set_pd_power_limit(struct dtpm *dtpm, u64 power_limit)
 	return power_limit;
 }
 
+#ifdef CONFIG_SMP
 static u64 scale_pd_power_uw(struct cpumask *pd_mask, u64 power)
 {
 	unsigned long max, sum_util = 0;
@@ -84,6 +85,12 @@ static u64 scale_pd_power_uw(struct cpumask *pd_mask, u64 power)
 
 	return (power * ((sum_util << 10) / max)) >> 10;
 }
+#else /* !CONFIG_SMP */
+static inline u64 scale_pd_power_uw(struct cpumask *pd_mask, u64 power)
+{
+	return power;
+}
+#endif
 
 static u64 get_pd_power_uw(struct dtpm *dtpm)
 {
-- 
2.25.1


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

end of thread, other threads:[~2025-03-10  3:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06 19:34 [rafael-pm:bleeding-edge 103/108] drivers/powercap/dtpm_cpu.c:83:15: error: call to undeclared function 'sched_cpu_util'; ISO C99 and later do not support implicit function declarations kernel test robot
2025-03-10  2:56 ` [RFC PATCH] drivers/powercap: fix build error when CONFIG_SMP is not set Xuewen Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox