datapath: #define local_bh_disable to preempt_disable on RT.
authorJesse Gross <jesse@nicira.com>
Mon, 18 Oct 2010 22:36:59 +0000 (15:36 -0700)
committerJesse Gross <jesse@nicira.com>
Mon, 25 Oct 2010 18:17:10 +0000 (11:17 -0700)
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@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/linux-2.6/Modules.mk
datapath/linux-2.6/compat-2.6/include/linux/bottom_half.h [new file with mode: 0644]

index 5a0e9ad..3ffee50 100644 (file)
@@ -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 (file)
index 0000000..59eb4bc
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef __LINUX_BH_WRAPPER_H
+#define __LINUX_BH_WRAPPER_H 1
+
+#include_next <linux/bottom_half.h>
+
+/* This is not, strictly speaking, compatibility code in the sense that it is
+ * not needed by older kernels.  However, it is used on kernels with the
+ * realtime patchset applied to create an environment more similar to what we
+ * would see on normal kernels.
+ */
+
+#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