public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [Intel-gfx] [RESEND PATCH 0/3] drm/i915: Replace kmap() with kmap_local_page()
@ 2022-10-16 18:09 Fabio M. De Francesco
  2022-10-16 18:09 ` [Intel-gfx] [RESEND PATCH 1/3] " Fabio M. De Francesco
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Fabio M. De Francesco @ 2022-10-16 18:09 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Daniel Vetter, Zhenyu Wang, Zhi Wang, Matthew Auld,
	Thomas Hellström, Nirmoy Das, Maarten Lankhorst,
	Christian König, Matt Roper, John Harrison,
	Daniele Ceraolo Spurio, Lucas De Marchi, intel-gfx, dri-devel,
	linux-kernel, intel-gvt-dev
  Cc: Ira Weiny, Venkataramanan, Anirudh, Fabio M. De Francesco

kmap() is being deprecated in favor of kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead as
mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when the
kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again, the
kernel virtual addresses are restored and still valid.

Since its use in drm/i915 is safe everywhere, it should be preferred.

Therefore, replace kmap() with kmap_local_page() in drm/i915.

These changes should be tested in an 32 bits system, booting a kernel
with HIGHMEM enabled. Unfortunately I have no i915 based hardware,
therefore any help with testing would be greatly appreciated.

I'm resending this little series because I suspect that it has been
lost, since it was submitted on Aug 11, 2022. In the meantime I'm
adding one more recipient (Anirudh) who is helping, along with others, Ira
and me with these conversions / removals of kmap() and kmap_atomic() 

Cc: "Venkataramanan, Anirudh" <anirudh.venkataramanan@intel.com>
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>

Fabio M. De Francesco (3):
  drm/i915: Replace kmap() with kmap_local_page()
  drm/i915/gt: Replace kmap() with kmap_local_page()
  drm/i915/gem: Replace kmap() with kmap_local_page()

 drivers/gpu/drm/i915/gem/i915_gem_shmem.c          |  6 ++----
 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              | 11 ++++-------
 drivers/gpu/drm/i915/i915_gem.c                    |  8 ++++----
 5 files changed, 16 insertions(+), 21 deletions(-)

-- 
2.37.1


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

end of thread, other threads:[~2022-11-01 23:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-16 18:09 [Intel-gfx] [RESEND PATCH 0/3] drm/i915: Replace kmap() with kmap_local_page() Fabio M. De Francesco
2022-10-16 18:09 ` [Intel-gfx] [RESEND PATCH 1/3] " Fabio M. De Francesco
2022-10-16 18:09 ` [Intel-gfx] [RESEND PATCH 2/3] drm/i915/gt: " Fabio M. De Francesco
2022-10-16 18:09 ` [Intel-gfx] [RESEND PATCH 3/3] drm/i915/gem: " Fabio M. De Francesco
2022-10-17 20:23 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Replace kmap() with kmap_local_page() (rev2) Patchwork
2022-11-01 21:48   ` Fabio M. De Francesco
2022-11-01 23:09   ` Fabio M. De Francesco
2022-10-17 20:34 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-11-01 21:34   ` Fabio M. De Francesco
2022-10-18  7:41 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

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