lkml.org 
[lkml]   [2022]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v9 04/11] iommu: Add sva iommu_domain support
    From
    On 2022/6/28 16:50, Tian, Kevin wrote:
    >>>> +
    >>>> + mutex_lock(&group->mutex);
    >>>> + curr = xa_cmpxchg(&group->pasid_array, pasid, NULL, domain,
    >>>> GFP_KERNEL);
    >>>> + if (curr)
    >>>> + goto out_unlock;
    >>> Need check xa_is_err(old).
    >> Either
    >>
    >> (1) old entry is a valid pointer, or
    > return -EBUSY in this case
    >
    >> (2) xa_is_err(curr)
    > return xa_err(cur)
    >
    >> are failure cases. Hence, "curr == NULL" is the only check we need. Did
    >> I miss anything?
    >>
    > But now you always return -EBUSY for all kinds of xa errors.

    Fair enough. Updated like below.

    curr = xa_cmpxchg(&group->pasid_array, pasid, NULL, domain,
    GFP_KERNEL);
    if (curr) {
    ret = xa_err(curr) ? : -EBUSY;
    goto out_unlock;
    }

    Best regards,
    baolu

    \
     
     \ /
      Last update: 2022-06-28 13:43    [W:2.163 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site