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: Wed, 10 Apr 2024 21:58:02 +0300
From: Vladimir Lypak <vladimir.lypak@...il.com>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Viresh Kumar <vireshk@...nel.org>, Nishanth Menon <nm@...com>,
	Stephen Boyd <sboyd@...nel.org>,
	Ulf Hansson <ulf.hansson@...aro.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>, linux-pm@...r.kernel.org,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Thorsten Leemhuis <regressions@...mhuis.info>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] OPP: Fix required_opp_tables for multiple genpds using
 same table

On Tue, Apr 09, 2024 at 04:02:19PM +0530, Viresh Kumar wrote:
> The required_opp_tables parsing is not perfect, as the OPP core does the
> parsing solely based on the DT node pointers.
> 
> The core sets the required_opp_tables entry to the first OPP table in
> the "opp_tables" list, that matches with the node pointer.
> 
> If the target DT OPP table is used by multiple devices and they all
> create separate instances of 'struct opp_table' from it, then it is
> possible that the required_opp_tables entry may be set to the incorrect
> sibling device.
> 
> Unfortunately, there is no clear way to initialize the right values
> during the initial parsing and we need to do this at a later point of
> time.
> 
> Cross check the OPP table again while the genpds are attached and fix
> them if required.
> 
> Also add a new API for the genpd core to fetch the device pointer for
> the genpd.
> 
> Cc: Thorsten Leemhuis <regressions@...mhuis.info>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=218682
> Reported-by: Vladimir Lypak <vladimir.lypak@...il.com>
> Co-developed-by: Vladimir Lypak <vladimir.lypak@...il.com>
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> ---
> Vladimir Lypak,
> 
> Can you please give this a try and confirm that it fixes the issue.
> 
>  drivers/opp/core.c        | 31 ++++++++++++++++++++++++++++++-
>  drivers/pmdomain/core.c   | 10 ++++++++++
>  include/linux/pm_domain.h |  6 ++++++
>  3 files changed, 46 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index e233734b7220..1f64b703b744 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -2394,7 +2394,8 @@ static void _opp_detach_genpd(struct opp_table *opp_table)
>  static int _opp_attach_genpd(struct opp_table *opp_table, struct device *dev,
>  			const char * const *names, struct device ***virt_devs)
>  {
> -	struct device *virt_dev;
> +	struct device *virt_dev, *gdev;
> +	struct opp_table *genpd_table;
>  	int index = 0, ret = -EINVAL;
>  	const char * const *name = names;
>  
> @@ -2427,6 +2428,34 @@ static int _opp_attach_genpd(struct opp_table *opp_table, struct device *dev,
>  			goto err;
>  		}
>  
> +		/*
> +		 * The required_opp_tables parsing is not perfect, as the OPP
> +		 * core does the parsing solely based on the DT node pointers.
> +		 * The core sets the required_opp_tables entry to the first OPP
> +		 * table in the "opp_tables" list, that matches with the node
> +		 * pointer.
> +		 *
> +		 * If the target DT OPP table is used by multiple devices and
> +		 * they all create separate instances of 'struct opp_table' from
> +		 * it, then it is possible that the required_opp_tables entry
> +		 * may be set to the incorrect sibling device.
> +		 *
> +		 * Cross check it again and fix if required.
> +		 */
> +		gdev = dev_to_genpd_dev(virt_dev);
> +		if (!IS_ERR(gdev))
> +			return PTR_ERR(gdev);

This condition shouldn't be inverted. It returns if gdev is valid.
With this bit corrected patch fixes the issue.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ