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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 31 Dec 2021 14:46:56 +0100
From:   Ulf Hansson <ulf.hansson@...aro.org>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:     rjw@...ysocki.net, lukasz.luba@....com, robh@...nel.org,
        heiko@...ech.de, arnd@...aro.org, linux-kernel@...r.kernel.org,
        linux-pm@...r.kernel.org,
        Daniel Lezcano <daniel.lezcano@...nel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH v5 3/6] powercap/drivers/dtpm: Add CPU DT initialization support

On Sat, 18 Dec 2021 at 14:00, Daniel Lezcano <daniel.lezcano@...aro.org> wrote:
>
> Based on the previous DT changes in the core code, use the 'setup'
> callback to initialize the CPU DTPM backend.
>
> Code is reorganized to stick to the DTPM table description. No
> functional changes.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>

As I stated for patch2 an option that might be preferred, could be to
squash this one into it.

Nevertheless, feel free to add:

Reviewed-by: Ulf Hansson <ulf.hansson@...aro.org>

Kind regards
Uffe

> ---
>  drivers/powercap/dtpm_cpu.c | 37 ++++++++++++++++++++++++++++++-------
>  1 file changed, 30 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c
> index 6bffb44c75aa..ca605911523b 100644
> --- a/drivers/powercap/dtpm_cpu.c
> +++ b/drivers/powercap/dtpm_cpu.c
> @@ -21,6 +21,7 @@
>  #include <linux/cpuhotplug.h>
>  #include <linux/dtpm.h>
>  #include <linux/energy_model.h>
> +#include <linux/of.h>
>  #include <linux/pm_qos.h>
>  #include <linux/slab.h>
>  #include <linux/units.h>
> @@ -176,6 +177,17 @@ static int cpuhp_dtpm_cpu_offline(unsigned int cpu)
>  }
>
>  static int cpuhp_dtpm_cpu_online(unsigned int cpu)
> +{
> +       struct dtpm_cpu *dtpm_cpu;
> +
> +       dtpm_cpu = per_cpu(dtpm_per_cpu, cpu);
> +       if (dtpm_cpu)
> +               return dtpm_update_power(&dtpm_cpu->dtpm);
> +
> +       return 0;
> +}
> +
> +static int __dtpm_cpu_setup(int cpu, struct dtpm *parent)
>  {
>         struct dtpm_cpu *dtpm_cpu;
>         struct cpufreq_policy *policy;
> @@ -183,6 +195,10 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu)
>         char name[CPUFREQ_NAME_LEN];
>         int ret = -ENOMEM;
>
> +       dtpm_cpu = per_cpu(dtpm_per_cpu, cpu);
> +       if (dtpm_cpu)
> +               return 0;
> +
>         policy = cpufreq_cpu_get(cpu);
>         if (!policy)
>                 return 0;
> @@ -191,10 +207,6 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu)
>         if (!pd)
>                 return -EINVAL;
>
> -       dtpm_cpu = per_cpu(dtpm_per_cpu, cpu);
> -       if (dtpm_cpu)
> -               return dtpm_update_power(&dtpm_cpu->dtpm);
> -
>         dtpm_cpu = kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL);
>         if (!dtpm_cpu)
>                 return -ENOMEM;
> @@ -207,7 +219,7 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu)
>
>         snprintf(name, sizeof(name), "cpu%d-cpufreq", dtpm_cpu->cpu);
>
> -       ret = dtpm_register(name, &dtpm_cpu->dtpm, NULL);
> +       ret = dtpm_register(name, &dtpm_cpu->dtpm, parent);
>         if (ret)
>                 goto out_kfree_dtpm_cpu;
>
> @@ -231,7 +243,18 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu)
>         return ret;
>  }
>
> -static int __init dtpm_cpu_init(void)
> +static int dtpm_cpu_setup(struct dtpm *dtpm, struct device_node *np)
> +{
> +       int cpu;
> +
> +       cpu = of_cpu_node_to_id(np);
> +       if (cpu < 0)
> +               return 0;
> +
> +       return __dtpm_cpu_setup(cpu, dtpm);
> +}
> +
> +static int dtpm_cpu_init(void)
>  {
>         int ret;
>
> @@ -269,4 +292,4 @@ static int __init dtpm_cpu_init(void)
>         return 0;
>  }
>
> -DTPM_DECLARE(dtpm_cpu, dtpm_cpu_init, NULL);
> +DTPM_DECLARE(dtpm_cpu, dtpm_cpu_init, dtpm_cpu_setup);
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ