iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Will Deacon <will@kernel.org>, Robin Murphy <robin.murphy@arm.com>
Cc: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] iommu: io-pgtable: Drop WARN for empty PTEs on unmap
Date: Wed, 10 Jul 2019 16:31:19 -0600	[thread overview]
Message-ID: <20190710223119.8151-1-robh@kernel.org> (raw)

If a region has been mapped sparsely (such as on page faults), the user
has to keep track of what was mapped or not in order to avoid warnings
when unmapping the entire region. Remove the WARN on empty PTEs to allow
unmapping sparsely mapped regions.

Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: iommu@lists.linux-foundation.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
This is needed for large (up to 1GB AIUI) scratch buffers on panfrost 
which are mapped on demand on GPU page faults and can be unmapped on 
memory pressure. Alternatively, I'd need to have a bitmap of mapped 
pages to track what is mapped or not. Dropping the WARN seems like a 
much simpler solution.

This will need to go thru the DRM tree once I've gotten the panfrost 
side finished, but wanted some early feedback.

Rob

 drivers/iommu/io-pgtable-arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 4e21efbc4459..43971638a5aa 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -611,7 +611,7 @@ static size_t __arm_lpae_unmap(struct arm_lpae_io_pgtable *data,
 
 	ptep += ARM_LPAE_LVL_IDX(iova, lvl, data);
 	pte = READ_ONCE(*ptep);
-	if (WARN_ON(!pte))
+	if (!pte)
 		return 0;
 
 	/* If the size matches this level, we're in the right place */
-- 
2.20.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

             reply	other threads:[~2019-07-10 22:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 22:31 Rob Herring [this message]
2019-07-11 10:23 ` [RFC PATCH] iommu: io-pgtable: Drop WARN for empty PTEs on unmap Will Deacon
2019-07-11 17:39   ` Rob Herring

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=20190710223119.8151-1-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-arm-kernel@lists.infradead.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).