[ovs-git] [openvswitch/ovs] bef862: compat: Restrict __ro_after_init usage

GitHub noreply at github.com
Mon Jun 19 19:36:53 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: bef862bc5c8a20831a0cad79f56e908f546aff65
      https://github.com/openvswitch/ovs/commit/bef862bc5c8a20831a0cad79f56e908f546aff65
  Author: Greg Rose <gvrose8192 at gmail.com>
  Date:   2017-06-19 (Mon, 19 Jun 2017)

  Changed paths:
    M acinclude.m4
    M datapath/linux/compat/include/linux/cache.h

  Log Message:
  -----------
  compat: Restrict __ro_after_init usage

The attribute __ro_after_init was introduced in Linux kernel 4.5.  If
a data structure is given this attribute then after the driver module
loads the memory page where the data resides will be marked read only.

The compat code in cache.h always defines __ro_after_init if it is not
already defined so that it can be used as an attribute for the datapath
genl_family structure definitions.  If __ro_after_init is defined then
it is used "as-is" where it will apply the read only attribute after
driver initialization.

This is incorrect usage for the Generic Netlink genl_family structure
definitions prior to Linux kernel 4.10.  The genl_family structure
in those kernels includes a list header member that will be written
to when the generic netlink family is unregistered.  This will cause
a subsequent page fault and kernel panic because at this time the
genl_family structure data has been marked read only in the page
descriptor.

A new compat macro is introduced in acinclude.m4 to detect when the
genl_family structure has the family_list list header as a member.
In this case HAVE_GENL_FAMILY_LIST is defined and if __ro_after_init
is also defined then it is undefined and redefined as empty.  This
will prevent the genl_family data structure from being marked read
only in kernels 4.5 through 4.9 and thus prevent the page fault when
the generic netlink families in datapath.c are unregistered.

[Committer notes]
* Rolled a short explanation comment into the code.

Fixes: ba63fe260bd5 ("datapath: Allow compile against current net-next.")
CC: Jarno Rajahalme <jarno at ovn.org>
Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
Signed-off-by: Joe Stringer <joe at ovn.org>


  Commit: 2a85b7cc813726bcb0bc9b98705e9674b488fceb
      https://github.com/openvswitch/ovs/commit/2a85b7cc813726bcb0bc9b98705e9674b488fceb
  Author: Joe Stringer <joe at ovn.org>
  Date:   2017-06-19 (Mon, 19 Jun 2017)

  Changed paths:
    M NEWS
    M vswitchd/vswitch.xml

  Log Message:
  -----------
  docs: Document that hw-offload is experimental.

Currently, the set of flows that may be offloaded is very small compared
to the overall capabilities of the OpenFlow support in OVS. In the
majority of cases, if a user attempts to enable this flag they are
unlikely to observe a performance increase, because for instance they
lack the correct hardware; lack the correct kernel version; or their
flow tables are too complex for the hardware to handle.

To moderate expectations around this feature, describe it as
experimental. Over time, we expect that the functionality and usefulness
of this feature will grow and we should be in a better shape to revisit
the status of this functionality after it has had some time to mature.

Signed-off-by: Joe Stringer <joe at ovn.org>
Acked-by: Simon Horman <simon.horman at netronome.com>
Acked-by: Flavio Leitner <fbl at sysclose.org>


Compare: https://github.com/openvswitch/ovs/compare/58bfaba061db...2a85b7cc8137


More information about the git mailing list