• Chris Wilson's avatar
    drm/i915: Cache kmap between relocations · 31a39207
    Chris Wilson authored
    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: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Link: http://patchwork.freedesktop.org/patch/msgid/20160818161718.27187-7-chris@chris-wilson.co.uk
    31a39207
i915_gem_execbuffer.c 52.1 KB