[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <021da64bc786df118dff1a9724c6958a517a56cd.camel@nvidia.com>
Date: Mon, 20 Jan 2025 16:16:49 +0000
From: Cosmin Ratiu <cratiu@...dia.com>
To: "steffen.klassert@...unet.com" <steffen.klassert@...unet.com>,
"liuhangbin@...il.com" <liuhangbin@...il.com>
CC: "shuah@...nel.org" <shuah@...nel.org>, "andrew+netdev@...n.ch"
<andrew+netdev@...n.ch>, "davem@...emloft.net" <davem@...emloft.net>,
"jv@...sburgh.net" <jv@...sburgh.net>, "sd@...asysnail.net"
<sd@...asysnail.net>, "andy@...yhouse.net" <andy@...yhouse.net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>, "edumazet@...gle.com"
<edumazet@...gle.com>, "razor@...ckwall.org" <razor@...ckwall.org>, Jianbo
Liu <jianbol@...dia.com>, "horms@...nel.org" <horms@...nel.org>,
"kuba@...nel.org" <kuba@...nel.org>, Tariq Toukan <tariqt@...dia.com>,
"herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH net 0/2] bond: fix xfrm offload feature during init
On Fri, 2025-01-17 at 08:54 +0100, Steffen Klassert wrote:
> >
> > Hi Jianbo,
> >
> > I talked with Sabrina and it looks we can't simply do this. Because
> > both
> > xfrm_add_sa_expire() and xfrm_timer_handler() calling
> > __xfrm_state_delete() under
> > spin lock. If we move the xfrm_dev_state_delete() out of
> > __xfrm_state_delete(),
> > all the places need to be handled correctly.
> >
> > At the same time xfrm_timer_handler() calling
> > xfrm_dev_state_update_stats before
> > __xfrm_state_delete(). Should we also take care of it to make sure
> > the state
> > change and delete are called at the same time?
> >
> > Hi Steffen, do you have any comments?
>
> Can't you just fix this in bonding? xfrm_timer_handler() can't sleep
> anyway, even if you remove the spinlock, it is a timer function.
>
I am not sure this can be fixed in bonding given that the
xdo_dev_state_delete op could, in the general case, sleep while talking
to the hardware. I don't think it's reasonable to expect devices to
offload xfrm while the kernel holds a spinlock.
Bonding just exposed this assumption mismatch because of the mutex that
was added to replace a spinlock which exhibited the same problem we are
talking about here.
Do the dev offload operations need to be synchronous? Couldn't
__xfrm_state_delete instead schedule a wq to do the dev offload? I saw
there's already an xfrm_state_gc_task that's invoked to call
xfrm_dev_state_free, perhaps that could be used to do the delete as
well?
Cosmin.
Powered by blists - more mailing lists