Skip to contentSkip to conversation

kni: fix build on Linux < 3.14

PATCH In review Thomas Monjalon 2 participants 4 messages Oct 26, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kni: fix build on Linux < 3.14

The atomic functions smp_load_acquire() and smp_store_release() were introduced in Linux 3.14. Older kernels miss the functions:

kni_fifo.h:19:2: error:
implicit declaration of function ‘smp_load_acquire’
kni_fifo.h:30:2: error:
implicit declaration of function ‘smp_store_release’

The fallback is to drop the atomic barrier, as it was before the commit below.

Fixes 711859cd0d07 ("kni: fix kernel FIFO synchronization")
---
 kernel/linux/kni/kni_fifo.h | 7 +++++++
 1 file changed, 7 insertions(+)
kernel/linux/kni/kni_fifo.h +7 -0
index 2cb3a4a7b..3c0be311f 100644
@@ -8,6 +8,13 @@
 
 #include <exec-env/rte_kni_common.h>
 
+#ifndef smp_load_acquire
+#define smp_load_acquire(a) (*(a))
+#endif
+#ifndef smp_store_release
+#define smp_store_release(a, b) *(a) = (b)
+#endif
+
 /**
  * Adds num elements into the fifo. Return the number actually written
  */
Signature · 1 line
2.19.0
#1 lore raw

26/10/2018 23:40, Thomas Monjalon:

kernel/linux/kni/kni_fifo.h

Quoted 20 lines

The atomic functions smp_load_acquire() and smp_store_release() were introduced in Linux 3.14. Older kernels miss the functions:

kni_fifo.h:19:2: error:
implicit declaration of function ‘smp_load_acquire’
kni_fifo.h:30:2: error:
implicit declaration of function ‘smp_store_release’

The fallback is to drop the atomic barrier, as it was before the commit below.

Fixes 711859cd0d07 ("kni: fix kernel FIFO synchronization")
---
 kernel/linux/kni/kni_fifo.h | 7 +++++++
 1 file changed, 7 insertions(+)
kernel/linux/kni/kni_fifo.h +0 -0

We could add a comment here:
/* Skip some memory barriers on Linux < 3.14 */

Quoted 6 lines
kernel/linux/kni/kni_fifo.h +6 -0
+#ifndef smp_load_acquire
+#define smp_load_acquire(a) (*(a))
+#endif
+#ifndef smp_store_release
+#define smp_store_release(a, b) *(a) = (b)
+#endif
Tested-by
#2 lore raw
Quoted 15 lines · Thomas Monjalon

26/10/2018 23:40, Thomas Monjalon:

Quoted 14 lines

The atomic functions smp_load_acquire() and smp_store_release() were introduced in Linux 3.14. Older kernels miss the functions:

kni_fifo.h:19:2: error:
implicit declaration of function ‘smp_load_acquire’
kni_fifo.h:30:2: error:
implicit declaration of function ‘smp_store_release’

The fallback is to drop the atomic barrier, as it was before the commit below.

Fixes 711859cd0d07 ("kni: fix kernel FIFO synchronization")
author Applied
#3 lore raw

27/10/2018 00:42, Ferruh Yigit:

Quoted 10 lines · Thomas Monjalon
Quoted 9 lines

26/10/2018 23:40, Thomas Monjalon:

Quoted 8 lines

The atomic functions smp_load_acquire() and smp_store_release() were introduced in Linux 3.14. Older kernels miss the functions:

kni_fifo.h:19:2: error:
implicit declaration of function ‘smp_load_acquire’
kni_fifo.h:30:2: error:
implicit declaration of function ‘smp_store_release’

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

The fallback is to drop the atomic barrier, as it was before the commit below.

Fixes 711859cd0d07 ("kni: fix kernel FIFO synchronization")

Applied