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]
Message-ID: <20221026093604.nuielehywjtxe2mn@vireshk-i7>
Date:   Wed, 26 Oct 2022 15:06:04 +0530
From:   Viresh Kumar <viresh.kumar@...aro.org>
To:     Erico Nunes <nunes.erico@...il.com>
Cc:     Qiang Yu <yuq825@...il.com>, David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>,
        dri-devel@...ts.freedesktop.org, lima@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/lima: Fix dev_pm_opp_set_config in case of missing
 regulator

On 26-10-22, 10:39, Erico Nunes wrote:
> Commit d8c32d3971e4 ("drm/lima: Migrate to dev_pm_opp_set_config()")
> introduced a regression as it may undo the clk_names setting in case
> the optional regulator is missing. This resulted in test and performance
> regressions with lima.
> 
> Restore the old behavior where clk_names is set separately so it is not
> undone in case of a missing optional regulator.
> 
> Fixes: d8c32d3971e4 ("drm/lima: Migrate to dev_pm_opp_set_config()")
> Signed-off-by: Erico Nunes <nunes.erico@...il.com>
> ---
>  drivers/gpu/drm/lima/lima_devfreq.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/lima/lima_devfreq.c b/drivers/gpu/drm/lima/lima_devfreq.c
> index 011be7ff51e1..9c8654934fea 100644
> --- a/drivers/gpu/drm/lima/lima_devfreq.c
> +++ b/drivers/gpu/drm/lima/lima_devfreq.c
> @@ -113,10 +113,12 @@ int lima_devfreq_init(struct lima_device *ldev)
>  	int ret;
>  	const char *regulator_names[] = { "mali", NULL };
>  	const char *clk_names[] = { "core", NULL };
> -	struct dev_pm_opp_config config = {
> -		.regulator_names = regulator_names,
> +	struct dev_pm_opp_config config_clk_names = {
>  		.clk_names = clk_names,
>  	};
> +	struct dev_pm_opp_config config_regulator_names = {
> +		.regulator_names = regulator_names,
> +	};
>  
>  	if (!device_property_present(dev, "operating-points-v2"))
>  		/* Optional, continue without devfreq */
> @@ -124,7 +126,15 @@ int lima_devfreq_init(struct lima_device *ldev)
>  
>  	spin_lock_init(&ldevfreq->lock);
>  
> -	ret = devm_pm_opp_set_config(dev, &config);
> +	/*
> +	 * Set clk_names separately so it is not undone in case of
> +	 * a missing optional regulator.
> +	 */
> +	ret = devm_pm_opp_set_config(dev, &config_clk_names);
> +	if (ret)
> +		return ret;
> +
> +	ret = devm_pm_opp_set_config(dev, &config_regulator_names);

You can directly call devm_pm_opp_set_clkname() and
devm_pm_opp_set_regulators(), like it was done before my patch, for
single configurations. So basically a simple revert of my commit, with
additional comments you added above.

>  	if (ret) {
>  		/* Continue if the optional regulator is missing */
>  		if (ret != -ENODEV)
> -- 
> 2.37.3

-- 
viresh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ