Skip to contentSkip to conversation

linux-next: build failure after merge of the bitmap tree

PATCH Stephen Rothwell 4 participants 8 messages Feb 18, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the bitmap tree, today's linux-next build (arm64 defconfig) failed like this:

arch/arm64/kernel/topology.c: In function 'arch_freq_get_on_cpu':
arch/arm64/kernel/topology.c:270:43: error: too many arguments to function 'cpumask_next_wrap'
270 | ref_cpu = cpumask_next_wrap(ref_cpu, policy->cpus,

      |                                           ^~~~~~~~~~~~~~~~~
In file included from arch/arm64/include/asm/cpufeature.h:27,
                 from arch/arm64/include/asm/ptrace.h:11,
                 from arch/arm64/include/asm/irqflags.h:9,
                 from include/linux/irqflags.h:18,
                 from include/linux/spinlock.h:59,
                 from include/linux/mmzone.h:8,
                 from include/linux/gfp.h:7,
                 from include/linux/slab.h:16,
                 from include/linux/resource_ext.h:11,
                 from include/linux/acpi.h:13,
                 from arch/arm64/kernel/topology.c:14:
include/linux/cpumask.h:317:14: note: declared here
  317 | unsigned int cpumask_next_wrap(int n, const struct cpumask *src)
      |              ^~~~~~~~~~~~~~~~~

Caused by commits

46ac1bec179d ("cpumask: deprecate cpumask_next_wrap()") 43f7f920e14e ("cpumask: re-introduce cpumask_next{,_and}_wrap()") 65b98ea8b278 ("cpumask: drop cpumask_next_wrap_old()")

interacting with commit

dd871ac1237f ("arm64: Provide an AMU-based version of arch_freq_get_on_cpu")

from the arm64 tree.

I have applied the following patch for today (which may not be correct).

From: Stephen Rothwell <[email protected]>
Date: Tue, 18 Feb 2025 15:44:06 +1100
Subject: [PATCH] fixup for "cpumask: drop cpumask_next_wrap_old()"

interacting with commit

dd871ac1237f ("arm64: Provide an AMU-based version of arch_freq_get_on_cpu")

from the arm64 tree.

---
 arch/arm64/kernel/topology.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm64/kernel/topology.c +1 -3
index 6f0cab8e746b..70db234c41a2 100644
@@ -231,7 +231,6 @@ void arch_cpu_idle_enter(void)
 int arch_freq_get_on_cpu(int cpu)
 {
 	struct amu_cntr_sample *amu_sample;
-	unsigned int start_cpu = cpu;
 	unsigned long last_update;
 	unsigned int freq = 0;
 	u64 scale;
@@ -267,8 +266,7 @@ int arch_freq_get_on_cpu(int cpu)
 
 
 			do {
-				ref_cpu = cpumask_next_wrap(ref_cpu, policy->cpus,
-							    start_cpu, false);
+				ref_cpu = cpumask_next_wrap(ref_cpu, policy->cpus);
 
 			} while (ref_cpu < nr_cpu_ids && idle_cpu(ref_cpu));
 
Signature · 5 lines
2.45.2

-- 
Cheers,
Stephen Rothwell
#1 lore raw

Hi,

Quoted 30 lines · Stephen Rothwell

Hi all,

After merging the bitmap tree, today's linux-next build (arm64 defconfig) failed like this:

arch/arm64/kernel/topology.c: In function 'arch_freq_get_on_cpu':
arch/arm64/kernel/topology.c:270:43: error: too many arguments to function 'cpumask_next_wrap'
270 | ref_cpu = cpumask_next_wrap(ref_cpu, policy->cpus,

      |                                           ^~~~~~~~~~~~~~~~~
In file included from arch/arm64/include/asm/cpufeature.h:27,
                 from arch/arm64/include/asm/ptrace.h:11,
                 from arch/arm64/include/asm/irqflags.h:9,
                 from include/linux/irqflags.h:18,
                 from include/linux/spinlock.h:59,
                 from include/linux/mmzone.h:8,
                 from include/linux/gfp.h:7,
                 from include/linux/slab.h:16,
                 from include/linux/resource_ext.h:11,
                 from include/linux/acpi.h:13,
                 from arch/arm64/kernel/topology.c:14:
include/linux/cpumask.h:317:14: note: declared here
  317 | unsigned int cpumask_next_wrap(int n, const struct cpumask *src)
      |              ^~~~~~~~~~~~~~~~~

Caused by commits

46ac1bec179d ("cpumask: deprecate cpumask_next_wrap()") 43f7f920e14e ("cpumask: re-introduce cpumask_next{,_and}_wrap()") 65b98ea8b278 ("cpumask: drop cpumask_next_wrap_old()")

Quoted 7 lines

interacting with commit

dd871ac1237f ("arm64: Provide an AMU-based version of arch_freq_get_on_cpu")

from the arm64 tree.

I have applied the following patch for today (which may not be correct).

Thank you for that.

I'm currently testing a proper fix for that one.
Should I just send it over as a diff to apply or rather a proper 'fixes' patch?

---
BR
Beata

Quoted 44 lines

From: Stephen Rothwell <[email protected]>
Date: Tue, 18 Feb 2025 15:44:06 +1100
Subject: [PATCH] fixup for "cpumask: drop cpumask_next_wrap_old()"

interacting with commit

dd871ac1237f ("arm64: Provide an AMU-based version of arch_freq_get_on_cpu")

from the arm64 tree.

---
 arch/arm64/kernel/topology.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm64/kernel/topology.c +1 -3
index 6f0cab8e746b..70db234c41a2 100644
@@ -231,7 +231,6 @@ void arch_cpu_idle_enter(void)
 int arch_freq_get_on_cpu(int cpu)
 {
 	struct amu_cntr_sample *amu_sample;
-	unsigned int start_cpu = cpu;
 	unsigned long last_update;
 	unsigned int freq = 0;
 	u64 scale;
@@ -267,8 +266,7 @@ int arch_freq_get_on_cpu(int cpu)
 
 
 			do {
-				ref_cpu = cpumask_next_wrap(ref_cpu, policy->cpus,
-							    start_cpu, false);
+				ref_cpu = cpumask_next_wrap(ref_cpu, policy->cpus);
 
 			} while (ref_cpu < nr_cpu_ids && idle_cpu(ref_cpu));
 
Signature · 5 lines
2.45.2

-- 
Cheers,
Stephen Rothwell
#2 lore raw

Hi Beata,

Quoted 3 lines · On Tue, 18 Feb 2025 11:35:02 +0100 Beata Michalska <[email protected]>…

I'm currently testing a proper fix for that one.
Should I just send it over as a diff to apply or rather a proper 'fixes' patch?

Maybe a proper 'fixes' patch, please, if easy - otherwise a diff is fine.

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#3 lore raw

Hi Stephen,

Quoted 6 lines · Stephen Rothwell
Quoted 2 lines · On Tue, 18 Feb 2025 11:35:02 +0100 Beata Michalska <[email protected]>…

I'm currently testing a proper fix for that one.
Should I just send it over as a diff to apply or rather a proper 'fixes' patch?

Maybe a proper 'fixes' patch, please, if easy - otherwise a diff is fine.

I just talked to Beata off-list. I think she'll try to use the current for_each_cpu_wrap() API and avoid conflicts with the cpumask_next_wrap() API change.

If that doesn't work, you either carry a patch in -next until both branches end up upstream or I merge a stable bitmap branch from Yury with a fix on top.

Thanks.

Signature · 1 line
Catalin
#4 lore raw
Quoted 7 lines · Catalin Marinas

Hi Stephen,

Quoted 4 lines · Stephen Rothwell
Quoted 2 lines · On Tue, 18 Feb 2025 11:35:02 +0100 Beata Michalska <[email protected]>…

I'm currently testing a proper fix for that one.
Should I just send it over as a diff to apply or rather a proper 'fixes' patch?

Quoted 6 lines
Quoted 2 lines

Maybe a proper 'fixes' patch, please, if easy - otherwise a diff is fine.

I just talked to Beata off-list. I think she'll try to use the current for_each_cpu_wrap() API and avoid conflicts with the cpumask_next_wrap() API change.

Hi,

Yes, for_each() loops are always preferable over opencoded iterating. Please feel free to CC me in case I can help.

Thanks,
Yury

maintainer
#5 lore raw
Quoted 11 lines · Yury Norov
Quoted 10 lines · Catalin Marinas

Hi Stephen,

Quoted 6 lines · Stephen Rothwell
Quoted 2 lines · On Tue, 18 Feb 2025 11:35:02 +0100 Beata Michalska <[email protected]>…

I'm currently testing a proper fix for that one.
Should I just send it over as a diff to apply or rather a proper 'fixes' patch?

Maybe a proper 'fixes' patch, please, if easy - otherwise a diff is fine.

Quoted 8 lines
Quoted 3 lines

I just talked to Beata off-list. I think she'll try to use the current for_each_cpu_wrap() API and avoid conflicts with the cpumask_next_wrap() API change.

Hi,

Yes, for_each() loops are always preferable over opencoded iterating. Please feel free to CC me in case I can help.

Beata is going to post the official fix but in the meantime, to avoid breaking next, I'll add my temporary fix:

--------8<--------------------------------
From 1b12139107798128c183838c5f4a3f7ffcea1e44 Mon Sep 17 00:00:00 2001
From: Catalin Marinas <[email protected]>
Date: Tue, 18 Feb 2025 18:20:46 +0000
Subject: [PATCH] arm64: Do not use the deprecated cpumask_next_wrap() in
arch_freq_get_on_cpu()

cpumask_next_wrap() will soon disappear in its current form. Use for_each_cpu_wrap() instead.

Fixes 16d1e27475f6 ("arm64: Provide an AMU-based version of arch_freq_get_on_cpu")
---
 arch/arm64/kernel/topology.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
arch/arm64/kernel/topology.c +5 -6
index a09b0551ec59..1544d3648554 100644
@@ -254,7 +254,7 @@ int arch_freq_get_on_cpu(int cpu)
 		if (!housekeeping_cpu(cpu, HK_TYPE_TICK) ||
 		    time_is_before_jiffies(last_update + msecs_to_jiffies(AMU_SAMPLE_EXP_MS))) {
 			struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
-			int ref_cpu = cpu;
+			int ref_cpu;
 
 			if (!policy)
 				return -EINVAL;
@@ -265,11 +265,10 @@ int arch_freq_get_on_cpu(int cpu)
 				return -EOPNOTSUPP;
 			}
 
-			do {
-				ref_cpu = cpumask_next_wrap(ref_cpu, policy->cpus,
-							    start_cpu, true);
-
-			} while (ref_cpu < nr_cpu_ids && idle_cpu(ref_cpu));
+			for_each_cpu_wrap(ref_cpu, policy->cpus, start_cpu) {
+				if (!idle_cpu(ref_cpu))
+					break;
+			}
 
 			cpufreq_cpu_put(policy);
 
#6 lore raw
Quoted 16 lines · Catalin Marinas
Quoted 15 lines · Yury Norov
Quoted 13 lines · Catalin Marinas

Hi Stephen,

Quoted 6 lines · Stephen Rothwell
Quoted 2 lines · On Tue, 18 Feb 2025 11:35:02 +0100 Beata Michalska <[email protected]>…

I'm currently testing a proper fix for that one.
Should I just send it over as a diff to apply or rather a proper 'fixes' patch?

Maybe a proper 'fixes' patch, please, if easy - otherwise a diff is fine.

I just talked to Beata off-list. I think she'll try to use the current for_each_cpu_wrap() API and avoid conflicts with the cpumask_next_wrap() API change.

Quoted 8 lines
Quoted 4 lines

Hi,

Yes, for_each() loops are always preferable over opencoded iterating. Please feel free to CC me in case I can help.

Beata is going to post the official fix but in the meantime, to avoid breaking next, I'll add my temporary fix:

Just posted the fix [1].
Thank you all.

---
[1] https://lore.kernel.org/linux-next/[email protected]/T/#u

---
BR
Beata

Quoted 46 lines

--------8<--------------------------------
From 1b12139107798128c183838c5f4a3f7ffcea1e44 Mon Sep 17 00:00:00 2001
From: Catalin Marinas <[email protected]>
Date: Tue, 18 Feb 2025 18:20:46 +0000
Subject: [PATCH] arm64: Do not use the deprecated cpumask_next_wrap() in
arch_freq_get_on_cpu()

cpumask_next_wrap() will soon disappear in its current form. Use for_each_cpu_wrap() instead.

Fixes 16d1e27475f6 ("arm64: Provide an AMU-based version of arch_freq_get_on_cpu")
---
 arch/arm64/kernel/topology.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
arch/arm64/kernel/topology.c +5 -6
index a09b0551ec59..1544d3648554 100644
@@ -254,7 +254,7 @@ int arch_freq_get_on_cpu(int cpu)
 		if (!housekeeping_cpu(cpu, HK_TYPE_TICK) ||
 		    time_is_before_jiffies(last_update + msecs_to_jiffies(AMU_SAMPLE_EXP_MS))) {
 			struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
-			int ref_cpu = cpu;
+			int ref_cpu;
 
 			if (!policy)
 				return -EINVAL;
@@ -265,11 +265,10 @@ int arch_freq_get_on_cpu(int cpu)
 				return -EOPNOTSUPP;
 			}
 
-			do {
-				ref_cpu = cpumask_next_wrap(ref_cpu, policy->cpus,
-							    start_cpu, true);
-
-			} while (ref_cpu < nr_cpu_ids && idle_cpu(ref_cpu));
+			for_each_cpu_wrap(ref_cpu, policy->cpus, start_cpu) {
+				if (!idle_cpu(ref_cpu))
+					break;
+			}
 
 			cpufreq_cpu_put(policy);
 
maintainer
#7 lore raw
Quoted 22 lines · Beata Michalska
Quoted 21 lines · Catalin Marinas
Quoted 19 lines · Yury Norov
Quoted 7 lines · Catalin Marinas

Hi Stephen,

Quoted 4 lines · Stephen Rothwell
Quoted 2 lines · On Tue, 18 Feb 2025 11:35:02 +0100 Beata Michalska <[email protected]>…

I'm currently testing a proper fix for that one.
Should I just send it over as a diff to apply or rather a proper 'fixes' patch?

Quoted 6 lines
Quoted 2 lines

Maybe a proper 'fixes' patch, please, if easy - otherwise a diff is fine.

I just talked to Beata off-list. I think she'll try to use the current for_each_cpu_wrap() API and avoid conflicts with the cpumask_next_wrap() API change.

Hi,

Yes, for_each() loops are always preferable over opencoded iterating. Please feel free to CC me in case I can help.

Quoted 8 lines
Quoted 3 lines

Beata is going to post the official fix but in the meantime, to avoid breaking next, I'll add my temporary fix:

Just posted the fix [1].
Thank you all.

---
[1] https://lore.kernel.org/linux-next/[email protected]/T/#u

Great, thanks. I'll queue it tomorrow.

Signature · 1 line
Catalin