[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y0w/WWY60gqrtGLp@pop-os.localdomain>
Date: Sun, 16 Oct 2022 10:28:57 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Davide Caratti <dcaratti@...hat.com>
Cc: Jamal Hadi Salim <jhs@...atatu.com>, Jiri Pirko <jiri@...nulli.us>,
Paolo Abeni <pabeni@...hat.com>,
Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
wizhao@...hat.com, netdev@...r.kernel.org, peilin.ye@...edance.com
Subject: Re: [PATCH net] net/sched: act_mirred: use the backlog for mirred
ingress
On Tue, Oct 04, 2022 at 07:40:27PM +0200, Davide Caratti wrote:
> hello Cong, thanks for looking at this!
>
> On Sun, Sep 25, 2022 at 11:08:48AM -0700, Cong Wang wrote:
> > On Fri, Sep 23, 2022 at 05:11:12PM +0200, Davide Caratti wrote:
> > > William reports kernel soft-lockups on some OVS topologies when TC mirred
> > > "egress-to-ingress" action is hit by local TCP traffic. Indeed, using the
> > > mirred action in egress-to-ingress can easily produce a dmesg splat like:
> > >
> > > ============================================
> > > WARNING: possible recursive locking detected
>
> [...]
>
> > > 6.0.0-rc4+ #511 Not tainted
> > > --------------------------------------------
> > > nc/1037 is trying to acquire lock:
> > > ffff950687843cb0 (slock-AF_INET/1){+.-.}-{2:2}, at: tcp_v4_rcv+0x1023/0x1160
> > >
> > > but task is already holding lock:
> > > ffff950687846cb0 (slock-AF_INET/1){+.-.}-{2:2}, at: tcp_v4_rcv+0x1023/0x1160
>
> FTR, this is:
Yeah, Peilin actually looked deeper into this issue. Let's copy him.
>
> 2091 sk_incoming_cpu_update(sk);
> 2092
> 2093 bh_lock_sock_nested(sk); <--- the lock reported in the splat
> 2094 tcp_segs_in(tcp_sk(sk), skb);
> 2095 ret = 0;
> 2096 if (!sock_owned_by_user(sk)) {
>
> > BTW, have you thought about solving the above lockdep warning in TCP
> > layer?
>
> yes, but that doesn't look like a trivial fix at all - and I doubt it's
> worth doing it just to make mirred and TCP "friends". Please note:
> on current kernel this doesn't just result in a lockdep warning: using
> iperf3 on unpatched kernels it's possible to see a real deadlock, like:
I'd say your test case is rare, because I don't think it is trivial for
a TCP socket to send packets to itself.
> > Which also means we can no longer know the RX path status any more,
> > right? I mean if we have filters on ingress, we can't know whether they
> > drop this packet or not, after this patch? To me, this at least breaks
> > users' expectation.
>
> Fair point! Then maybe we don't need to change the whole TC mirred ingress:
> since the problem only affects egress to ingress, we can preserve the call
> to netif_recive_skb() on ingress->ingress, and just use the backlog in the
> egress->ingress direction _ that has been broken since the very beginning
> and got similar fixes in the past [1]. Something like:
Regarless ingress->ingress or egress->ingress, this patch breaks
users' expectation. And, actually egress->ingress is more common than
ingress->ingress, in my experience.
Thanks.
Powered by blists - more mailing lists