]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: Cache kmap between relocations
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 18 Aug 2016 16:16:46 +0000 (17:16 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 18 Aug 2016 21:36:43 +0000 (22:36 +0100)
commit8c59388753117c7407cf3d3670b361e66d9a6e24
tree1eef17d52959b88908248b67a46c295a74a19276
parent4faa267e0e87d4e3ec5f696a0b8c9d966a66761d
drm/i915: Cache kmap between relocations

When doing relocations, we have to obtain a mapping to the page
containing the target address. This is either a kmap or iomap depending
on GPU and its cache coherency. Neighbouring relocation entries are
typically within the same page and so we can cache our kmapping between
them and avoid those pesky TLB flushes.

Note that there is some sleight-of-hand in how the slow relocate works
as the reloc_entry_cache implies pagefaults disabled (as we are inside a
kmap_atomic section). However, the slow relocate code is meant to be the
fallback from the atomic fast path failing. Fortunately it works as we
already have performed the copy_from_user for the relocation array (no
more pagefaults there) and the kmap_atomic cache is enabled after we
have waited upon an active buffer (so no more sleeping in atomic).
Magic!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20160818161718.27187-7-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem_execbuffer.c