diff --git a/SOURCES/openvswitch-2.16.0.patch b/SOURCES/openvswitch-2.16.0.patch index 6f3c8bc..c899ef8 100644 --- a/SOURCES/openvswitch-2.16.0.patch +++ b/SOURCES/openvswitch-2.16.0.patch @@ -83779,10 +83779,25 @@ index 45a96b9be2..738fb44b3c 100644 return; } diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c -index 60dd138914..911f55fe74 100644 +index 60dd138914..c94cfc2ab7 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c -@@ -627,6 +627,7 @@ netdev_linux_notify_sock(void) +@@ -247,6 +247,14 @@ enum { + VALID_NUMA_ID = 1 << 8, + }; + ++/* Linux 4.4 introduced the ability to skip the internal stats gathering ++ * that netlink does via an external filter mask that can be passed into ++ * a netlink request. ++ */ ++#ifndef RTEXT_FILTER_SKIP_STATS ++#define RTEXT_FILTER_SKIP_STATS (1 << 3) ++#endif ++ + /* Use one for the packet buffer and another for the aux buffer to receive + * TSO packets. */ + #define IOV_STD_SIZE 1 +@@ -627,6 +635,7 @@ netdev_linux_notify_sock(void) if (!error) { size_t i; @@ -83790,7 +83805,7 @@ index 60dd138914..911f55fe74 100644 for (i = 0; i < ARRAY_SIZE(mcgroups); i++) { error = nl_sock_join_mcgroup(sock, mcgroups[i]); if (error) { -@@ -636,7 +637,6 @@ netdev_linux_notify_sock(void) +@@ -636,7 +645,6 @@ netdev_linux_notify_sock(void) } } } @@ -83798,7 +83813,7 @@ index 60dd138914..911f55fe74 100644 ovsthread_once_done(&once); } -@@ -682,7 +682,10 @@ netdev_linux_update_lag(struct rtnetlink_change *change) +@@ -682,7 +690,10 @@ netdev_linux_update_lag(struct rtnetlink_change *change) return; } @@ -83810,7 +83825,7 @@ index 60dd138914..911f55fe74 100644 block_id = netdev_get_block_id(master_netdev); if (!block_id) { netdev_close(master_netdev); -@@ -2623,7 +2626,7 @@ static void +@@ -2623,7 +2634,7 @@ static void nl_msg_act_police_end_nest(struct ofpbuf *request, size_t offset, size_t act_offset) { @@ -83819,7 +83834,7 @@ index 60dd138914..911f55fe74 100644 nl_msg_end_nested(request, offset); nl_msg_end_nested(request, act_offset); } -@@ -6285,7 +6288,14 @@ get_stats_via_netlink(const struct netdev *netdev_, struct netdev_stats *stats) +@@ -6285,7 +6296,14 @@ get_stats_via_netlink(const struct netdev *netdev_, struct netdev_stats *stats) if (ofpbuf_try_pull(reply, NLMSG_HDRLEN + sizeof(struct ifinfomsg))) { const struct nlattr *a = nl_attr_find(reply, 0, IFLA_STATS64); if (a && nl_attr_get_size(a) >= sizeof(struct rtnl_link_stats64)) { @@ -83835,6 +83850,16 @@ index 60dd138914..911f55fe74 100644 error = 0; } else { a = nl_attr_find(reply, 0, IFLA_STATS); +@@ -6401,6 +6419,9 @@ netdev_linux_update_via_netlink(struct netdev_linux *netdev) + if (netdev_linux_netnsid_is_remote(netdev)) { + nl_msg_put_u32(&request, IFLA_IF_NETNSID, netdev->netnsid); + } ++ ++ nl_msg_put_u32(&request, IFLA_EXT_MASK, RTEXT_FILTER_SKIP_STATS); ++ + error = nl_transact(NETLINK_ROUTE, &request, &reply); + ofpbuf_uninit(&request); + if (error) { diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index 9845e8d3fe..3bbada7ad6 100644 --- a/lib/netdev-offload-tc.c diff --git a/SPECS/openvswitch2.16.spec b/SPECS/openvswitch2.16.spec index 510f230..a83f59e 100644 --- a/SPECS/openvswitch2.16.spec +++ b/SPECS/openvswitch2.16.spec @@ -57,7 +57,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 2.16.0 -Release: 102%{?dist} +Release: 103%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -699,6 +699,63 @@ exit 0 %endif %changelog +* Tue Oct 11 2022 Aaron Conole - 2.16.0-103 +- netdev-linux: Skip some internal kernel stats gathering. [RH git: ce553c99e2] (#2118848) + For netdev_linux_update_via_netlink(), hint to the kernel that + we do not need it to gather netlink internal stats when we want + to update the netlink flags, as those stats are not rendered + within OVS. + + Background: + ovs-vswitchd can spend quite a bit of time blocked by the kernel + during netlink calls, especially systems with many cores. This + time is dominated by the kernel-side internal stats gathering + mechanism in netlink, specifically: + inet6_fill_link_af + inet6_fill_ifla6_attrs + __snmp6_fill_stats64 + + In Linux 4.4+, there exists a hint for netlink requests to not + trigger the ipv6 stats gathering mechanism, which greatly reduces + the amount of time that ovs-vswitchd is on CPU. + + Testing and Results: + Tested booting 320 VM's and measuring OVS utilization with perf + record, then visualized into a flamegraph using a patched version + of ovs 2.14.2. Calls under bridge_run() seem to get hit the worst + by this issue. + + Before bridge_run() == 11.3% of samples + After bridge_run() == 3.4% of samples + + Note that there are at least two observed netlink calls under + bridge_run that are still kernel stats heavy after this patch: + + Call 1: + bridge_run -> netdev_run -> route_table_run -> route_table_reset -> + ovs_router_insert -> ovs_router_insert__ -> get_src_addr -> + netdev_ger_addr_list -> netdev_linux_get_addr_list -> getifaddrs + + Since the actual netlink call is coming from getifaddrs() in glibc, + fixing would likely involve either duplicating glibc code in ovs + source or patch glibc. + + Call 2: + bridge_run -> iface_refresh_stats -> netdev_get_stats -> + netdev_linux_get_stats -> get_stats_via_netlink + + This does use netlink based stats; however, it isn't immediately + clear if just dropping the stats from inet6_fill_link_af would + impact anything or not. Given this call is more intermittent, its + of lesser concern. + + Acked-by: Greg Smith + Signed-off-by: Jon Kohler + Signed-off-by: Ilya Maximets + + Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2118848 + + * Tue Oct 04 2022 Timothy Redaelli - 2.16.0-102 - redhat: get the NVR from spec file directly [RH git: fe9ce6cd83] Fixes: 339efe77c4c7 ("pkgtool: keep %{?dist} before added bz string")