From: Lu Baolu <baolu.lu@linux.intel.com> To: Joerg Roedel <joro@8bytes.org>, Jason Gunthorpe <jgg@nvidia.com>, Robin Murphy <robin.murphy@arm.com>, Kevin Tian <kevin.tian@intel.com>, Ashok Raj <ashok.raj@intel.com>, Christoph Hellwig <hch@infradead.org>, Will Deacon <will@kernel.org>, Joao Martins <joao.m.martins@oracle.com> Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Lu Baolu <baolu.lu@linux.intel.com> Subject: [RFC PATCHES 2/2] iommu: Replace put_pages_list() with iommu_free_pgtbl_pages() Date: Thu, 9 Jun 2022 15:08:11 +0800 [thread overview] Message-ID: <20220609070811.902868-2-baolu.lu@linux.intel.com> (raw) In-Reply-To: <20220609070811.902868-1-baolu.lu@linux.intel.com> Therefore, RCU protected page free will take effect if necessary. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> --- drivers/iommu/amd/io_pgtable.c | 5 ++--- drivers/iommu/dma-iommu.c | 6 ++++-- drivers/iommu/intel/iommu.c | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/amd/io_pgtable.c b/drivers/iommu/amd/io_pgtable.c index 6608d1717574..a62d5dafd7f2 100644 --- a/drivers/iommu/amd/io_pgtable.c +++ b/drivers/iommu/amd/io_pgtable.c @@ -423,7 +423,7 @@ static int iommu_v1_map_page(struct io_pgtable_ops *ops, unsigned long iova, } /* Everything flushed out, free pages now */ - put_pages_list(&freelist); + iommu_free_pgtbl_pages(&dom->domain, &freelist); return ret; } @@ -503,8 +503,7 @@ static void v1_free_pgtable(struct io_pgtable *iop) /* Make changes visible to IOMMUs */ amd_iommu_domain_update(dom); - - put_pages_list(&freelist); + iommu_free_pgtbl_pages(&dom->domain, &freelist); } static struct io_pgtable *v1_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index f90251572a5d..a948358c3e51 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -132,7 +132,8 @@ static void fq_ring_free(struct iommu_dma_cookie *cookie, struct iova_fq *fq) if (fq->entries[idx].counter >= counter) break; - put_pages_list(&fq->entries[idx].freelist); + iommu_free_pgtbl_pages(cookie->fq_domain, + &fq->entries[idx].freelist); free_iova_fast(&cookie->iovad, fq->entries[idx].iova_pfn, fq->entries[idx].pages); @@ -228,7 +229,8 @@ static void iommu_dma_free_fq(struct iommu_dma_cookie *cookie) struct iova_fq *fq = per_cpu_ptr(cookie->fq, cpu); fq_ring_for_each(idx, fq) - put_pages_list(&fq->entries[idx].freelist); + iommu_free_pgtbl_pages(cookie->fq_domain, + &fq->entries[idx].freelist); } free_percpu(cookie->fq); diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 19024dc52735..f429671e837f 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -1891,7 +1891,7 @@ static void domain_exit(struct dmar_domain *domain) LIST_HEAD(freelist); domain_unmap(domain, 0, DOMAIN_MAX_PFN(domain->gaw), &freelist); - put_pages_list(&freelist); + iommu_free_pgtbl_pages(&domain->domain, &freelist); } kfree(domain); @@ -4510,7 +4510,7 @@ static void intel_iommu_tlb_sync(struct iommu_domain *domain, start_pfn, nrpages, list_empty(&gather->freelist), 0); - put_pages_list(&gather->freelist); + iommu_free_pgtbl_pages(domain, &gather->freelist); } static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Lu Baolu <baolu.lu@linux.intel.com> To: Joerg Roedel <joro@8bytes.org>, Jason Gunthorpe <jgg@nvidia.com>, Robin Murphy <robin.murphy@arm.com>, Kevin Tian <kevin.tian@intel.com>, Ashok Raj <ashok.raj@intel.com>, Christoph Hellwig <hch@infradead.org>, Will Deacon <will@kernel.org>, Joao Martins <joao.m.martins@oracle.com> Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [RFC PATCHES 2/2] iommu: Replace put_pages_list() with iommu_free_pgtbl_pages() Date: Thu, 9 Jun 2022 15:08:11 +0800 [thread overview] Message-ID: <20220609070811.902868-2-baolu.lu@linux.intel.com> (raw) In-Reply-To: <20220609070811.902868-1-baolu.lu@linux.intel.com> Therefore, RCU protected page free will take effect if necessary. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> --- drivers/iommu/amd/io_pgtable.c | 5 ++--- drivers/iommu/dma-iommu.c | 6 ++++-- drivers/iommu/intel/iommu.c | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/amd/io_pgtable.c b/drivers/iommu/amd/io_pgtable.c index 6608d1717574..a62d5dafd7f2 100644 --- a/drivers/iommu/amd/io_pgtable.c +++ b/drivers/iommu/amd/io_pgtable.c @@ -423,7 +423,7 @@ static int iommu_v1_map_page(struct io_pgtable_ops *ops, unsigned long iova, } /* Everything flushed out, free pages now */ - put_pages_list(&freelist); + iommu_free_pgtbl_pages(&dom->domain, &freelist); return ret; } @@ -503,8 +503,7 @@ static void v1_free_pgtable(struct io_pgtable *iop) /* Make changes visible to IOMMUs */ amd_iommu_domain_update(dom); - - put_pages_list(&freelist); + iommu_free_pgtbl_pages(&dom->domain, &freelist); } static struct io_pgtable *v1_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index f90251572a5d..a948358c3e51 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -132,7 +132,8 @@ static void fq_ring_free(struct iommu_dma_cookie *cookie, struct iova_fq *fq) if (fq->entries[idx].counter >= counter) break; - put_pages_list(&fq->entries[idx].freelist); + iommu_free_pgtbl_pages(cookie->fq_domain, + &fq->entries[idx].freelist); free_iova_fast(&cookie->iovad, fq->entries[idx].iova_pfn, fq->entries[idx].pages); @@ -228,7 +229,8 @@ static void iommu_dma_free_fq(struct iommu_dma_cookie *cookie) struct iova_fq *fq = per_cpu_ptr(cookie->fq, cpu); fq_ring_for_each(idx, fq) - put_pages_list(&fq->entries[idx].freelist); + iommu_free_pgtbl_pages(cookie->fq_domain, + &fq->entries[idx].freelist); } free_percpu(cookie->fq); diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 19024dc52735..f429671e837f 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -1891,7 +1891,7 @@ static void domain_exit(struct dmar_domain *domain) LIST_HEAD(freelist); domain_unmap(domain, 0, DOMAIN_MAX_PFN(domain->gaw), &freelist); - put_pages_list(&freelist); + iommu_free_pgtbl_pages(&domain->domain, &freelist); } kfree(domain); @@ -4510,7 +4510,7 @@ static void intel_iommu_tlb_sync(struct iommu_domain *domain, start_pfn, nrpages, list_empty(&gather->freelist), 0); - put_pages_list(&gather->freelist); + iommu_free_pgtbl_pages(domain, &gather->freelist); } static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, -- 2.25.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2022-06-09 7:12 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-09 7:08 [RFC PATCHES 1/2] iommu: Add RCU-protected page free support Lu Baolu 2022-06-09 7:08 ` Lu Baolu 2022-06-09 7:08 ` Lu Baolu [this message] 2022-06-09 7:08 ` [RFC PATCHES 2/2] iommu: Replace put_pages_list() with iommu_free_pgtbl_pages() Lu Baolu 2022-06-09 12:49 ` [RFC PATCHES 1/2] iommu: Add RCU-protected page free support Jason Gunthorpe via iommu 2022-06-09 12:49 ` Jason Gunthorpe 2022-06-09 13:19 ` Robin Murphy 2022-06-09 13:19 ` Robin Murphy 2022-06-09 13:32 ` Jason Gunthorpe 2022-06-09 13:32 ` Jason Gunthorpe via iommu 2022-06-10 5:59 ` Baolu Lu 2022-06-10 5:59 ` Baolu Lu 2022-06-10 5:37 ` Baolu Lu 2022-06-10 5:37 ` Baolu Lu 2022-06-15 15:40 ` Jason Gunthorpe 2022-06-15 15:40 ` Jason Gunthorpe via iommu 2022-06-16 2:27 ` Baolu Lu 2022-06-16 2:27 ` Baolu Lu 2022-06-20 4:04 ` Jason Gunthorpe 2022-06-20 4:04 ` Jason Gunthorpe via iommu 2022-06-09 17:06 ` Raj, Ashok 2022-06-09 17:06 ` Raj, Ashok 2022-06-10 6:05 ` Baolu Lu 2022-06-10 6:05 ` Baolu Lu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220609070811.902868-2-baolu.lu@linux.intel.com \ --to=baolu.lu@linux.intel.com \ --cc=ashok.raj@intel.com \ --cc=hch@infradead.org \ --cc=iommu@lists.linux-foundation.org \ --cc=jgg@nvidia.com \ --cc=joao.m.martins@oracle.com \ --cc=joro@8bytes.org \ --cc=kevin.tian@intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=robin.murphy@arm.com \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.