linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: dt: always allocate zeroed cpumask
       [not found] <CGME20240314125628eucas1p161af377a50fd957f445397bc1404978b@eucas1p1.samsung.com>
@ 2024-03-14 12:54 ` Marek Szyprowski
  2024-03-14 17:18   ` Christoph Lameter (Ampere)
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marek Szyprowski @ 2024-03-14 12:54 UTC (permalink / raw)
  To: linux-pm, linux-kernel, linux-mm, linux-arm-kernel
  Cc: Marek Szyprowski, Rafael J. Wysocki, Viresh Kumar,
	Stephan Gerhold, Catalin Marinas, Russell King,
	Christoph Lameter, Mark Rutland, Sudeep Holla, Will Deacon,
	stable

Commit 0499a78369ad ("ARM64: Dynamically allocate cpumasks and increase
supported CPUs to 512") changed the handling of cpumasks on ARM 64bit,
what resulted in the strange issues and warnings during cpufreq-dt
initialization on some big.LITTLE platforms.

This was caused by mixing OPPs between big and LITTLE cores, because
OPP-sharing information between big and LITTLE cores is computed on
cpumask, which in turn was not zeroed on allocation. Fix this by
switching to zalloc_cpumask_var() call.

Fixes: dc279ac6e5b4 ("cpufreq: dt: Refactor initialization to handle probe deferral properly")
CC: stable@vger.kernel.org # v5.10+
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/cpufreq/cpufreq-dt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 8bd6e5e8f121..2d83bbc65dd0 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -208,7 +208,7 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu)
 	if (!priv)
 		return -ENOMEM;
 
-	if (!alloc_cpumask_var(&priv->cpus, GFP_KERNEL))
+	if (!zalloc_cpumask_var(&priv->cpus, GFP_KERNEL))
 		return -ENOMEM;
 
 	cpumask_set_cpu(cpu, priv->cpus);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cpufreq: dt: always allocate zeroed cpumask
  2024-03-14 12:54 ` [PATCH] cpufreq: dt: always allocate zeroed cpumask Marek Szyprowski
@ 2024-03-14 17:18   ` Christoph Lameter (Ampere)
  2024-03-15  5:27   ` Dhruva Gole
  2024-03-15  5:50   ` Viresh Kumar
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Lameter (Ampere) @ 2024-03-14 17:18 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-pm, linux-kernel, linux-mm, linux-arm-kernel,
	Rafael J. Wysocki, Viresh Kumar, Stephan Gerhold,
	Catalin Marinas, Russell King, Mark Rutland, Sudeep Holla,
	Will Deacon, stable

On Thu, 14 Mar 2024, Marek Szyprowski wrote:

> -	if (!alloc_cpumask_var(&priv->cpus, GFP_KERNEL))
> +	if (!zalloc_cpumask_var(&priv->cpus, GFP_KERNEL))
> 		return -ENOMEM;

Reviewed-by: Christoph Lameter (Ampere) <cl@linux.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cpufreq: dt: always allocate zeroed cpumask
  2024-03-14 12:54 ` [PATCH] cpufreq: dt: always allocate zeroed cpumask Marek Szyprowski
  2024-03-14 17:18   ` Christoph Lameter (Ampere)
@ 2024-03-15  5:27   ` Dhruva Gole
  2024-03-15  5:50   ` Viresh Kumar
  2 siblings, 0 replies; 4+ messages in thread
From: Dhruva Gole @ 2024-03-15  5:27 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-pm, linux-kernel, linux-mm, linux-arm-kernel,
	Rafael J. Wysocki, Viresh Kumar, Stephan Gerhold,
	Catalin Marinas, Russell King, Christoph Lameter, Mark Rutland,
	Sudeep Holla, Will Deacon, stable

On Mar 14, 2024 at 13:54:57 +0100, Marek Szyprowski wrote:
> Commit 0499a78369ad ("ARM64: Dynamically allocate cpumasks and increase
> supported CPUs to 512") changed the handling of cpumasks on ARM 64bit,
> what resulted in the strange issues and warnings during cpufreq-dt
> initialization on some big.LITTLE platforms.
> 
> This was caused by mixing OPPs between big and LITTLE cores, because
> OPP-sharing information between big and LITTLE cores is computed on
> cpumask, which in turn was not zeroed on allocation. Fix this by
> switching to zalloc_cpumask_var() call.
> 
> Fixes: dc279ac6e5b4 ("cpufreq: dt: Refactor initialization to handle probe deferral properly")
> CC: stable@vger.kernel.org # v5.10+
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/cpufreq/cpufreq-dt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
> index 8bd6e5e8f121..2d83bbc65dd0 100644
> --- a/drivers/cpufreq/cpufreq-dt.c
> +++ b/drivers/cpufreq/cpufreq-dt.c
> @@ -208,7 +208,7 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu)
>  	if (!priv)
>  		return -ENOMEM;
>  
> -	if (!alloc_cpumask_var(&priv->cpus, GFP_KERNEL))
> +	if (!zalloc_cpumask_var(&priv->cpus, GFP_KERNEL))
>  		return -ENOMEM;

Good catch!

Reviewed-by: Dhruva Gole <d-gole@ti.com>


-- 
Best regards,
Dhruva

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cpufreq: dt: always allocate zeroed cpumask
  2024-03-14 12:54 ` [PATCH] cpufreq: dt: always allocate zeroed cpumask Marek Szyprowski
  2024-03-14 17:18   ` Christoph Lameter (Ampere)
  2024-03-15  5:27   ` Dhruva Gole
@ 2024-03-15  5:50   ` Viresh Kumar
  2 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2024-03-15  5:50 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-pm, linux-kernel, linux-mm, linux-arm-kernel,
	Rafael J. Wysocki, Stephan Gerhold, Catalin Marinas,
	Russell King, Christoph Lameter, Mark Rutland, Sudeep Holla,
	Will Deacon, stable

On 14-03-24, 13:54, Marek Szyprowski wrote:
> Commit 0499a78369ad ("ARM64: Dynamically allocate cpumasks and increase
> supported CPUs to 512") changed the handling of cpumasks on ARM 64bit,
> what resulted in the strange issues and warnings during cpufreq-dt
> initialization on some big.LITTLE platforms.
> 
> This was caused by mixing OPPs between big and LITTLE cores, because
> OPP-sharing information between big and LITTLE cores is computed on
> cpumask, which in turn was not zeroed on allocation. Fix this by
> switching to zalloc_cpumask_var() call.
> 
> Fixes: dc279ac6e5b4 ("cpufreq: dt: Refactor initialization to handle probe deferral properly")
> CC: stable@vger.kernel.org # v5.10+
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/cpufreq/cpufreq-dt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
> index 8bd6e5e8f121..2d83bbc65dd0 100644
> --- a/drivers/cpufreq/cpufreq-dt.c
> +++ b/drivers/cpufreq/cpufreq-dt.c
> @@ -208,7 +208,7 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu)
>  	if (!priv)
>  		return -ENOMEM;
>  
> -	if (!alloc_cpumask_var(&priv->cpus, GFP_KERNEL))
> +	if (!zalloc_cpumask_var(&priv->cpus, GFP_KERNEL))
>  		return -ENOMEM;
>  
>  	cpumask_set_cpu(cpu, priv->cpus);

Applied. Thanks.

-- 
viresh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-15  5:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20240314125628eucas1p161af377a50fd957f445397bc1404978b@eucas1p1.samsung.com>
2024-03-14 12:54 ` [PATCH] cpufreq: dt: always allocate zeroed cpumask Marek Szyprowski
2024-03-14 17:18   ` Christoph Lameter (Ampere)
2024-03-15  5:27   ` Dhruva Gole
2024-03-15  5:50   ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).