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: <4e36e732-6ca3-1d00-e6dd-38bb8877577b@gmail.com>
Date:   Fri, 3 Sep 2021 09:00:56 +0300
From:   Dmitry Osipenko <digetx@...il.com>
To:     Ulf Hansson <ulf.hansson@...aro.org>,
        "Rafael J . Wysocki" <rjw@...ysocki.net>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        linux-pm@...r.kernel.org
Cc:     Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Thierry Reding <thierry.reding@...il.com>,
        Rajendra Nayak <rnayak@...eaurora.org>,
        Stephan Gerhold <stephan@...hold.net>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] PM: domains: Add a ->dev_get_performance_state()
 callback to genpd

02.09.2021 13:16, Ulf Hansson пишет:
> Hardware may be preprogrammed to a specific performance state, which may
> not be zero initially during boot. This may lead to that genpd's current
> performance state becomes inconsistent with the state of the hardware. To
> deal with this, the driver for a device that is being attached to its
> genpd, need to request an initial performance state vote, which is
> typically done by calling some of the OPP APIs while probing.
> 
> In some cases this would lead to boilerplate code in the drivers. Let's
> make it possible to avoid this, by adding a new optional callback to genpd
> and invoke it per device during the attach process. In this way, the genpd
> provider driver can inform genpd about the initial performance state that
> is needed for the device.
> 
> Signed-off-by: Ulf Hansson <ulf.hansson@...aro.org>
> ---
>  drivers/base/power/domain.c | 8 +++++---
>  include/linux/pm_domain.h   | 2 ++
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 800adf831cae..1a6f3538af8d 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2640,13 +2640,15 @@ static void genpd_dev_pm_sync(struct device *dev)
>  	genpd_queue_power_off_work(pd);
>  }
>  
> -static int genpd_get_default_performance_state(struct device *dev,
> +static int genpd_get_default_performance_state(struct generic_pm_domain *genpd,
> +					       struct device *dev,
>  					       unsigned int index)
>  {
>  	int pstate = of_get_required_opp_performance_state(dev->of_node, index);
>  
>  	if (pstate == -ENODEV || pstate == -EOPNOTSUPP)
> -		return 0;
> +		pstate = genpd->dev_get_performance_state ?
> +			 genpd->dev_get_performance_state(genpd, dev) : 0;
>  
>  	return pstate;
>  }
> @@ -2701,7 +2703,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,
>  	}
>  
>  	/* Set the default performance state */
> -	pstate = genpd_get_default_performance_state(dev, index);
> +	pstate = genpd_get_default_performance_state(pd, dev, index);

If base device is suspended, then its performance state is zero.

When device will be rpm-resumed, then its performance should be set to
the default state.

You're setting performance state of the wrong device, it should be the
base device and not the virtual domain device.

These all is handled properly by my patch [1]. Hence it's complicated
for the reason.

[1]
https://patchwork.ozlabs.org/project/linux-tegra/patch/20210831135450.26070-5-digetx@gmail.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ