* Are xfrm state_add/delete() calls serialized?
@ 2022-09-12 15:10 Bharat Bhushan
2022-09-19 9:29 ` Leon Romanovsky
0 siblings, 1 reply; 4+ messages in thread
From: Bharat Bhushan @ 2022-09-12 15:10 UTC (permalink / raw)
To: netdev
Hi All,
Have a very basic query related to .xdo_dev_state_add()/delete() ops supported by netdev driver. Can .xdo_dev_state_add()/delete() execute from other core while already in process of handling .xdo_dev_state_add()/delete() on one core? Or these calls are always serialized by stack?
Wanted to know if we need proper locking while handling these ops in driver.
Thanks
-Bharat
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Are xfrm state_add/delete() calls serialized?
2022-09-12 15:10 Are xfrm state_add/delete() calls serialized? Bharat Bhushan
@ 2022-09-19 9:29 ` Leon Romanovsky
2022-09-21 5:42 ` [EXT] " Bharat Bhushan
0 siblings, 1 reply; 4+ messages in thread
From: Leon Romanovsky @ 2022-09-19 9:29 UTC (permalink / raw)
To: Bharat Bhushan; +Cc: netdev
On Mon, Sep 12, 2022 at 03:10:12PM +0000, Bharat Bhushan wrote:
> Hi All,
>
> Have a very basic query related to .xdo_dev_state_add()/delete() ops supported by netdev driver. Can .xdo_dev_state_add()/delete() execute from other core while already in process of handling .xdo_dev_state_add()/delete() on one core? Or these calls are always serialized by stack?
It is protected from userspace callers with xfrm_cfg_mutex in xfrm_netlink_rcv().
However, stack triggered deletion can be in parallel. There is a lock
for that specific SA that is going to be deleted, and it is not global.
> Wanted to know if we need proper locking while handling these ops in driver.
>
> Thanks
> -Bharat
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [EXT] Re: Are xfrm state_add/delete() calls serialized?
2022-09-19 9:29 ` Leon Romanovsky
@ 2022-09-21 5:42 ` Bharat Bhushan
2022-09-21 7:49 ` Leon Romanovsky
0 siblings, 1 reply; 4+ messages in thread
From: Bharat Bhushan @ 2022-09-21 5:42 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: netdev
Please see inline
> -----Original Message-----
> From: Leon Romanovsky <leon@kernel.org>
> Sent: Monday, September 19, 2022 3:00 PM
> To: Bharat Bhushan <bbhushan2@marvell.com>
> Cc: netdev@vger.kernel.org
> Subject: [EXT] Re: Are xfrm state_add/delete() calls serialized?
>
> External Email
>
> ----------------------------------------------------------------------
> On Mon, Sep 12, 2022 at 03:10:12PM +0000, Bharat Bhushan wrote:
> > Hi All,
> >
> > Have a very basic query related to .xdo_dev_state_add()/delete() ops
> supported by netdev driver. Can .xdo_dev_state_add()/delete() execute from
> other core while already in process of handling .xdo_dev_state_add()/delete()
> on one core? Or these calls are always serialized by stack?
>
> It is protected from userspace callers with xfrm_cfg_mutex in xfrm_netlink_rcv().
So all *_state_add() and _state_delete() are serialized from user.
> However, stack triggered deletion can be in parallel. There is a lock for that
> specific SA that is going to be deleted, and it is not global.
Just want to confirm m understanding, xfrm_state->lock is used by stack (example xfrm_timer_handler()) for deletion, but this lock is per SA (not global).
So _state_delete() of different SA can happen in parallel and also _state_delete() by stack can run in parallel to state addition from user.
Thanks
-Bharat
>
> > Wanted to know if we need proper locking while handling these ops in driver.
> >
> > Thanks
> > -Bharat
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [EXT] Re: Are xfrm state_add/delete() calls serialized?
2022-09-21 5:42 ` [EXT] " Bharat Bhushan
@ 2022-09-21 7:49 ` Leon Romanovsky
0 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2022-09-21 7:49 UTC (permalink / raw)
To: Bharat Bhushan; +Cc: netdev
On Wed, Sep 21, 2022 at 05:42:22AM +0000, Bharat Bhushan wrote:
> Please see inline
>
> > -----Original Message-----
> > From: Leon Romanovsky <leon@kernel.org>
> > Sent: Monday, September 19, 2022 3:00 PM
> > To: Bharat Bhushan <bbhushan2@marvell.com>
> > Cc: netdev@vger.kernel.org
> > Subject: [EXT] Re: Are xfrm state_add/delete() calls serialized?
> >
> > External Email
> >
> > ----------------------------------------------------------------------
> > On Mon, Sep 12, 2022 at 03:10:12PM +0000, Bharat Bhushan wrote:
> > > Hi All,
> > >
> > > Have a very basic query related to .xdo_dev_state_add()/delete() ops
> > supported by netdev driver. Can .xdo_dev_state_add()/delete() execute from
> > other core while already in process of handling .xdo_dev_state_add()/delete()
> > on one core? Or these calls are always serialized by stack?
> >
> > It is protected from userspace callers with xfrm_cfg_mutex in xfrm_netlink_rcv().
>
> So all *_state_add() and _state_delete() are serialized from user.
>
> > However, stack triggered deletion can be in parallel. There is a lock for that
> > specific SA that is going to be deleted, and it is not global.
>
> Just want to confirm m understanding, xfrm_state->lock is used by stack (example xfrm_timer_handler()) for deletion, but this lock is per SA (not global).
> So _state_delete() of different SA can happen in parallel and also _state_delete() by stack can run in parallel to state addition from user.
Right
>
> Thanks
> -Bharat
>
> >
> > > Wanted to know if we need proper locking while handling these ops in driver.
> > >
> > > Thanks
> > > -Bharat
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-21 7:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12 15:10 Are xfrm state_add/delete() calls serialized? Bharat Bhushan
2022-09-19 9:29 ` Leon Romanovsky
2022-09-21 5:42 ` [EXT] " Bharat Bhushan
2022-09-21 7:49 ` Leon Romanovsky
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.