• Thomas Hellström's avatar
    drm/i915/ttm: Failsafe migration blits · 2b0a750c
    Thomas Hellström authored
    If the initial fill blit or copy blit of an object fails, the old
    content of the data might be exposed and read as soon as either CPU- or
    GPU PTEs are set up to point at the pages.
    
    Intercept the blit fence with an async callback that checks the
    blit fence for errors and if there are errors performs an async cpu blit
    instead. If there is a failure to allocate the async dma_fence_work,
    allocate it on the stack and sync wait for the blit to complete.
    
    Add selftests that simulate gpu blit failures and failure to allocate
    the async dma_fence_work.
    
    A previous version of this pach used dma_fence_work, now that's
    opencoded which adds more code but might lower the latency
    somewhat in the common non-error case.
    
    v3:
    - Style fixes (Matthew Auld)
    v4:
    - Use "#if IS_ENABLED()" instead of #ifdef (Matthew Auld)
    v5:
    - Fix an issue where we, if the dependency was already signaled, might
      end up waiting for a memcpy fence that would never signal.
    v6:
    - Add a missing i915_ttm_memcpy_release() (Matthew Auld)
    Signed-off-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
    Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20211104110718.688420-3-thomas.hellstrom@linux.intel.com
    2b0a750c
i915_gem_migrate.c 5.63 KB