netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Jianbo Liu <jianbol@nvidia.com>,
	"edumazet@google.com" <edumazet@google.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"fw@strlen.de" <fw@strlen.de>
Subject: Re: [PATCH net] net: drop secpath extension before skb deferral free
Date: Sun, 26 May 2024 13:57:13 +0300	[thread overview]
Message-ID: <20240526105713.GB96190@unreal> (raw)
In-Reply-To: <Zk7l6MChwKkjbTJx@gauss3.secunet.de>

On Thu, May 23, 2024 at 08:44:56AM +0200, Steffen Klassert wrote:
> On Thu, May 23, 2024 at 02:22:38AM +0000, Jianbo Liu wrote:
> > On Wed, 2024-05-22 at 11:34 +0200, Steffen Klassert wrote:
> > > 
> > > Maybe we should directly remove the device from the xfrm_state
> > > when the decice goes down, this should catch all the cases.
> > > 
> > > I think about something like this (untested) patch:
> > > 
> > > diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
> > > index 0c306473a79d..ba402275ab57 100644
> > > --- a/net/xfrm/xfrm_state.c
> > > +++ b/net/xfrm/xfrm_state.c
> > > @@ -867,7 +867,11 @@ int xfrm_dev_state_flush(struct net *net, struct
> > > net_device *dev, bool task_vali
> > >                                 xfrm_state_hold(x);
> > >                                 spin_unlock_bh(&net-
> > > >xfrm.xfrm_state_lock);
> > >  
> > > -                               err = xfrm_state_delete(x);
> > > +                               spin_lock_bh(&x->lock);
> > > +                               err = __xfrm_state_delete(x);
> > > +                               xfrm_dev_state_free(x);
> > > +                               spin_unlock_bh(&x->lock);
> > > +
> > >                                 xfrm_audit_state_delete(x, err ? 0 :
> > > 1,
> > >                                                         task_valid);
> > >                                 xfrm_state_put(x);
> > > 
> > > The secpath is still attached to all skbs, but the hang on device
> > > unregister should go away.
> > 
> > It didn't fix the issue.
> 
> Do you have a backtrace of the ref_tracker?
> 
> Is that with packet offload?

We saw same failure with crypto and packet offloads.

> 
> Looks like we need to remove the device from the xfrm_policy
> too if packet offload is used.

When we debugged it, we found that this line [1] was responsible for
elevated reference count. XFRM policy cleaned properly.

Thanks

[1] https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c#L332

> 

      parent reply	other threads:[~2024-05-26 10:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13 10:02 [PATCH net] net: drop secpath extension before skb deferral free Jianbo Liu
2024-05-13 10:29 ` Eric Dumazet
2024-05-14  7:37   ` Jianbo Liu
2024-05-14  8:51     ` Eric Dumazet
2024-05-15  3:10       ` Jianbo Liu
2024-05-20 10:06       ` Jianbo Liu
2024-05-21 10:15         ` Steffen Klassert
2024-05-22  9:34         ` Steffen Klassert
2024-05-22 11:06           ` Eric Dumazet
2024-05-23  2:22           ` Jianbo Liu
2024-05-23  6:44             ` Steffen Klassert
2024-05-23  6:57               ` Jianbo Liu
2024-05-23 10:00                 ` Steffen Klassert
2024-05-23 15:26                   ` Jianbo Liu
2024-05-27  7:40                     ` Steffen Klassert
2024-05-28  8:44                       ` Steffen Klassert
2024-05-28  9:02                         ` Jianbo Liu
2024-05-28  9:26                           ` Steffen Klassert
2024-05-26 10:57               ` Leon Romanovsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240526105713.GB96190@unreal \
    --to=leon@kernel.org \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=jianbol@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).