Skip to contentSkip to conversation

cpumask: make cpumask_next_wrap available without smp

PATCH Applied Willem de Bruijn 3 participants 4 messages Aug 12, 2018 – Aug 13, 2018

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

PATCH v2 1/1 cpumask: make cpumask_next_wrap available without smp

From: Willem de Bruijn <[email protected]>

The kbuild robot shows build failure on machines without CONFIG_SMP:

drivers/net/virtio_net.c:1916:10: error:
implicit declaration of function 'cpumask_next_wrap'

cpumask_next_wrap is exported from lib/cpumask.o, which has

    lib-$(CONFIG_SMP) += cpumask.o

same as other functions, also define it as static inline in the NR_CPUS==1 branch in include/linux/cpumask.h.

If wrap is true and next == start, return nr_cpumask_bits, or 1. Else wrap across the range of valid cpus, here [0].

Fixes 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")
---
 include/linux/cpumask.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/linux/cpumask.h +7 -0
index 57f20a0a77949..147bdec42215d 100644
@@ -159,6 +159,13 @@ static inline unsigned int cpumask_next_and(int n,
 	return n+1;
 }
 
+static inline unsigned int cpumask_next_wrap(int n, const struct cpumask *mask,
+					     int start, bool wrap)
+{
+	/* cpu0 unless stop condition, wrap and at cpu0, then nr_cpumask_bits */
+	return (wrap && n == 0);
+}
+
 /* cpu must be a valid cpu, ie 0, so there's no other choice. */
 static inline unsigned int cpumask_any_but(const struct cpumask *mask,
 					   unsigned int cpu)
Signature · 1 line
2.18.0.597.ga71716f1ad-goog
maintainer Applied
#1 lore raw

From: Willem de Bruijn <[email protected]>
Date: Sun, 12 Aug 2018 09:14:03 -0400

Quoted 11 lines

From: Willem de Bruijn <[email protected]>

The kbuild robot shows build failure on machines without CONFIG_SMP:

drivers/net/virtio_net.c:1916:10: error:
implicit declaration of function 'cpumask_next_wrap'

cpumask_next_wrap is exported from lib/cpumask.o, which has

    lib-$(CONFIG_SMP) += cpumask.o
Quoted 8 lines

same as other functions, also define it as static inline in the NR_CPUS==1 branch in include/linux/cpumask.h.

If wrap is true and next == start, return nr_cpumask_bits, or 1. Else wrap across the range of valid cpus, here [0].

Fixes 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")

Applied, thanks Willem.

Tested-by on v2 1/1
#2 lore raw
In reply to Willem de Bruijn
Quoted 3 lines · Willem de Bruijn

From: Willem de Bruijn <[email protected]>

The kbuild robot shows build failure on machines without CONFIG_SMP:

If this was reported by kbuild robot, then could you credit him with Reported-by?

Quoted 11 lines

drivers/net/virtio_net.c:1916:10: error:
implicit declaration of function 'cpumask_next_wrap'

cpumask_next_wrap is exported from lib/cpumask.o, which has

    lib-$(CONFIG_SMP) += cpumask.o

same as other functions, also define it as static inline in the NR_CPUS==1 branch in include/linux/cpumask.h.

Quoted 9 lines

If wrap is true and next == start, return nr_cpumask_bits, or 1. Else wrap across the range of valid cpus, here [0].

Fixes 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")
---
 include/linux/cpumask.h | 7 +++++++
 1 file changed, 7 insertions(+)

This fixes second build break of virtio driver in recent few days... I wonder what happened with build-testing of own commits... or at least reading kbuild robot mails.

Best regards,
Krzysztof

#3 lore raw
Quoted 8 lines · Krzysztof Kozlowski
Quoted 3 lines · Willem de Bruijn

From: Willem de Bruijn <[email protected]>

The kbuild robot shows build failure on machines without CONFIG_SMP:

If this was reported by kbuild robot, then could you credit him with Reported-by?

You're right. I forgot, sorry. Will do in the future.

Quoted 14 lines
Quoted 14 lines

drivers/net/virtio_net.c:1916:10: error:
implicit declaration of function 'cpumask_next_wrap'

cpumask_next_wrap is exported from lib/cpumask.o, which has

    lib-$(CONFIG_SMP) += cpumask.o

same as other functions, also define it as static inline in the NR_CPUS==1 branch in include/linux/cpumask.h.

If wrap is true and next == start, return nr_cpumask_bits, or 1. Else wrap across the range of valid cpus, here [0].

Quoted 8 lines
Quoted 6 lines
Fixes 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")
---
 include/linux/cpumask.h | 7 +++++++
 1 file changed, 7 insertions(+)

Thanks for testing,

Willem