Message ID | ZC0pBXBAgh7c76CA@kernel-bug-kernel-bug (mailing list archive) |
---|---|
State | Accepted |
Commit | 066b86787fa3d97b7aefb5ac0a99a22dad2d15f8 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net,v3] net: openvswitch: fix race on port output | expand |
On Wed, 5 Apr 2023 07:53:41 +0000 Felix Huettner wrote: > assume the following setup on a single machine: > 1. An openvswitch instance with one bridge and default flows > 2. two network namespaces "server" and "client" > 3. two ovs interfaces "server" and "client" on the bridge > 4. for each ovs interface a veth pair with a matching name and 32 rx and > tx queues > 5. move the ends of the veth pairs to the respective network namespaces > 6. assign ip addresses to each of the veth ends in the namespaces (needs > to be the same subnet) > 7. start some http server on the server network namespace > 8. test if a client in the client namespace can reach the http server Hi Simon, looks good?
On Thu, Apr 06, 2023 at 07:05:13PM -0700, Jakub Kicinski wrote: > On Wed, 5 Apr 2023 07:53:41 +0000 Felix Huettner wrote: > > assume the following setup on a single machine: > > 1. An openvswitch instance with one bridge and default flows > > 2. two network namespaces "server" and "client" > > 3. two ovs interfaces "server" and "client" on the bridge > > 4. for each ovs interface a veth pair with a matching name and 32 rx and > > tx queues > > 5. move the ends of the veth pairs to the respective network namespaces > > 6. assign ip addresses to each of the veth ends in the namespaces (needs > > to be the same subnet) > > 7. start some http server on the server network namespace > > 8. test if a client in the client namespace can reach the http server > > Hi Simon, looks good? Thanks Jakub, will check.
On Wed, Apr 5, 2023 at 9:53 AM Felix Huettner <felix.huettner@mail.schwarz> wrote: > > assume the following setup on a single machine: > 1. An openvswitch instance with one bridge and default flows > 2. two network namespaces "server" and "client" > 3. two ovs interfaces "server" and "client" on the bridge > 4. for each ovs interface a veth pair with a matching name and 32 rx and > tx queues > 5. move the ends of the veth pairs to the respective network namespaces > 6. assign ip addresses to each of the veth ends in the namespaces (needs > to be the same subnet) > 7. start some http server on the server network namespace > 8. test if a client in the client namespace can reach the http server > > when following the actions below the host has a chance of getting a cpu > stuck in a infinite loop: > 1. send a large amount of parallel requests to the http server (around > 3000 curls should work) > 2. in parallel delete the network namespace (do not delete interfaces or > stop the server, just kill the namespace) > > there is a low chance that this will cause the below kernel cpu stuck > message. If this does not happen just retry. > Below there is also the output of bpftrace for the functions mentioned > in the output. > ... Reviewed-by: Eric Dumazet <edumazet@google.com>
On Fri, Apr 07, 2023 at 10:44:35AM +0200, Simon Horman wrote: > On Thu, Apr 06, 2023 at 07:05:13PM -0700, Jakub Kicinski wrote: > > On Wed, 5 Apr 2023 07:53:41 +0000 Felix Huettner wrote: > > > assume the following setup on a single machine: > > > 1. An openvswitch instance with one bridge and default flows > > > 2. two network namespaces "server" and "client" > > > 3. two ovs interfaces "server" and "client" on the bridge > > > 4. for each ovs interface a veth pair with a matching name and 32 rx and > > > tx queues > > > 5. move the ends of the veth pairs to the respective network namespaces > > > 6. assign ip addresses to each of the veth ends in the namespaces (needs > > > to be the same subnet) > > > 7. start some http server on the server network namespace > > > 8. test if a client in the client namespace can reach the http server > > > > Hi Simon, looks good? > > Thanks Jakub, will check. Yes, this does look good to me. Reviewed-by: Simon Horman <simon.horman@corigine.com> nit: somewhere in the patch description, 'inifinite' -> 'infinite'
Hello: This patch was applied to netdev/net.git (main) by Jakub Kicinski <kuba@kernel.org>: On Wed, 5 Apr 2023 07:53:41 +0000 you wrote: > assume the following setup on a single machine: > 1. An openvswitch instance with one bridge and default flows > 2. two network namespaces "server" and "client" > 3. two ovs interfaces "server" and "client" on the bridge > 4. for each ovs interface a veth pair with a matching name and 32 rx and > tx queues > 5. move the ends of the veth pairs to the respective network namespaces > 6. assign ip addresses to each of the veth ends in the namespaces (needs > to be the same subnet) > 7. start some http server on the server network namespace > 8. test if a client in the client namespace can reach the http server > > [...] Here is the summary with links: - [net,v3] net: openvswitch: fix race on port output https://git.kernel.org/netdev/net/c/066b86787fa3 You are awesome, thank you!
diff --git a/net/core/dev.c b/net/core/dev.c index 253584777101..48067321c0db 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3199,6 +3199,7 @@ static u16 skb_tx_hash(const struct net_device *dev, } if (skb_rx_queue_recorded(skb)) { + DEBUG_NET_WARN_ON_ONCE(qcount == 0); hash = skb_get_rx_queue(skb); if (hash >= qoffset) hash -= qoffset; diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index ca3ebfdb3023..a8cf9a88758e 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c @@ -913,7 +913,7 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port, { struct vport *vport = ovs_vport_rcu(dp, out_port); - if (likely(vport)) { + if (likely(vport && netif_carrier_ok(vport->dev))) { u16 mru = OVS_CB(skb)->mru; u32 cutlen = OVS_CB(skb)->cutlen;