[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <bef8be2b-2d37-b00f-42fb-40887aac27a1@intel.com>
Date: Mon, 17 Jul 2023 16:47:45 +0800
From: Yanfei Xu <yanfei.xu@...el.com>
To: Tina Zhang <tina.zhang@...el.com>, Jason Gunthorpe <jgg@...pe.ca>,
"Kevin Tian" <kevin.tian@...el.com>,
Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Lu Baolu <baolu.lu@...ux.intel.com>,
Michael Shavit <mshavit@...gle.com>
CC: <iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 5/6] iommu: Support mm PASID 1:1 with sva domain
Hi Tina,
On 7/7/2023 9:34 AM, Tina Zhang wrote:
> @@ -33,9 +34,18 @@ static int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t ma
> goto out;
> }
>
> + iommu_mm = kzalloc(sizeof(struct iommu_mm_data), GFP_KERNEL);
> + if (!iommu_mm) {
> + ret = -ENOMEM;
> + goto out;
> + }
> + mm->iommu_mm = iommu_mm;
> +
> ret = ida_alloc_range(&iommu_global_pasid_ida, min, max, GFP_KERNEL);
> - if (ret < min)
> + if (ret < min) {
> + kfree(iommu_mm);
> goto out;
Once pasid allocation fails at this part, we should reassign the
mm->iommu_mm back to default value, or it will keep a unavailable
pointer, right?
Thanks,
Yanfei
> + }
> mm_set_pasid(mm, ret);
> ret = 0;
> out:
Powered by blists - more mailing lists