[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SA2PR11MB5100CD9D0CBCDB2D0F76271CD6919@SA2PR11MB5100.namprd11.prod.outlook.com>
Date: Thu, 21 Jul 2022 18:55:04 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: Jiri Pirko <jiri@...nulli.us>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"idosch@...dia.com" <idosch@...dia.com>,
"petrm@...dia.com" <petrm@...dia.com>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"mlxsw@...dia.com" <mlxsw@...dia.com>,
"saeedm@...dia.com" <saeedm@...dia.com>,
"snelson@...sando.io" <snelson@...sando.io>
Subject: RE: [patch net-next v3 01/11] net: devlink: make sure that
devlink_try_get() works with valid pointer during xarray iteration
> -----Original Message-----
> From: Jiri Pirko <jiri@...nulli.us>
> Sent: Wednesday, July 20, 2022 10:45 PM
> To: Keller, Jacob E <jacob.e.keller@...el.com>
> Cc: netdev@...r.kernel.org; davem@...emloft.net; kuba@...nel.org;
> idosch@...dia.com; petrm@...dia.com; pabeni@...hat.com;
> edumazet@...gle.com; mlxsw@...dia.com; saeedm@...dia.com;
> snelson@...sando.io
> Subject: Re: [patch net-next v3 01/11] net: devlink: make sure that
> devlink_try_get() works with valid pointer during xarray iteration
>
> >Is it safe to rcu_read_unlock here while we're still in the middle of the array
> processing? What happens if something else updates the xarray? is the
> for_each_marked safe?
>
> Sure, you don't need to hold rcu_read_lock during call to xa_for_each_marked.
> The consistency of xarray is itself guaranteed. The only reason to take
> rcu_read_lock outside is that the devlink pointer which is
> rcu_dereference_check()'ed inside xa_for_each_marked() is still valid
> once we devlink_try_get() it.
>
Excellent, ok. Basically we need the RCU for protecting just the pointer until we get a reference to it separately.
Thanks!
In that case:
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
Powered by blists - more mailing lists