[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YtpAm245yK9pfQ+d@nanopsycho>
Date: Fri, 22 Jul 2022 08:15:55 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: "Keller, Jacob E" <jacob.e.keller@...el.com>
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
Thu, Jul 21, 2022 at 08:55:04PM CEST, jacob.e.keller@...el.com wrote:
>
>
>> -----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.
Yep.
>
>Thanks!
>
>In that case:
>
>Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
Thanks. I will send v4 soon wrapping this up into helper as Jakub
requested.
Powered by blists - more mailing lists