mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Danish Khateeb <danishkhateeb03@gmail.com>
To: Zack Rusin <zack.rusin@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Danish Khateeb <danishkhateeb03@gmail.com>
Subject: [PATCH] drm/vmwgfx: Replace kmap_atomic() with kmap_local_page()
Date: Thu,  3 Sep 2026 10:37:57 -0500	[thread overview]
Message-ID: <20260903153757.26291-1-danishkhateeb03@gmail.com> (raw)

kmap_atomic() is deprecated in favour of kmap_local_page(), as described
in Documentation/mm/highmem.rst.

The conversion is safe in vmw_mob_build_pt(): the mapping is created and
torn down within a single iteration of the pt_page loop, preserving the
strict stack-based ordering that kmap_local_page() requires. Between the
map and the unmap the code only writes page table entries through the
mapped address and calls the vmw_piter accessors, which are non-sleeping
array and scatterlist lookups, so neither pagefault_disable() nor
preempt_disable() is needed.

Reword the function comment to match. Avoiding TLB thrashing, the reason
given there for using temporary mappings, still applies.

Build-tested only.

Assisted-by: LLM sparse
Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
index de7a504de..edc1ba5df 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
@@ -451,7 +451,7 @@ static void vmw_mob_assign_ppn(u32 **addr, dma_addr_t val)
  * @pt_pages:       Array of page pointers to the page table pages.
  *
  * Returns the number of page table pages actually used.
- * Uses atomic kmaps of highmem pages to avoid TLB thrashing.
+ * Uses local kmaps of highmem pages to avoid TLB thrashing.
  */
 static unsigned long vmw_mob_build_pt(struct vmw_piter *data_iter,
 				      unsigned long num_data_pages,
@@ -467,7 +467,7 @@ static unsigned long vmw_mob_build_pt(struct vmw_piter *data_iter,
 	for (pt_page = 0; pt_page < num_pt_pages; ++pt_page) {
 		page = vmw_piter_page(pt_iter);
 
-		save_addr = addr = kmap_atomic(page);
+		save_addr = addr = kmap_local_page(page);
 
 		for (i = 0; i < PAGE_SIZE / VMW_PPN_SIZE; ++i) {
 			vmw_mob_assign_ppn(&addr,
@@ -476,7 +476,7 @@ static unsigned long vmw_mob_build_pt(struct vmw_piter *data_iter,
 				break;
 			WARN_ON(!vmw_piter_next(data_iter));
 		}
-		kunmap_atomic(save_addr);
+		kunmap_local(save_addr);
 		vmw_piter_next(pt_iter);
 	}
 
-- 
2.55.0


                 reply	other threads:[~2026-09-03 15:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260903153757.26291-1-danishkhateeb03@gmail.com \
    --to=danishkhateeb03@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zack.rusin@broadcom.com \
    /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

all inboxes | Powered by JetHome®