public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH 0/7] DRM kmap() fixes and kmap_local_page() conversions
@ 2021-12-10 23:23 ira.weiny
  2021-12-10 23:23 ` [Intel-gfx] [PATCH 1/7] drm/i915: Replace kmap() with kmap_local_page() ira.weiny
                   ` (10 more replies)
  0 siblings, 11 replies; 41+ messages in thread
From: ira.weiny @ 2021-12-10 23:23 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Patrik Jakobsson, Rob Clark,
	Sean Paul
  Cc: linux-arm-msm, intel-gfx, linux-kernel, dri-devel, amd-gfx,
	Ira Weiny

From: Ira Weiny <ira.weiny@intel.com>

This series starts by converting the last easy kmap() uses to
kmap_local_page().

There is one more call to kmap() wrapped in ttm_bo_kmap_ttm().  Unfortunately,
ttm_bo_kmap_ttm() is called in a number of different ways including some which
are not thread local.  I have a patch to convert that call.  However, it is not
straight forward so it is not included in this series.

The final 2 patches fix bugs found while working on the ttm_bo_kmap_ttm()
conversion.


Ira Weiny (7):
drm/i915: Replace kmap() with kmap_local_page()
drm/amd: Replace kmap() with kmap_local_page()
drm/gma: Remove calls to kmap()
drm/radeon: Replace kmap() with kmap_local_page()
drm/msm: Alter comment to use kmap_local_page()
drm/amdgpu: Ensure kunmap is called on error
drm/radeon: Ensure kunmap is called on error

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++++----
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 1 +
drivers/gpu/drm/gma500/gma_display.c | 6 ++----
drivers/gpu/drm/gma500/mmu.c | 8 ++++----
drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 4 ++--
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c | 8 ++++----
drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c | 4 ++--
drivers/gpu/drm/i915/gt/shmem_utils.c | 4 ++--
drivers/gpu/drm/i915/i915_gem.c | 8 ++++----
drivers/gpu/drm/i915/i915_gpu_error.c | 4 ++--
drivers/gpu/drm/msm/msm_gem_submit.c | 4 ++--
drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++--
drivers/gpu/drm/radeon/radeon_uvd.c | 1 +
13 files changed, 32 insertions(+), 32 deletions(-)

--
2.31.1


^ permalink raw reply	[flat|nested] 41+ messages in thread
* [Intel-gfx] [PATCH v2] drm/i915: Replace kmap() with kmap_local_page()
@ 2023-06-17 18:04 Sumitra Sharma
  2023-06-18 18:11 ` Ira Weiny
  2023-06-24  0:10 ` Fabio M. De Francesco
  0 siblings, 2 replies; 41+ messages in thread
From: Sumitra Sharma @ 2023-06-17 18:04 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Daniel Vetter, intel-gfx, dri-devel, linux-kernel
  Cc: Deepak R Varma, Fabio, Ira Weiny, Sumitra Sharma

kmap() has been deprecated in favor of the kmap_local_page()
due to high cost, restricted mapping space, the overhead of a
global lock for synchronization, and making the process sleep
in the absence of free slots.

kmap_local_page() is faster than kmap() and offers thread-local
and CPU-local mappings, take pagefaults in a local kmap region
and preserves preemption by saving the mappings of outgoing tasks
and restoring those of the incoming one during a context switch.

The mapping is kept thread local in the function
“i915_vma_coredump_create” in i915_gpu_error.c

Therefore, replace kmap() with kmap_local_page().

Suggested-by: Ira Weiny <ira.weiny@intel.com>

Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>
---

Changes in v2:
	- Replace kmap() with kmap_local_page().
	- Change commit subject and message.

 drivers/gpu/drm/i915/i915_gpu_error.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index f020c0086fbc..bc41500eedf5 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1164,9 +1164,9 @@ i915_vma_coredump_create(const struct intel_gt *gt,
 
 			drm_clflush_pages(&page, 1);
 
-			s = kmap(page);
+			s = kmap_local_page(page);
 			ret = compress_page(compress, s, dst, false);
-			kunmap(page);
+			kunmap_local(s);
 
 			drm_clflush_pages(&page, 1);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2023-06-26  9:03 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-10 23:23 [Intel-gfx] [PATCH 0/7] DRM kmap() fixes and kmap_local_page() conversions ira.weiny
2021-12-10 23:23 ` [Intel-gfx] [PATCH 1/7] drm/i915: Replace kmap() with kmap_local_page() ira.weiny
2021-12-13  9:04   ` Christoph Hellwig
2021-12-13 16:02     ` Ira Weiny
2021-12-13 12:39   ` Ville Syrjälä
2021-12-13 15:45     ` Ira Weiny
2021-12-22  6:08   ` [Intel-gfx] [PATCH V2] " ira.weiny
2021-12-10 23:23 ` [Intel-gfx] [PATCH 2/7] drm/amd: " ira.weiny
2021-12-10 23:24 ` [Intel-gfx] [PATCH 3/7] drm/gma: Remove calls to kmap() ira.weiny
2021-12-10 23:24 ` [Intel-gfx] [PATCH 4/7] drm/radeon: Replace kmap() with kmap_local_page() ira.weiny
2021-12-10 23:24 ` [Intel-gfx] [PATCH 5/7] drm/msm: Alter comment to use kmap_local_page() ira.weiny
2021-12-10 23:24 ` [Intel-gfx] [PATCH 6/7] drm/amdgpu: Ensure kunmap is called on error ira.weiny
2021-12-13 20:37   ` Christian König
2021-12-14  3:37     ` Ira Weiny
2021-12-14  7:09       ` Christian König
2021-12-15 21:09         ` Ira Weiny
2021-12-16  8:32           ` Christian König
2021-12-10 23:24 ` [Intel-gfx] [PATCH 7/7] drm/radeon: " ira.weiny
2021-12-10 23:36 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for DRM kmap() fixes and kmap_local_page() conversions Patchwork
2021-12-13 19:13 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for DRM kmap() fixes and kmap_local_page() conversions (rev2) Patchwork
2021-12-22  6:12 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for DRM kmap() fixes and kmap_local_page() conversions (rev3) Patchwork
2022-01-19 16:53 ` [Intel-gfx] [PATCH 0/7] DRM kmap() fixes and kmap_local_page() conversions Ira Weiny
2022-01-19 17:24   ` Daniel Vetter
2022-01-19 23:55     ` Ira Weiny
2022-01-20  8:16       ` Christian König
2022-01-20 15:48         ` Daniel Vetter
2022-01-20 16:57           ` Ira Weiny
  -- strict thread matches above, loose matches on Subject: below --
2023-06-17 18:04 [Intel-gfx] [PATCH v2] drm/i915: Replace kmap() with kmap_local_page() Sumitra Sharma
2023-06-18 18:11 ` Ira Weiny
2023-06-19  7:59   ` Thomas Hellström (Intel)
2023-06-19  8:44     ` Tvrtko Ursulin
2023-06-19 15:45   ` Sumitra Sharma
2023-06-20 13:23     ` Ira Weiny
2023-06-20 18:07       ` Sumitra Sharma
2023-06-21  9:06         ` Thomas Hellström (Intel)
2023-06-21 13:24           ` Fabio M. De Francesco
2023-06-21 16:35           ` Ira Weiny
2023-06-21 18:51             ` Thomas Hellström (Intel)
2023-06-22  9:40               ` Tvrtko Ursulin
2023-06-26  9:02       ` Tvrtko Ursulin
2023-06-24  0:10 ` Fabio M. De Francesco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox