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:   Wed, 15 Jul 2020 17:35:16 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Chen Yu <yu.c.chen@...el.com>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <len.brown@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Michal Miroslaw <mirq-linux@...e.qmqm.pl>,
        Zhang Rui <rui.zhang@...el.com>,
        Linux PM <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2][RESEND v3] PM-runtime: Move all runtime usage related
 function to runtime.c

On Wed, Jul 15, 2020 at 8:26 AM Chen Yu <yu.c.chen@...el.com> wrote:
>
> In order to track all the runtime usage count change, move the code
> related to runtime usage count change from pm_runtime.h to runtime.c,
> so that in runtime.c we can leverage trace event to do the tracking.
> Meanwhile export pm_runtime_get_noresume() and pm_runtime_put_noidle()
> so the module can use them.
>
> No functional changes intended.
>
> Signed-off-by: Chen Yu <yu.c.chen@...el.com>
> ---
>  drivers/base/power/runtime.c | 12 ++++++++++++
>  include/linux/pm_runtime.h   | 12 ++----------
>  2 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
> index 9f62790f644c..85a248e196ca 100644
> --- a/drivers/base/power/runtime.c
> +++ b/drivers/base/power/runtime.c
> @@ -1738,6 +1738,18 @@ void pm_runtime_drop_link(struct device *dev)
>         spin_unlock_irq(&dev->power.lock);
>  }
>
> +void pm_runtime_get_noresume(struct device *dev)
> +{
> +       atomic_inc(&dev->power.usage_count);
> +}
> +EXPORT_SYMBOL_GPL(pm_runtime_get_noresume);
> +
> +void pm_runtime_put_noidle(struct device *dev)
> +{
> +       atomic_add_unless(&dev->power.usage_count, -1, 0);
> +}
> +EXPORT_SYMBOL_GPL(pm_runtime_put_noidle);

I honestly don't think that this is going in the right direction.

> +
>  static bool pm_runtime_need_not_resume(struct device *dev)
>  {
>         return atomic_read(&dev->power.usage_count) <= 1 &&
> diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
> index 3dbc207bff53..26510fef2acd 100644
> --- a/include/linux/pm_runtime.h
> +++ b/include/linux/pm_runtime.h
> @@ -59,6 +59,8 @@ extern void pm_runtime_get_suppliers(struct device *dev);
>  extern void pm_runtime_put_suppliers(struct device *dev);
>  extern void pm_runtime_new_link(struct device *dev);
>  extern void pm_runtime_drop_link(struct device *dev);
> +extern void pm_runtime_get_noresume(struct device *dev);
> +extern void pm_runtime_put_noidle(struct device *dev);
>
>  static inline int pm_runtime_get_if_in_use(struct device *dev)
>  {
> @@ -70,16 +72,6 @@ static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
>         dev->power.ignore_children = enable;
>  }
>
> -static inline void pm_runtime_get_noresume(struct device *dev)
> -{
> -       atomic_inc(&dev->power.usage_count);
> -}
> -
> -static inline void pm_runtime_put_noidle(struct device *dev)
> -{
> -       atomic_add_unless(&dev->power.usage_count, -1, 0);
> -}
> -
>  static inline bool pm_runtime_suspended(struct device *dev)
>  {
>         return dev->power.runtime_status == RPM_SUSPENDED
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ