diff mbox series

[ovs-dev] rhel7.6: Support kmod build and load for mulitple kernel versions

Message ID 1559339889-10053-1-git-send-email-pkusunyifeng@gmail.com
State Accepted
Commit 52d12cc4590d5b95505a21d3508586db3bb35d07
Headers show
Series [ovs-dev] rhel7.6: Support kmod build and load for mulitple kernel versions | expand

Commit Message

Yifeng Sun May 31, 2019, 9:58 p.m. UTC
RHEL 7.6's new kernel 3.10.0-957.12.1.el7 introduced some ABI changes.
This leads to an issue that OVS kernel module built against
kernels newer than 12.1 cannot be loaded on systems running kernels
older than 12.1, vice versa.

By inspecting datapath/linux/openvswitch.mod.c, signatures of
the following kernel functions have changed in 3.10.0-957.12.1.el7:
    nf_ct_get_tuple
    nf_ct_invert_tuplepr
    __nf_ct_l4proto_find

This patch enables OVS to build kernel modules against multiple
kernel versions and enables RHEL 7.6 system to load the compatible
module at runtime.

make rpm-fedora-kmod \
    RPMBUILD_OPT='-D "kversion 3.10.0-957.10.1.el7.x86_64 \
    3.10.0-957.12.1.el7.x86_64"'

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
---
 rhel/openvswitch-kmod-fedora.spec.in                  |  9 +++++----
 rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh | 11 +++++++++++
 2 files changed, 16 insertions(+), 4 deletions(-)

Comments

Yi-Hung Wei May 31, 2019, 10:57 p.m. UTC | #1
On Fri, May 31, 2019 at 2:59 PM Yifeng Sun <pkusunyifeng@gmail.com> wrote:
>
> RHEL 7.6's new kernel 3.10.0-957.12.1.el7 introduced some ABI changes.
> This leads to an issue that OVS kernel module built against
> kernels newer than 12.1 cannot be loaded on systems running kernels
> older than 12.1, vice versa.
>
> By inspecting datapath/linux/openvswitch.mod.c, signatures of
> the following kernel functions have changed in 3.10.0-957.12.1.el7:
>     nf_ct_get_tuple
>     nf_ct_invert_tuplepr
>     __nf_ct_l4proto_find
>
> This patch enables OVS to build kernel modules against multiple
> kernel versions and enables RHEL 7.6 system to load the compatible
> module at runtime.
>
> make rpm-fedora-kmod \
>     RPMBUILD_OPT='-D "kversion 3.10.0-957.10.1.el7.x86_64 \
>     3.10.0-957.12.1.el7.x86_64"'
>
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> ---
Looks good to me.

Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
Ben Pfaff June 5, 2019, 8:45 p.m. UTC | #2
On Fri, May 31, 2019 at 03:57:45PM -0700, Yi-Hung Wei wrote:
> On Fri, May 31, 2019 at 2:59 PM Yifeng Sun <pkusunyifeng@gmail.com> wrote:
> >
> > RHEL 7.6's new kernel 3.10.0-957.12.1.el7 introduced some ABI changes.
> > This leads to an issue that OVS kernel module built against
> > kernels newer than 12.1 cannot be loaded on systems running kernels
> > older than 12.1, vice versa.
> >
> > By inspecting datapath/linux/openvswitch.mod.c, signatures of
> > the following kernel functions have changed in 3.10.0-957.12.1.el7:
> >     nf_ct_get_tuple
> >     nf_ct_invert_tuplepr
> >     __nf_ct_l4proto_find
> >
> > This patch enables OVS to build kernel modules against multiple
> > kernel versions and enables RHEL 7.6 system to load the compatible
> > module at runtime.
> >
> > make rpm-fedora-kmod \
> >     RPMBUILD_OPT='-D "kversion 3.10.0-957.10.1.el7.x86_64 \
> >     3.10.0-957.12.1.el7.x86_64"'
> >
> > Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> > ---
> Looks good to me.
> 
> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>

Thanks, Yifeng (and Yi-Hung).  I applied this to master.  If it should
be backported, please let me know.
diff mbox series

Patch

diff --git a/rhel/openvswitch-kmod-fedora.spec.in b/rhel/openvswitch-kmod-fedora.spec.in
index dfa6f237f82d..92d763f5695b 100644
--- a/rhel/openvswitch-kmod-fedora.spec.in
+++ b/rhel/openvswitch-kmod-fedora.spec.in
@@ -12,8 +12,8 @@ 
 # Use the kversion macro such as
 # RPMBUILD_OPT='-D "kversion 3.10.0-693.1.1.el7.x86_64 3.10.0-693.17.1.el7.x86_64"'
 # to build package for mulitple kernel versions in the same package
-# This only works for kernel 3.10.0 major revision 693 (RHEL 7.4)
-# and major revision 327 (RHEL 7.2)
+# This only works for kernel 3.10.0 major revision 957 (RHEL 7.6),
+# major revision 693 (RHEL 7.4) and major revision 327 (RHEL 7.2).
 # By default, build against the current running kernel version
 #%define kernel 3.1.5-1.fc16.x86_64
 #define kernel %{kernel_source}
@@ -91,8 +91,9 @@  if grep -qs "suse" /etc/os-release; then
         %{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh
     fi
 elif [ "$mainline_major" = "3" ] && [ "$mainline_minor" = "10" ]; then
-    if [ "$major_rev" = "327" ] || [ "$major_rev" = "693" ]; then
-        # For RHEL 7.2 and 7.4
+    if [ "$major_rev" = "327" ] || [ "$major_rev" = "693" ] || \
+       [ "$major_rev" = "957" ]; then
+        # For RHEL 7.2, 7.4 and 7.6
         if [ -x "%{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh" ]; then
             %{_datadir}/openvswitch/scripts/ovs-kmod-manage.sh
         fi
diff --git a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
index 9c9f230b70d7..2cd8e5c80ef4 100644
--- a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
+++ b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
@@ -17,11 +17,17 @@ 
 # This script is intended to be used on the following kernels.
 #   - 3.10.0 major revision 327 (RHEL 7.2)
 #   - 3.10.0 major revision 693 (RHEL 7.4)
+#   - 3.10.0 major revision 957 (RHEL 7.6)
 #   - 4.4.x,  x >= 73           (SLES 12 SP3)
 #   - 4.12.x, x >= 14           (SLES 12 SP4).
 # It is packaged in the openvswitch kmod RPM and run in the post-install
 # scripts.
 #
+# For kernel 3.10.0-957,
+# due to some backward incompatible changes introduced in minor revision 12.1,
+# kernel modules built against kernels newer than 12.1 cannot be loaded on
+# system running kernels older than 12.1, vice versa.
+#
 # For kernel 3.10.0-693,
 # due to some backward incompatible changes introduced in minor revision 17.1,
 # kernel modules built against kernels newer than 17.1 cannot be loaded on
@@ -79,6 +85,11 @@  if [ "$mainline_major" = "3" ] && [ "$mainline_minor" = "10" ]; then
         comp_ver=11
         ver_offset=4
         installed_ver="$minor_rev"
+    elif [ "$major_rev" = "957" ]; then
+#        echo "rhel76"
+        comp_ver=10
+        ver_offset=4
+        installed_ver="$minor_rev"
     fi
 elif [ "$mainline_major" = "4" ] && [ "$mainline_minor" = "4" ]; then
     if [ "$mainline_patch" -ge "73" ]; then