mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/vmwgfx: Replace kmap_atomic() with kmap_local_page()
@ 2026-09-03 15:37 Danish Khateeb
  0 siblings, 0 replies; only message in thread
From: Danish Khateeb @ 2026-09-03 15:37 UTC (permalink / raw)
  To: Zack Rusin
  Cc: bcm-kernel-feedback-list, dri-devel, linux-kernel, Danish Khateeb

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-03 15:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-03 15:37 [PATCH] drm/vmwgfx: Replace kmap_atomic() with kmap_local_page() Danish Khateeb

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®