lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFqmP3pORhufTsCg1nuqSPGz8hEQNTpZgr24fFqk13hM3w@mail.gmail.com>
Date:   Thu, 11 Apr 2019 15:22:56 +0200
From:   Ulf Hansson <ulf.hansson@...aro.org>
To:     Qian Cai <cai@....pw>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Kevin Hilman <khilman@...nel.org>, Pavel Machek <pavel@....cz>,
        Len Brown <len.brown@...el.com>,
        Lina Iyer <lina.iyer@...aro.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] power/domain_governor: fix a compilation error

On Thu, 11 Apr 2019 at 14:48, Qian Cai <cai@....pw> wrote:
>
> The commit 50899f7d5078 ("PM / Domains: Add genpd governor for CPUs")
> introduced a compilation error on arm64 with CONFIG_CPU_IDLE=n because
> cpuidle_devices is undefined there.
>
> drivers/base/power/domain_governor.o: In function `cpu_power_down_ok':
> drivers/base/power/domain_governor.c:263: undefined reference to
> 'cpuidle_devices' ld: drivers/base/power/domain_governor.o: relocation
> R_AARCH64_ADR_PREL_PG_HI21 against symbol 'cpuidle_devices' which may
> bind externally can not be used when making a shared object; recompile
> with -fPIC
> drivers/base/power/domain_governor.c:263:(.text+0x638): dangerous
> relocation: unsupported relocation
> drivers/base/power/domain_governor.c:263: undefined reference to
> 'cpuidle_devices'
> make: *** [Makefile:1047: vmlinux] Error 1
>
> Signed-off-by: Qian Cai <cai@....pw>

Qian, thanks for you patch!

> ---
>  drivers/base/power/domain_governor.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c
> index 39c8a699cb53..252d88fcf760 100644
> --- a/drivers/base/power/domain_governor.c
> +++ b/drivers/base/power/domain_governor.c
> @@ -270,11 +270,13 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd)
>          */
>         domain_wakeup = ktime_set(KTIME_SEC_MAX, 0);
>         for_each_cpu_and(cpu, genpd->cpus, cpu_online_mask) {
> -               dev = per_cpu(cpuidle_devices, cpu);
> -               if (dev) {
> -                       next_hrtimer = READ_ONCE(dev->next_hrtimer);
> -                       if (ktime_before(next_hrtimer, domain_wakeup))
> -                               domain_wakeup = next_hrtimer;
> +               if (IS_ENABLED(CONFIG_CPU_IDLE)) {
> +                       dev = per_cpu(cpuidle_devices, cpu);
> +                       if (dev) {
> +                               next_hrtimer = READ_ONCE(dev->next_hrtimer);
> +                               if (ktime_before(next_hrtimer, domain_wakeup))
> +                                       domain_wakeup = next_hrtimer;
> +                       }

This works as quick fix, but I think there is two possible options
that is probably better in long run.

1) Extend the cpuidle interface with a new function:

struct cpuidle_device *cpuidle_get_cpu_device(unsigned int cpu)

Then when CONFIG_CPU_IDLE is unset, we can just have a stub function
returning NULL.

2) Have the struct dev_power_governor pm_domain_cpu_gov to be defined
(and the corresponding functionality), but only when CONFIG_CPU_IDLE
is set and when CONFIG_PM_GENERIC_DOMAINS is set.

Kind regards
Uffe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ