intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH v2 0/9] drm/i915: Replace kmap_atomic() with kmap_local_page()
@ 2023-03-29  7:32 Zhao Liu
  2023-03-29  7:32 ` [Intel-gfx] [PATCH v2 1/9] drm/i915: Use kmap_local_page() in gem/i915_gem_object.c Zhao Liu
                   ` (13 more replies)
  0 siblings, 14 replies; 33+ messages in thread
From: Zhao Liu @ 2023-03-29  7:32 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Daniel Vetter, Matthew Auld, Thomas Hellström,
	Nirmoy Das, Maarten Lankhorst, Chris Wilson,
	Christian König, intel-gfx, dri-devel, linux-kernel
  Cc: Fabio M . De Francesco, Ira Weiny, Zhao Liu, Zhenyu Wang

From: Zhao Liu <zhao1.liu@intel.com>

Hi list,

Sorry for a long delay since v1 [1]. This patchset is based on 197b6b6
(Linux 6.3-rc4).

Welcome and thanks for your review and comments!


# Purpose of this patchset

The purpose of this pacthset is to replace all uses of kmap_atomic() in
i915 with kmap_local_page() because the use of kmap_atomic() is being
deprecated in favor of kmap_local_page()[1]. And 92b64bd (mm/highmem:
add notes about conversions from kmap{,_atomic}()) has declared the
deprecation of kmap_atomic().


# Motivation for deprecating kmap_atomic() and using kmap_local_page()

The main difference between atomic and local mappings is that local
mappings doesn't disable page faults or preemption (the preemption is
disabled for !PREEMPT_RT case, otherwise it only disables migration).

With kmap_local_page(), we can avoid the often unwanted side effect of
unnecessary page faults and preemption disables.


# Patch summary

Patch 1, 4-6 and 8-9 replace kamp_atomic()/kunmap_atomic() with
        kmap_local_page()/kunmap_local() directly. With thses local
        mappings, the page faults and preemption are allowed.

Patch 2 and 7 use memcpy_from_page() and memcpy_to_page() to replace
        kamp_atomic()/kunmap_atomic(). These two variants of memcpy()
        are based on the local mapping, so page faults and preemption
        are also allowed in these two interfaces.

Patch 3 replaces kamp_atomic()/kunmap_atomic() with kmap_local_page()/
        kunmap_local() and also diable page fault since the for special
        handling (pls see the commit message).


# Changes since v1

* Dropped hot plug related description in commit message since it has
  nothing to do with kmap_local_page().
* Emphasized the motivation for using kmap_local_page() in commit
  message.
* Rebased patch 1 on f47e630 (drm/i915/gem: Typecheck page lookups) to
  keep the "idx" variable of type pgoff_t here.
* Used memcpy_from_page() and memcpy_to_page() to replace
  kmap_local_page() + memcpy() in patch 2.


# Reference

[1]: https://lore.kernel.org/lkml/20221017093726.2070674-1-zhao1.liu@linux.intel.com/
[1]: https://lore.kernel.org/all/20220813220034.806698-1-ira.weiny@intel.com
---
Zhao Liu (9):
  drm/i915: Use kmap_local_page() in gem/i915_gem_object.c
  drm/i915: Use memcpy_[from/to]_page() in gem/i915_gem_pyhs.c
  drm/i915: Use kmap_local_page() in gem/i915_gem_shmem.c
  drm/i915: Use kmap_local_page() in gem/selftests/huge_pages.c
  drm/i915: Use kmap_local_page() in gem/selftests/i915_gem_coherency.c
  drm/i915: Use kmap_local_page() in gem/selftests/i915_gem_context.c
  drm/i915: Use memcpy_from_page() in gt/uc/intel_uc_fw.c
  drm/i915: Use kmap_local_page() in i915_cmd_parser.c
  drm/i915: Use kmap_local_page() in gem/i915_gem_execbuffer.c

 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c       | 10 +++++-----
 drivers/gpu/drm/i915/gem/i915_gem_object.c           |  8 +++-----
 drivers/gpu/drm/i915/gem/i915_gem_phys.c             | 10 ++--------
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c            |  6 ++++--
 drivers/gpu/drm/i915/gem/selftests/huge_pages.c      |  6 +++---
 .../gpu/drm/i915/gem/selftests/i915_gem_coherency.c  | 12 ++++--------
 .../gpu/drm/i915/gem/selftests/i915_gem_context.c    |  8 ++++----
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c             |  5 +----
 drivers/gpu/drm/i915/i915_cmd_parser.c               |  4 ++--
 9 files changed, 28 insertions(+), 41 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2023-10-19  9:02 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29  7:32 [Intel-gfx] [PATCH v2 0/9] drm/i915: Replace kmap_atomic() with kmap_local_page() Zhao Liu
2023-03-29  7:32 ` [Intel-gfx] [PATCH v2 1/9] drm/i915: Use kmap_local_page() in gem/i915_gem_object.c Zhao Liu
2023-03-30 21:56   ` Ira Weiny
2023-03-29  7:32 ` [Intel-gfx] [PATCH v2 2/9] drm/i915: Use memcpy_[from/to]_page() in gem/i915_gem_pyhs.c Zhao Liu
2023-03-30 23:01   ` Ira Weiny
2023-03-29  7:32 ` [Intel-gfx] [PATCH v2 3/9] drm/i915: Use kmap_local_page() in gem/i915_gem_shmem.c Zhao Liu
2023-03-29  7:32 ` [Intel-gfx] [PATCH v2 4/9] drm/i915: Use kmap_local_page() in gem/selftests/huge_pages.c Zhao Liu
2023-03-31  3:04   ` Ira Weiny
2023-03-29  7:32 ` [Intel-gfx] [PATCH v2 5/9] drm/i915: Use kmap_local_page() in gem/selftests/i915_gem_coherency.c Zhao Liu
2023-03-31  3:07   ` Ira Weiny
2023-03-29  7:32 ` [Intel-gfx] [PATCH v2 6/9] drm/i915: Use kmap_local_page() in gem/selftests/i915_gem_context.c Zhao Liu
2023-03-31  3:33   ` Ira Weiny
2023-03-31  8:05     ` Tvrtko Ursulin
2023-03-29  7:32 ` [Intel-gfx] [PATCH v2 7/9] drm/i915: Use memcpy_from_page() in gt/uc/intel_uc_fw.c Zhao Liu
2023-03-29  7:32 ` [Intel-gfx] [PATCH v2 8/9] drm/i915: Use kmap_local_page() in i915_cmd_parser.c Zhao Liu
2023-03-31  3:36   ` Ira Weiny
2023-03-29  7:32 ` [Intel-gfx] [PATCH v2 9/9] drm/i915: Use kmap_local_page() in gem/i915_gem_execbuffer.c Zhao Liu
2023-03-31  4:18   ` Ira Weiny
2023-03-31 11:30     ` Tvrtko Ursulin
2023-03-31 15:32       ` Fabio M. De Francesco
2023-04-10  9:08         ` Zhao Liu
2023-04-12 15:45         ` Tvrtko Ursulin
2023-04-14 10:45           ` Zhao Liu
2023-04-17 11:24             ` Tvrtko Ursulin
2023-04-17 14:53               ` Rodrigo Vivi
2023-10-18 16:19                 ` Zhao Liu
2023-10-19  9:02                   ` Tvrtko Ursulin
2023-03-29  8:17 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Replace kmap_atomic() with kmap_local_page() Patchwork
2023-03-29  8:18 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-03-29  8:37 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-03-29 16:03 ` [Intel-gfx] [PATCH v2 0/9] " Fabio M. De Francesco
2023-03-30 16:00   ` Zhao Liu
2023-03-29 19:51 ` [Intel-gfx] ✓ Fi.CI.IGT: success for " Patchwork

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).