Re: [PATCH v2 1/2] iova: Remove some magazine pointer NULL checks

John Garry
2022-09-07T09:53:52Z

On 07/09/2022 10:33, Ethan Zhao wrote:

Hi Ethan,

>>> Do you mean iova_magazine_alloc() is impossible to fail ?
>>
>> No, iova_magazine_alloc() may fail and return NULL. But if it does
>> then we set iovad rcache pointer = NULL in the error path and don't
>> use the rcache.
>
> Yup,  if iova_magazine_alloc() failed ,
>
> iovad->rcaches = NULL;
>
> was set by free_iova_rcaches()
>
> in error path of iova_domain_init_rcache().
>
> and checked in
>
> alloc_iova_fast()->iova_rcache_get().
>
> More comment in code would wipe off my curiosity.

As discussed with Robin, we will actually remove that check in
iova_rcache_get() for now and in future make the IOVA domain init more
robust.

As for the "loaded" and "prev" NULL checks removal in this specific
patch, I will add more words in the commit message to make it clearer
that failure in init was the only way in which they NULL previously.

thanks,
John