Re: [PATCH v5 for-next 3/3] IB/core: Obtain subnet_prefix from cache in IB devices
From: Jason Gunthorpe
Date: Fri Jun 25 2021 - 08:48:17 EST
On Fri, Jun 25, 2021 at 11:33:58AM +0530, Anand Khoje wrote:
>
> If the above change is to be made, there could arise a scenario in which:
> In case of a cache_update event, another application/module could try to
> call ib_query_port() and read subnet_prefix while the cache is still getting
> updated and the application/module could end up reading a stale value of
> subnet_prefix.
Applications relying on this data must hook the event and update their
state when the event fires.
So long as ib_query_port returns the correct value in the event
handler it is all OK. This whole thing is racy - the HW can change the
subnet_prefix at anytime, this is just shuffling the race around.
> - Is it possible that different GIDs in the gid_table will have different
> values of subnet_prefix?
Valid GIDs should have the same prefix
Jason