mbox series

[RESEND,0/3] drm/i915: Replace kmap() with kmap_local_page()

Message ID 20221016180938.17403-1-fmdefrancesco@gmail.com (mailing list archive)
Headers show
Series drm/i915: Replace kmap() with kmap_local_page() | expand

Message

Fabio M. De Francesco Oct. 16, 2022, 6:09 p.m. UTC
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(-)

Comments

Fabio M. De Francesco Nov. 1, 2022, 9:34 p.m. UTC | #1
On lunedì 17 ottobre 2022 22:34:44 CET Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915: Replace kmap() with kmap_local_page() (rev2)
> URL   : https://patchwork.freedesktop.org/series/107277/
> State : success
> 
> == Summary ==
> 
> CI Bug Log - changes from CI_DRM_12252 -> Patchwork_107277v2
> ====================================================
> 
> Summary
> -------
> 
>   **SUCCESS**
> 
>   No regressions found.
> 
>   External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_107277v2/
index.html
> 
> Participating hosts (46 -> 43)
> ------------------------------
> 
>   Additional (1): fi-icl-u2
>   Missing    (4): fi-bxt-dsi fi-cfl-8700k bat-atsm-1 fi-bdw-samus
> 
> Known issues
> ------------
> 
>   Here are the changes found in Patchwork_107277v2 that come from known 
issues:
> 
> ### IGT changes ###
> 
> #### Issues hit ####
> 
>   * igt@gem_exec_gttfill@basic:
>     - fi-pnv-d510:        [PASS][1] -> [FAIL][2] ([i915#7229])
>    [1]:
> https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12252/fi-pnv-d510/
igt@gem_exec_gttfill@
> basic.html [2]:
> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_107277v2/fi-pnv-d510/
igt@gem_exec_gt
> tfill@basic.html
> 
>   * igt@gem_linear_blits@basic:
>     - fi-pnv-d510:        [PASS][3] -> [SKIP][4] ([fdo#109271])
>    [3]:
> https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12252/fi-pnv-d510/
igt@gem_linear_blits@
> basic.html [4]:
> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_107277v2/fi-pnv-d510/
igt@gem_linear_
> blits@basic.html
> 
>   * igt@runner@aborted:
>     - fi-icl-u2:          NOTRUN -> [FAIL][5] ([i915#7220])
>    [5]:
> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_107277v2/fi-icl-u2/
igt@runner@aborte
> d.html
> 
> 
>   [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
>   [i915#7220]: https://gitlab.freedesktop.org/drm/intel/issues/7220
>   [i915#7229]: https://gitlab.freedesktop.org/drm/intel/issues/7229
> 
> 
> Build changes
> -------------
> 
>   * Linux: CI_DRM_12252 -> Patchwork_107277v2
> 
>   CI-20190529: 20190529
>   CI_DRM_12252: 14867082ef288af10c90732e31b633af30e304c0 @
> git://anongit.freedesktop.org/gfx-ci/linux IGT_7017:
> 193c8bdd7df32556129482c52011e1b7a233b699 @
> https://gitlab.freedesktop.org/drm/igt-gpu-tools.git Patchwork_107277v2:
> 14867082ef288af10c90732e31b633af30e304c0 @ git://anongit.freedesktop.org/
gfx-ci/linux
> 
> 
> ### Linux commits
> 
> 83c34dd3b2a2 drm/i915/gem: Replace kmap() with kmap_local_page()
> ade39e0c9963 drm/i915/gt: Replace kmap() with kmap_local_page()
> cd89efceb13c drm/i915: Replace kmap() with kmap_local_page()
> 
> == Logs ==
> 
> For more details see:
> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_107277v2/index.html

This is the second of the three messages with regards to the same series.
My kind request is the same of the previous...

Can anyone please provide any help?

Thanks,

Fabio
Fabio M. De Francesco Nov. 1, 2022, 9:48 p.m. UTC | #2
On lunedì 17 ottobre 2022 22:23:30 CET Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915: Replace kmap() with kmap_local_page() (rev2)
> URL   : https://patchwork.freedesktop.org/series/107277/
> State : warning
> 
> == Summary ==
> 
> Error: dim sparse failed
> Sparse version: v0.6.2
> Fast mode used, each commit won't be checked separately.

I received this and other messages with regards to the same series, however, 
after due inspection of my patches, I haven't yet been able to understand what 
these reports may mean or even if they are reporting bugs.

Can anyone please provide any help?

Thanks,

Fabio

P.S.: Similar requests for the other messages will follow ASAP.
Fabio M. De Francesco Nov. 1, 2022, 11:09 p.m. UTC | #3
On lunedì 17 ottobre 2022 22:23:30 CET Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915: Replace kmap() with kmap_local_page() (rev2)
> URL   : https://patchwork.freedesktop.org/series/107277/
> State : warning
> 
> == Summary ==
> 
> Error: dim sparse failed
> Sparse version: v0.6.2
> Fast mode used, each commit won't be checked separately.

I received this and other messages with regards to the same series, however, 
after due inspection of my patches, I haven't yet been able to understand what 
these reports may mean or even if they are reporting bugs.

Can anyone please provide any help?

Thanks,

Fabio

P.S.: Similar requests for the other messages will follow ASAP.