Re: [PATCH v2] iommu/iova: Reset max32_alloc_size after cleaning

2022-03-03 Thread Robin Murphy
On 2022-03-03 03:43, yf.w...@mediatek.com wrote: On Thu, 2022-03-03 at 07:52 +0800, Miles Chen wrote: Thanks for your explanation. YF showed me some numbers yesterday and maybe we can have a further discussion in that test case. (It looks like that some iovas are freed but their pfn_lo(s) are l

Re: [PATCH v2] iommu/iova: Reset max32_alloc_size after cleaning

2022-03-03 Thread yf.wang--- via iommu
From: yf.w...@mediatek.com On Thu, 2022-03-03 at 07:52 +0800, Miles Chen wrote: > Thanks for your explanation. > > YF showed me some numbers yesterday and maybe we can have a further > discussion in that test case. (It looks like that some iovas are > freed but > their pfn_lo(s) are less than ca

Re: [PATCH v2] iommu/iova: Reset max32_alloc_size after cleaning

2022-03-02 Thread Miles Chen via iommu
>> If no cached iova is freed, resetting max32_alloc_size before >> the retry allocation only give us a retry. Is it possible that >> other users free their iovas during the additional retry? > > No, it's not possible, since everyone's serialised by iova_rbtree_lock. > If the caches were already e

Re: [PATCH v2] iommu/iova: Reset max32_alloc_size after cleaning

2022-03-02 Thread Robin Murphy
On 2022-03-01 23:29, Miles Chen via iommu wrote: Hi Yunfei, Since __alloc_and_insert_iova_range fail will set the current alloc iova size to max32_alloc_size (iovad->max32_alloc_size = size), when the retry is executed into the __alloc_and_insert_iova_range function, the retry action will be bl

Re: [PATCH v2] iommu/iova: Reset max32_alloc_size after cleaning

2022-03-01 Thread Miles Chen via iommu
Hi Yunfei, >> Since __alloc_and_insert_iova_range fail will set the current alloc >> iova size to max32_alloc_size (iovad->max32_alloc_size = size), >> when the retry is executed into the __alloc_and_insert_iova_range >> function, the retry action will be blocked by the check condition >> (size >=

Re: [PATCH v2] iommu/iova: Reset max32_alloc_size after cleaning rcache in the fail path

2022-03-01 Thread Robin Murphy
On 2022-03-01 01:59, yf.wang--- via iommu wrote: From: Yunfei Wang In alloc_iova_fast function, if __alloc_and_insert_iova_range fail, alloc_iova_fast will try flushing rcache and retry alloc iova, but this has an issue: Since __alloc_and_insert_iova_range fail will set the current alloc iova

[PATCH v2] iommu/iova: Reset max32_alloc_size after cleaning rcache in the fail path

2022-02-28 Thread yf.wang--- via iommu
From: Yunfei Wang In alloc_iova_fast function, if __alloc_and_insert_iova_range fail, alloc_iova_fast will try flushing rcache and retry alloc iova, but this has an issue: Since __alloc_and_insert_iova_range fail will set the current alloc iova size to max32_alloc_size (iovad->max32_alloc_size =