1. 10 1月, 2022 1 次提交
  2. 21 12月, 2021 1 次提交
  3. 25 11月, 2021 1 次提交
  4. 02 11月, 2021 2 次提交
  5. 22 10月, 2021 2 次提交
    • M
      drm/i915/ttm: move shrinker management into adjust_lru · ebd4a8ec
      Matthew Auld 提交于
      We currently just evict lmem objects to system memory when under memory
      pressure. For this case we might lack the usual object mm.pages, which
      effectively hides the pages from the i915-gem shrinker, until we
      actually "attach" the TT to the object, or in the case of lmem-only
      objects it just gets migrated back to lmem when touched again.
      
      For all cases we can just adjust the i915 shrinker LRU each time we also
      adjust the TTM LRU. The two cases we care about are:
      
        1) When something is moved by TTM, including when initially populating
           an object. Importantly this covers the case where TTM moves something from
           lmem <-> smem, outside of the normal get_pages() interface, which
           should still ensure the shmem pages underneath are reclaimable.
      
        2) When calling into i915_gem_object_unlock(). The unlock should
           ensure the object is removed from the shinker LRU, if it was indeed
           swapped out, or just purged, when the shrinker drops the object lock.
      
      v2(Thomas):
        - Handle managing the shrinker LRU in adjust_lru, where it is always
          safe to touch the object.
      v3(Thomas):
        - Pretty much a re-write. This time piggy back off the shrink_pin
          stuff, which actually seems to fit quite well for what we want here.
      v4(Thomas):
        - Just use a simple boolean for tracking ttm_shrinkable.
      v5:
        - Ensure we call adjust_lru when faulting the object, to ensure the
          pages are visible to the shrinker, if needed.
        - Add back the adjust_lru when in i915_ttm_move (Thomas)
      v6(Reported-by: kernel test robot <lkp@intel.com>):
        - Remove unused i915_tt
      Signed-off-by: NMatthew Auld <matthew.auld@intel.com>
      Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
      Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> #v4
      Link: https://patchwork.freedesktop.org/patch/msgid/20211018091055.1998191-6-matthew.auld@intel.com
      ebd4a8ec
    • M
      drm/i915/ttm: add tt shmem backend · 7ae03459
      Matthew Auld 提交于
      For cached objects we can allocate our pages directly in shmem. This
      should make it possible(in a later patch) to utilise the existing
      i915-gem shrinker code for such objects. For now this is still disabled.
      
      v2(Thomas):
        - Add optional try_to_writeback hook for objects. Importantly we need
          to check if the object is even still shrinkable; in between us
          dropping the shrinker LRU lock and acquiring the object lock it could for
          example have been moved. Also we need to differentiate between
          "lazy" shrinking and the immediate writeback mode. Also later we need to
          handle objects which don't even have mm.pages, so bundling this into
          put_pages() would require somehow handling that edge case, hence
          just letting the ttm backend handle everything in try_to_writeback
          doesn't seem too bad.
      v3(Thomas):
        - Likely a bad idea to touch the object from the unpopulate hook,
          since it's not possible to hold a reference, without also creating
          circular dependency, so likely this is too fragile. For now just
          ensure we at least mark the pages as dirty/accessed when called from the
          shrinker on WILLNEED objects.
        - s/try_to_writeback/shrinker_release_pages, since this can do more
          than just writeback.
        - Get rid of do_backup boolean and just set the SWAPPED flag prior to
          calling unpopulate.
        - Keep shmem_tt as lowest priority for the TTM LRU bo_swapout walk, since
          these just get skipped anyway. We can try to come up with something
          better later.
      v4(Thomas):
        - s/PCI_DMA/DMA/. Also drop NO_KERNEL_MAPPING and NO_WARN, which
          apparently doesn't do anything with streaming mappings.
        - Just pass along the error for ->truncate, and assume nothing.
      Signed-off-by: NMatthew Auld <matthew.auld@intel.com>
      Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Oak Zeng <oak.zeng@intel.com>
      Reviewed-by: NThomas Hellström <thomas.hellstrom@linux.intel.com>
      Acked-by: NOak Zeng <oak.zeng@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20211018091055.1998191-2-matthew.auld@intel.com
      7ae03459
  6. 20 10月, 2021 1 次提交
  7. 05 10月, 2021 1 次提交
    • D
      drm/i915/pxp: interfaces for using protected objects · d3ac8d42
      Daniele Ceraolo Spurio 提交于
      This api allow user mode to create protected buffers and to mark
      contexts as making use of such objects. Only when using contexts
      marked in such a way is the execution guaranteed to work as expected.
      
      Contexts can only be marked as using protected content at creation time
      (i.e. the parameter is immutable) and they must be both bannable and not
      recoverable. Given that the protected session gets invalidated on
      suspend, contexts created this way hold a runtime pm wakeref until
      they're either destroyed or invalidated.
      
      All protected objects and contexts will be considered invalid when the
      PXP session is destroyed and all new submissions using them will be
      rejected. All intel contexts within the invalidated gem contexts will be
      marked banned. Userspace can detect that an invalidation has occurred via
      the RESET_STATS ioctl, where we report it the same way as a ban due to a
      hang.
      
      v5: squash patches, rebase on proto_ctx, update kerneldoc
      
      v6: rebase on obj create_ext changes
      
      v7: Use session counter to check if an object it valid, hold wakeref in
          context, don't add a new flag to RESET_STATS (Daniel)
      
      v8: don't increase guilty count for contexts banned during pxp
          invalidation (Rodrigo)
      
      v9: better comments, avoid wakeref put race between pxp_inval and
          context_close, add usage examples (Rodrigo)
      
      v10: modify internal set/get-protected-context functions to not
           return -ENODEV when setting PXP param to false or getting param
           when running on pxp-unsupported hw or getting param when i915
           was built with CONFIG_PXP off
      Signed-off-by: NAlan Previn <alan.previn.teres.alexis@intel.com>
      Signed-off-by: NDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Signed-off-by: NBommu Krishnaiah <krishnaiah.bommu@intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210924191452.1539378-11-alan.previn.teres.alexis@intel.com
      d3ac8d42
  8. 01 10月, 2021 1 次提交
    • T
      drm/i915/ttm: Rework object initialization slightly · 068396bb
      Thomas Hellström 提交于
      We may end up in i915_ttm_bo_destroy() in an error path before the
      object is fully initialized. In that case it's not correct to call
      __i915_gem_free_object(), because that function
      a) Assumes the gem object refcount is 0, which it isn't.
      b) frees the placements which are owned by the caller until the
      init_object() region ops returns successfully. Fix this by providing
      a lightweight cleanup function __i915_gem_object_fini() which is also
      called by __i915_gem_free_object().
      
      While doing this, also make sure we call dma_resv_fini() as part of
      ordinary object destruction and not from the RCU callback that frees
      the object. This will help track down bugs where the object is incorrectly
      locked from an RCU lookup.
      
      Finally, make sure the object isn't put on the region list until it's
      either locked or fully initialized in order to block list processing of
      partially initialized objects.
      
      v2:
      - The TTM object backend memory was freed before the gem pages were
        put. Separate this functionality into __i915_gem_object_pages_fini()
        and call it from the TTM delete_mem_notify() callback.
      v3:
      - Include i915_gem_object_free_mmaps() in __i915_gem_object_pages_fini()
        to make sure we don't inadvertedly introduce a race.
      
      Fixes: 48b09612 ("drm/i915: Move __i915_gem_free_object to ttm_bo_destroy")
      Signed-off-by: NThomas Hellström <thomas.hellstrom@linux.intel.com>
      Reviewed-by: Matthew Auld <matthew.auld@intel.com> #v1
      Link: https://patchwork.freedesktop.org/patch/msgid/20210930113236.583531-1-thomas.hellstrom@linux.intel.com
      068396bb
  9. 22 9月, 2021 1 次提交
  10. 28 7月, 2021 1 次提交
  11. 26 7月, 2021 1 次提交
  12. 17 7月, 2021 1 次提交
  13. 09 7月, 2021 1 次提交
  14. 30 6月, 2021 2 次提交
  15. 25 6月, 2021 1 次提交
  16. 17 6月, 2021 2 次提交
  17. 14 6月, 2021 1 次提交
  18. 11 6月, 2021 3 次提交
  19. 06 6月, 2021 1 次提交
  20. 25 3月, 2021 11 次提交
  21. 24 3月, 2021 4 次提交