Re: [PATCH V4 3/3] thermal: cpufreq_cooling: Reuse sched_cpu_util() for SMP platforms

0 views
Skip to first unread message

kernel test robot

unread,
Dec 2, 2020, 1:40:05 PM12/2/20
to Viresh Kumar, kbuil...@lists.01.org, clang-bu...@googlegroups.com
Hi Viresh,

I love your patch! Yet something to improve:

[auto build test ERROR on 3650b228f83adda7e5ee532e2b90429c03f7b9ec]

url: https://github.com/0day-ci/linux/commits/Viresh-Kumar/cpufreq_cooling-Get-effective-CPU-utilization-from-scheduler/20201124-143027
base: 3650b228f83adda7e5ee532e2b90429c03f7b9ec
config: powerpc64-randconfig-r025-20201202 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 2671fccf0381769276ca8246ec0499adcb9b0355)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://github.com/0day-ci/linux/commit/17f0c7f4372070206925c3a10ec0e7a09d03615e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Viresh-Kumar/cpufreq_cooling-Get-effective-CPU-utilization-from-scheduler/20201124-143027
git checkout 17f0c7f4372070206925c3a10ec0e7a09d03615e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>

All errors (new ones prefixed by >>):

>> drivers/thermal/cpufreq_cooling.c:562:8: error: implicit declaration of function 'allocate_idle_time' [-Werror,-Wimplicit-function-declaration]
ret = allocate_idle_time(cpufreq_cdev);
^
>> drivers/thermal/cpufreq_cooling.c:624:2: error: implicit declaration of function 'free_idle_time' [-Werror,-Wimplicit-function-declaration]
free_idle_time(cpufreq_cdev);
^
drivers/thermal/cpufreq_cooling.c:717:2: error: implicit declaration of function 'free_idle_time' [-Werror,-Wimplicit-function-declaration]
free_idle_time(cpufreq_cdev);
^
3 errors generated.

vim +/allocate_idle_time +562 drivers/thermal/cpufreq_cooling.c

509
510 /**
511 * __cpufreq_cooling_register - helper function to create cpufreq cooling device
512 * @np: a valid struct device_node to the cooling device device tree node
513 * @policy: cpufreq policy
514 * Normally this should be same as cpufreq policy->related_cpus.
515 * @em: Energy Model of the cpufreq policy
516 *
517 * This interface function registers the cpufreq cooling device with the name
518 * "thermal-cpufreq-%x". This api can support multiple instances of cpufreq
519 * cooling devices. It also gives the opportunity to link the cooling device
520 * with a device tree node, in order to bind it via the thermal DT code.
521 *
522 * Return: a valid struct thermal_cooling_device pointer on success,
523 * on failure, it returns a corresponding ERR_PTR().
524 */
525 static struct thermal_cooling_device *
526 __cpufreq_cooling_register(struct device_node *np,
527 struct cpufreq_policy *policy,
528 struct em_perf_domain *em)
529 {
530 struct thermal_cooling_device *cdev;
531 struct cpufreq_cooling_device *cpufreq_cdev;
532 char dev_name[THERMAL_NAME_LENGTH];
533 unsigned int i;
534 struct device *dev;
535 int ret;
536 struct thermal_cooling_device_ops *cooling_ops;
537
538 dev = get_cpu_device(policy->cpu);
539 if (unlikely(!dev)) {
540 pr_warn("No cpu device for cpu %d\n", policy->cpu);
541 return ERR_PTR(-ENODEV);
542 }
543
544 if (IS_ERR_OR_NULL(policy)) {
545 pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy);
546 return ERR_PTR(-EINVAL);
547 }
548
549 i = cpufreq_table_count_valid_entries(policy);
550 if (!i) {
551 pr_debug("%s: CPUFreq table not found or has no valid entries\n",
552 __func__);
553 return ERR_PTR(-ENODEV);
554 }
555
556 cpufreq_cdev = kzalloc(sizeof(*cpufreq_cdev), GFP_KERNEL);
557 if (!cpufreq_cdev)
558 return ERR_PTR(-ENOMEM);
559
560 cpufreq_cdev->policy = policy;
561
> 562 ret = allocate_idle_time(cpufreq_cdev);
563 if (ret) {
564 cdev = ERR_PTR(ret);
565 goto free_cdev;
566 }
567
568 /* max_level is an index, not a counter */
569 cpufreq_cdev->max_level = i - 1;
570
571 ret = ida_simple_get(&cpufreq_ida, 0, 0, GFP_KERNEL);
572 if (ret < 0) {
573 cdev = ERR_PTR(ret);
574 goto free_idle_time;
575 }
576 cpufreq_cdev->id = ret;
577
578 snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d",
579 cpufreq_cdev->id);
580
581 cooling_ops = &cpufreq_cooling_ops;
582
583 #ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR
584 if (em_is_sane(cpufreq_cdev, em)) {
585 cpufreq_cdev->em = em;
586 cooling_ops->get_requested_power = cpufreq_get_requested_power;
587 cooling_ops->state2power = cpufreq_state2power;
588 cooling_ops->power2state = cpufreq_power2state;
589 } else
590 #endif
591 if (policy->freq_table_sorted == CPUFREQ_TABLE_UNSORTED) {
592 pr_err("%s: unsorted frequency tables are not supported\n",
593 __func__);
594 cdev = ERR_PTR(-EINVAL);
595 goto remove_ida;
596 }
597
598 ret = freq_qos_add_request(&policy->constraints,
599 &cpufreq_cdev->qos_req, FREQ_QOS_MAX,
600 get_state_freq(cpufreq_cdev, 0));
601 if (ret < 0) {
602 pr_err("%s: Failed to add freq constraint (%d)\n", __func__,
603 ret);
604 cdev = ERR_PTR(ret);
605 goto remove_ida;
606 }
607
608 cdev = thermal_of_cooling_device_register(np, dev_name, cpufreq_cdev,
609 cooling_ops);
610 if (IS_ERR(cdev))
611 goto remove_qos_req;
612
613 mutex_lock(&cooling_list_lock);
614 list_add(&cpufreq_cdev->node, &cpufreq_cdev_list);
615 mutex_unlock(&cooling_list_lock);
616
617 return cdev;
618
619 remove_qos_req:
620 freq_qos_remove_request(&cpufreq_cdev->qos_req);
621 remove_ida:
622 ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id);
623 free_idle_time:
> 624 free_idle_time(cpufreq_cdev);
625 free_cdev:
626 kfree(cpufreq_cdev);
627 return cdev;
628 }
629

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuil...@lists.01.org
.config.gz

Viresh Kumar

unread,
Dec 7, 2020, 4:44:23 AM12/7/20
to kernel test robot, kbuil...@lists.01.org, clang-bu...@googlegroups.com
I am not sure why this should happen here, I don't see any such errors
on my side. Can someone please have another look ?

--
viresh

Nick Desaulniers

unread,
Dec 7, 2020, 3:00:03 PM12/7/20
to Viresh Kumar, kernel test robot, kbuil...@lists.01.org, clang-built-linux
On Mon, Dec 7, 2020 at 1:44 AM Viresh Kumar <viresh...@linaro.org> wrote:
>
> On 03-12-20, 02:39, kernel test robot wrote:
> > Hi Viresh,
> >
> > I love your patch! Yet something to improve:
> >
> > [auto build test ERROR on 3650b228f83adda7e5ee532e2b90429c03f7b9ec]
> >
> > url: https://github.com/0day-ci/linux/commits/Viresh-Kumar/cpufreq_cooling-Get-effective-CPU-utilization-from-scheduler/20201124-143027
> > base: 3650b228f83adda7e5ee532e2b90429c03f7b9ec
> > config: powerpc64-randconfig-r025-20201202 (attached as .config)

^ Note: randconfig

> > compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 2671fccf0381769276ca8246ec0499adcb9b0355)
> > reproduce (this is a W=1 build):
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # install powerpc64 cross compiling tool for clang build
> > # apt-get install binutils-powerpc64-linux-gnu
> > # https://github.com/0day-ci/linux/commit/17f0c7f4372070206925c3a10ec0e7a09d03615e
> > git remote add linux-review https://github.com/0day-ci/linux
> > git fetch --no-tags linux-review Viresh-Kumar/cpufreq_cooling-Get-effective-CPU-utilization-from-scheduler/20201124-143027
> > git checkout 17f0c7f4372070206925c3a10ec0e7a09d03615e
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <l...@intel.com>
> >
> > All errors (new ones prefixed by >>):
> >
> > >> drivers/thermal/cpufreq_cooling.c:562:8: error: implicit declaration of function 'allocate_idle_time' [-Werror,-Wimplicit-function-declaration]
> > ret = allocate_idle_time(cpufreq_cdev);
> > ^

I can see in the top commit
(https://github.com/0day-ci/linux/commit/17f0c7f4372070206925c3a10ec0e7a09d03615e)
you've modified __cpufreq_cooling_register to now call
allocate_idle_time. -Wimplicit-function-declaration is observed when
calling a function for which there has been no previous declaration.
Let's look and see where or under what config allocate_idle_time is
declared, and how a randconfig might expose the missing declaration.
(The first thing I suspect is transitive header dependencies, where
some intermediary header changes what it includes based on
#define/CONFIGs, or calling a function before it's been declared).

It looks like allocate_idle_time is declared in the same
commit...while it's defined twice (once for CONFIG_SMP, once without),
it's not defined when CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not
enabled, which is probably what the randconfig has tickled.

> > >> drivers/thermal/cpufreq_cooling.c:624:2: error: implicit declaration of function 'free_idle_time' [-Werror,-Wimplicit-function-declaration]
> > free_idle_time(cpufreq_cdev);
> > ^
> > drivers/thermal/cpufreq_cooling.c:717:2: error: implicit declaration of function 'free_idle_time' [-Werror,-Wimplicit-function-declaration]
> > free_idle_time(cpufreq_cdev);
> > ^
> > 3 errors generated.
> >
> > vim +/allocate_idle_time +562 drivers/thermal/cpufreq_cooling.c
>
> I am not sure why this should happen here, I don't see any such errors
> on my side. Can someone please have another look ?
>
> --
> viresh
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-li...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20201207094419.lakxblzsono3nqpf%40vireshk-i7.



--
Thanks,
~Nick Desaulniers

Viresh Kumar

unread,
Dec 7, 2020, 10:34:14 PM12/7/20
to Nick Desaulniers, kernel test robot, kbuil...@lists.01.org, clang-built-linux
On 07-12-20, 11:59, Nick Desaulniers wrote:
> I can see in the top commit
> (https://github.com/0day-ci/linux/commit/17f0c7f4372070206925c3a10ec0e7a09d03615e)
> you've modified __cpufreq_cooling_register to now call
> allocate_idle_time. -Wimplicit-function-declaration is observed when
> calling a function for which there has been no previous declaration.
> Let's look and see where or under what config allocate_idle_time is
> declared, and how a randconfig might expose the missing declaration.
> (The first thing I suspect is transitive header dependencies, where
> some intermediary header changes what it includes based on
> #define/CONFIGs, or calling a function before it's been declared).
>
> It looks like allocate_idle_time is declared in the same
> commit...while it's defined twice (once for CONFIG_SMP, once without),
> it's not defined when CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not
> enabled, which is probably what the randconfig has tickled.

And I was only looking only at CONFIG_SMP to see why we couldn't find
a definition here :(

--
viresh
Reply all
Reply to author
Forward
0 new messages