Jason Gunthorpe
2023-Jan-17 13:30 UTC
[Nouveau] [PATCH 6/8] iommu/intel: Add a gfp parameter to alloc_pgtable_page()
On Tue, Jan 17, 2023 at 03:35:08AM +0000, Tian, Kevin wrote:> > From: Jason Gunthorpe <jgg at nvidia.com> > > Sent: Saturday, January 7, 2023 12:43 AM > > > > @@ -2676,7 +2676,7 @@ static int copy_context_table(struct intel_iommu > > *iommu, > > if (!old_ce) > > goto out; > > > > - new_ce = alloc_pgtable_page(iommu->node); > > + new_ce = alloc_pgtable_page(iommu->node, > > GFP_KERNEL); > > GFP_ATOMICCan't be: old_ce = memremap(old_ce_phys, PAGE_SIZE, MEMREMAP_WB); if (!old_ce) goto out; new_ce = alloc_pgtable_page(iommu->node, GFP_KERNEL); if (!new_ce) memremap() is sleeping. And the only caller is: ctxt_tbls = kcalloc(ctxt_table_entries, sizeof(void *), GFP_KERNEL); if (!ctxt_tbls) goto out_unmap; for (bus = 0; bus < 256; bus++) { ret = copy_context_table(iommu, &old_rt[bus], ctxt_tbls, bus, ext); Jason
Tian, Kevin
2023-Jan-18 01:18 UTC
[Nouveau] [PATCH 6/8] iommu/intel: Add a gfp parameter to alloc_pgtable_page()
> From: Jason Gunthorpe <jgg at nvidia.com> > Sent: Tuesday, January 17, 2023 9:30 PM > > On Tue, Jan 17, 2023 at 03:35:08AM +0000, Tian, Kevin wrote: > > > From: Jason Gunthorpe <jgg at nvidia.com> > > > Sent: Saturday, January 7, 2023 12:43 AM > > > > > > @@ -2676,7 +2676,7 @@ static int copy_context_table(struct > intel_iommu > > > *iommu, > > > if (!old_ce) > > > goto out; > > > > > > - new_ce = alloc_pgtable_page(iommu->node); > > > + new_ce = alloc_pgtable_page(iommu->node, > > > GFP_KERNEL); > > > > GFP_ATOMIC > > Can't be: > > old_ce = memremap(old_ce_phys, PAGE_SIZE, > MEMREMAP_WB); > if (!old_ce) > goto out; > > new_ce = alloc_pgtable_page(iommu->node, > GFP_KERNEL); > if (!new_ce) > > memremap() is sleeping. > > And the only caller is: > > ctxt_tbls = kcalloc(ctxt_table_entries, sizeof(void *), GFP_KERNEL); > if (!ctxt_tbls) > goto out_unmap; > > for (bus = 0; bus < 256; bus++) { > ret = copy_context_table(iommu, &old_rt[bus], > ctxt_tbls, bus, ext); >Yes, but the patch description says "Push the GFP_ATOMIC to all callers." implying it's purely a refactoring w/o changing those semantics. I'm fine with doing this change in this patch, but it should worth a clarification in the patch description.
Jason Gunthorpe
2023-Jan-18 15:15 UTC
[Nouveau] [PATCH 6/8] iommu/intel: Add a gfp parameter to alloc_pgtable_page()
On Wed, Jan 18, 2023 at 01:18:18AM +0000, Tian, Kevin wrote:> > From: Jason Gunthorpe <jgg at nvidia.com> > > Sent: Tuesday, January 17, 2023 9:30 PM > > > > On Tue, Jan 17, 2023 at 03:35:08AM +0000, Tian, Kevin wrote: > > > > From: Jason Gunthorpe <jgg at nvidia.com> > > > > Sent: Saturday, January 7, 2023 12:43 AM > > > > > > > > @@ -2676,7 +2676,7 @@ static int copy_context_table(struct > > intel_iommu > > > > *iommu, > > > > if (!old_ce) > > > > goto out; > > > > > > > > - new_ce = alloc_pgtable_page(iommu->node); > > > > + new_ce = alloc_pgtable_page(iommu->node, > > > > GFP_KERNEL); > > > > > > GFP_ATOMIC > > > > Can't be: > > > > old_ce = memremap(old_ce_phys, PAGE_SIZE, > > MEMREMAP_WB); > > if (!old_ce) > > goto out; > > > > new_ce = alloc_pgtable_page(iommu->node, > > GFP_KERNEL); > > if (!new_ce) > > > > memremap() is sleeping. > > > > And the only caller is: > > > > ctxt_tbls = kcalloc(ctxt_table_entries, sizeof(void *), GFP_KERNEL); > > if (!ctxt_tbls) > > goto out_unmap; > > > > for (bus = 0; bus < 256; bus++) { > > ret = copy_context_table(iommu, &old_rt[bus], > > ctxt_tbls, bus, ext); > > > > Yes, but the patch description says "Push the GFP_ATOMIC to all > callers." implying it's purely a refactoring w/o changing those > semantics.Sure, lets split the patch, it is a good idea Jason