Skip to contentSkip to conversation

cpumask: provide a dummy cpumask_next_wrap

PATCH In review Arnd Bergmann 3 participants 4 messages Aug 13, 2018 Bitmap API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpumask: provide a dummy cpumask_next_wrap

The virtio_net driver has become the first one to call cpumask_next_wrap() even if CONFIG_SMP is disabled, leading to a build error:

drivers/net/virtio_net.c: In function 'virtnet_set_affinity':
drivers/net/virtio_net.c:1916:10: error: implicit declaration of function 'cpumask_next_wrap'; did you mean 'cpumask_next_and'? [-Werror=implicit-function-declaration]
cpu = cpumask_next_wrap(cpu, cpu_online_mask,

Add a stub function along the lines of cpumask_first(), cpumask_next() etc. I'm not entirely sure what should be returned in this case, but at least for virtio_net, anything should work.

Fixes 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")
Cc Peter Zijlstra <[email protected]>
Cc Caleb Raitto <[email protected]>
Cc Willem de Bruijn <[email protected]>
Cc David S. Miller <[email protected]>
---
 include/linux/cpumask.h | 5 +++++
 1 file changed, 5 insertions(+)
include/linux/cpumask.h +5 -0
index 57f20a0a7794..079ba06309bd 100644
@@ -159,6 +159,11 @@ static inline unsigned int cpumask_next_and(int n,
 	return n+1;
 }
 
+static inline int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap)
+{
+	return n;
+}
+
 /* 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
#1 lore raw
Quoted 11 lines · Arnd Bergmann

The virtio_net driver has become the first one to call cpumask_next_wrap() even if CONFIG_SMP is disabled, leading to a build error:

drivers/net/virtio_net.c: In function 'virtnet_set_affinity':
drivers/net/virtio_net.c:1916:10: error: implicit declaration of function 'cpumask_next_wrap'; did you mean 'cpumask_next_and'? [-Werror=implicit-function-declaration]
cpu = cpumask_next_wrap(cpu, cpu_online_mask,

Add a stub function along the lines of cpumask_first(), cpumask_next() etc. I'm not entirely sure what should be returned in this case, but at least for virtio_net, anything should work.

Sorry about the build break, I think this patch with a fix was already merged:

cpumask: make cpumask_next_wrap available without smp
https://patchwork.ozlabs.org/patch/956670/

Thanks,
-Caleb

#2 lore raw
Quoted 10 lines · Caleb Raitto
Quoted 8 lines · Arnd Bergmann

The virtio_net driver has become the first one to call cpumask_next_wrap() even if CONFIG_SMP is disabled, leading to a build error:

drivers/net/virtio_net.c: In function 'virtnet_set_affinity':
drivers/net/virtio_net.c:1916:10: error: implicit declaration of function 'cpumask_next_wrap'; did you mean 'cpumask_next_and'? [-Werror=implicit-function-declaration]
cpu = cpumask_next_wrap(cpu, cpu_online_mask,

Quoted 8 lines
Quoted 3 lines

Add a stub function along the lines of cpumask_first(), cpumask_next() etc. I'm not entirely sure what should be returned in this case, but at least for virtio_net, anything should work.

Sorry about the build break, I think this patch with a fix was already merged:

cpumask: make cpumask_next_wrap available without smp
https://patchwork.ozlabs.org/patch/956670/

Ok, that's also a better fix than mine I think.

Thanks,

Arnd

#3 lore raw
In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>
Date: Mon, 13 Aug 2018 23:55:16 +0200

Quoted 7 lines

The virtio_net driver has become the first one to call cpumask_next_wrap() even if CONFIG_SMP is disabled, leading to a build error:

drivers/net/virtio_net.c: In function 'virtnet_set_affinity':
drivers/net/virtio_net.c:1916:10: error: implicit declaration of function 'cpumask_next_wrap'; did you mean 'cpumask_next_and'? [-Werror=implicit-function-declaration]
cpu = cpumask_next_wrap(cpu, cpu_online_mask,

Quoted 6 lines

Add a stub function along the lines of cpumask_first(), cpumask_next() etc. I'm not entirely sure what should be returned in this case, but at least for virtio_net, anything should work.

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

This should already be fixed in my tree, and:

include/linux/cpumask.h static inline unsigned int cpumask_next_and(int n, · line 165

Quoted 4 lines
include/linux/cpumask.h +4 -0
+static inline int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap)
+{
+	return n;
+}

this doesn't handle the "n==0 && wrap" case properly, in that situation you should return '1'.