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]
Date:   Tue, 12 Feb 2019 10:43:13 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Viresh Kumar <viresh.kumar@...aro.org>
Cc:     Rafael Wysocki <rjw@...ysocki.net>,
        Linux PM <linux-pm@...r.kernel.org>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Sudeep Holla <sudeep.holla@....com>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V2 2/2] cpufreq: dt: Implement online/offline() callbacks

On Tue, Feb 12, 2019 at 8:07 AM Viresh Kumar <viresh.kumar@...aro.org> wrote:
>
> Implement the light-weight tear down and bring up helpers to reduce the
> amount of work to do on CPU offline/online operation.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> ---
>  drivers/cpufreq/cpufreq-dt.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
> index 7ba392911cd0..1aefaa1b0ca2 100644
> --- a/drivers/cpufreq/cpufreq-dt.c
> +++ b/drivers/cpufreq/cpufreq-dt.c
> @@ -295,6 +295,21 @@ static int cpufreq_init(struct cpufreq_policy *policy)
>         return ret;
>  }
>
> +static int cpufreq_online(struct cpufreq_policy *policy)
> +{
> +       /* We did light-weight tear down earlier, nothing to do here */
> +       return 0;
> +}

I think you could avoid having to add this empty stub if the core
checked for both online and offline, that is

if (driver->offline || driver->online) {
    ret = driver->online ? driver->online(policy) : 0;
} else {
    ret = driver->init(policy);
}

or similar.

> +
> +static int cpufreq_offline(struct cpufreq_policy *policy)
> +{
> +       /*
> +        * Preserve policy->driver_data and don't free resources on light-weight
> +        * tear down.
> +        */
> +       return 0;
> +}
> +
>  static int cpufreq_exit(struct cpufreq_policy *policy)
>  {
>         struct private_data *priv = policy->driver_data;
> @@ -319,6 +334,8 @@ static struct cpufreq_driver dt_cpufreq_driver = {
>         .get = cpufreq_generic_get,
>         .init = cpufreq_init,
>         .exit = cpufreq_exit,
> +       .online = cpufreq_online,
> +       .offline = cpufreq_offline,
>         .name = "cpufreq-dt",
>         .attr = cpufreq_dt_attr,
>         .suspend = cpufreq_generic_suspend,
> --
> 2.20.1.321.g9e740568ce00
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ