[ovs-dev] [PATCH 1/2] datapath: #define local_bh_disable to preempt_disable on RT.

Jesse Gross jesse at nicira.com
Fri Oct 22 16:34:13 PDT 2010


We use local_bh_disable() to mean that we don't want to get
preempted or interrupted and normally it covers both situations.
However, on RT kernels local_bh_disable() becomes a no-op because
bottom halves aren't interrupts any more.  We still want the
behavior of disabling preemption so #define them to be the same
on these kernels.

Signed-off-by: Jesse Gross <jesse at nicira.com>
---
 datapath/linux-2.6/Modules.mk                      |    1 +
 .../compat-2.6/include/linux/bottom_half.h         |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
 create mode 100644 datapath/linux-2.6/compat-2.6/include/linux/bottom_half.h

diff --git a/datapath/linux-2.6/Modules.mk b/datapath/linux-2.6/Modules.mk
index 5a0e9ad..3ffee50 100644
--- a/datapath/linux-2.6/Modules.mk
+++ b/datapath/linux-2.6/Modules.mk
@@ -9,6 +9,7 @@ openvswitch_sources += \
 openvswitch_headers += \
 	linux-2.6/compat-2.6/compat26.h \
 	linux-2.6/compat-2.6/include/asm-generic/bug.h \
+	linux-2.6/compat-2.6/include/linux/bottom_half.h \
 	linux-2.6/compat-2.6/include/linux/cpumask.h \
 	linux-2.6/compat-2.6/include/linux/dmi.h \
 	linux-2.6/compat-2.6/include/linux/err.h \
diff --git a/datapath/linux-2.6/compat-2.6/include/linux/bottom_half.h b/datapath/linux-2.6/compat-2.6/include/linux/bottom_half.h
new file mode 100644
index 0000000..b762442
--- /dev/null
+++ b/datapath/linux-2.6/compat-2.6/include/linux/bottom_half.h
@@ -0,0 +1,13 @@
+#ifndef __LINUX_BH_WRAPPER_H
+#define __LINUX_BH_WRAPPER_H 1
+
+#include_next <linux/bottom_half.h>
+
+#ifdef CONFIG_PREEMPT_HARDIRQS
+#undef local_bh_disable
+#define local_bh_disable preempt_disable
+#undef local_bh_enable
+#define local_bh_enable preempt_enable
+#endif
+
+#endif
-- 
1.7.1





More information about the dev mailing list