1. 26 7月, 2021 1 次提交
  2. 22 7月, 2021 1 次提交
    • D
      drm/i915: Ditch i915 globals shrink infrastructure · 4f62a7e0
      Daniel Vetter 提交于
      This essentially reverts
      
      commit 84a10749
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Wed Jan 24 11:36:08 2018 +0000
      
          drm/i915: Shrink the GEM kmem_caches upon idling
      
      mm/vmscan.c:do_shrink_slab() is a thing, if there's an issue with it
      then we need to fix that there, not hand-roll our own slab shrinking
      code in i915.
      
      Also when this was added there was only one other caller of
      kmem_cache_shrink (added 2005 to the acpi code). Now there's a 2nd one
      outside of i915 code in a kunit test, which seems legit since that
      wants to very carefully control what's in the kmem_cache. This out of
      a total of over 500 calls to kmem_cache_create. This alone should have
      been warning sign enough that we're doing something silly.
      
      Noticed while reviewing a patch set from Jason to fix up some issues
      in our i915_init() and i915_exit() module load/cleanup code. Now that
      i915_globals.c isn't any different than normal init/exit functions, we
      should convert them over to one unified table and remove
      i915_globals.[hc] entirely.
      
      v2: Improve commit message (Jason)
      Reviewed-by: NJason Ekstrand <jason@jlekstrand.net>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210721183229.4136488-1-daniel.vetter@ffwll.ch
      4f62a7e0
  3. 09 7月, 2021 1 次提交
  4. 30 6月, 2021 2 次提交
  5. 25 6月, 2021 1 次提交
  6. 11 6月, 2021 2 次提交
  7. 02 6月, 2021 1 次提交
  8. 01 6月, 2021 1 次提交
  9. 04 5月, 2021 1 次提交
    • M
      drm/i915/uapi: implement object placement extension · 2459e56f
      Matthew Auld 提交于
      Add new extension to support setting an immutable-priority-list of
      potential placements, at creation time.
      
      If we use the normal gem_create or gem_create_ext without the
      extensions/placements then we still get the old behaviour with only
      placing the object in system memory.
      
      v2(Daniel & Jason):
          - Add a bunch of kernel-doc
          - Simplify design for placements extension
      
      Testcase: igt/gem_create/create-ext-placement-sanity-check
      Testcase: igt/gem_create/create-ext-placement-each
      Testcase: igt/gem_create/create-ext-placement-all
      Signed-off-by: NMatthew Auld <matthew.auld@intel.com>
      Signed-off-by: NCQ Tang <cq.tang@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Cc: Jordan Justen <jordan.l.justen@intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: mesa-dev@lists.freedesktop.org
      Reviewed-by: NKenneth Graunke <kenneth@whitecape.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210429103056.407067-6-matthew.auld@intel.com
      2459e56f
  10. 25 3月, 2021 2 次提交
  11. 24 3月, 2021 1 次提交
  12. 22 1月, 2021 1 次提交
    • I
      drm/i915/gem: Add a helper to read data from a GEM object page · 5fbc2c2b
      Imre Deak 提交于
      Add a simple helper to read data with the CPU from the page of a GEM
      object. Do the read either via a kmap if the object has struct pages
      or an iomap otherwise. This is needed by the next patch, reading a u64
      value from the object (w/o requiring the obj to be mapped to the GPU).
      
      Suggested by Chris.
      
      v2 (Chris):
      - Sanitize the type and order of func params.
      - Avoid consts requiring too many casts.
      - Use BUG_ON instead of WARN_ON, simplify the conditions.
      - Fix __iomem sparse errors.
      - Leave locking/syncing/pinning up to the caller, require only that the
        caller has pinned the object pages.
      - Check for iomem backing store before reading via an iomap.
      v3:
      - Fix offset passed to io_mapping_map_wc() missing a mem.region.start
        delta. (Chris, Matthew)
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Matthew Auld <matthew.william.auld@gmail.com>
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210120213834.1435710-1-imre.deak@intel.com
      5fbc2c2b
  13. 20 1月, 2021 1 次提交
  14. 06 10月, 2020 1 次提交
    • T
      drm/i915: Fix DMA mapped scatterlist lookup · 934941ed
      Tvrtko Ursulin 提交于
      As the previous patch fixed the places where we walk the whole scatterlist
      for DMA addresses, this patch fixes the random lookup functionality.
      
      To achieve this we have to add a second lookup iterator and add a
      i915_gem_object_get_sg_dma helper, to be used analoguous to existing
      i915_gem_object_get_sg_dma. Therefore two lookup caches are maintained per
      object and they are flushed at the same point for simplicity. (Strictly
      speaking the DMA cache should be flushed from i915_gem_gtt_finish_pages,
      but today this conincides with unsetting of the pages in general.)
      
      Partial VMA view is then fixed to use the new DMA lookup and properly
      query sg length.
      
      v2:
       * Checkpatch.
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Matthew Auld <matthew.auld@intel.com>
      Cc: Lu Baolu <baolu.lu@linux.intel.com>
      Cc: Tom Murphy <murphyt7@tcd.ie>
      Cc: Logan Gunthorpe <logang@deltatee.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201006092508.1064287-2-tvrtko.ursulin@linux.intel.com
      934941ed
  15. 25 9月, 2020 1 次提交
  16. 03 7月, 2020 2 次提交
  17. 01 7月, 2020 1 次提交
  18. 30 5月, 2020 2 次提交
  19. 04 5月, 2020 1 次提交
  20. 24 4月, 2020 1 次提交
  21. 02 4月, 2020 1 次提交
  22. 02 3月, 2020 1 次提交
  23. 22 2月, 2020 1 次提交
  24. 11 2月, 2020 1 次提交
  25. 20 1月, 2020 1 次提交
  26. 23 12月, 2019 2 次提交
  27. 18 12月, 2019 1 次提交
  28. 04 12月, 2019 1 次提交
  29. 19 11月, 2019 2 次提交
    • C
      drm/i915/gem: Protect the obj->vma.list during iteration · 53019779
      Chris Wilson 提交于
      Take the obj->vma.lock to prevent modifications to the list as we
      iterate, to avoid the dreaded NULL pointer.
      
      <1>[  347.820823] BUG: kernel NULL pointer dereference, address: 0000000000000150
      <1>[  347.820856] #PF: supervisor read access in kernel mode
      <1>[  347.820874] #PF: error_code(0x0000) - not-present page
      <6>[  347.820892] PGD 0 P4D 0
      <4>[  347.820908] Oops: 0000 [#1] PREEMPT SMP NOPTI
      <4>[  347.820926] CPU: 3 PID: 1303 Comm: gem_persistent_ Tainted: G     U            5.4.0-rc7-CI-CI_DRM_7352+ #1
      <4>[  347.820956] Hardware name:  /NUC6CAYB, BIOS AYAPLCEL.86A.0049.2018.0508.1356 05/08/2018
      <4>[  347.821132] RIP: 0010:i915_gem_object_flush_write_domain+0xd9/0x1d0 [i915]
      <4>[  347.821157] Code: 0f 84 e9 00 00 00 48 8b 80 e0 fd ff ff f6 c4 40 75 11 e9 ed 00 00 00 48 8b 80 e0 fd ff ff f6 c4 40 74 26 48 8b 83 b0 00 00 00 <48> 8b b8 50 01 00 00 e8 fb 20 fb ff 48 8b 83 30 03 00 00 49 39 c4
      <4>[  347.821210] RSP: 0018:ffffc90000a1f8f8 EFLAGS: 00010202
      <4>[  347.821229] RAX: 0000000000000000 RBX: ffffc900008479a0 RCX: 0000000000000018
      <4>[  347.821252] RDX: 0000000000000000 RSI: 000000000000000d RDI: ffff888275a090b0
      <4>[  347.821274] RBP: ffff8882673c8040 R08: ffff88825991b8d0 R09: 0000000000000000
      <4>[  347.821297] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8882673c8280
      <4>[  347.821319] R13: ffff8882673c8368 R14: 0000000000000000 R15: ffff888266a54000
      <4>[  347.821343] FS:  00007f75865f4240(0000) GS:ffff888277b80000(0000) knlGS:0000000000000000
      <4>[  347.821368] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      <4>[  347.821389] CR2: 0000000000000150 CR3: 000000025aee0000 CR4: 00000000003406e0
      <4>[  347.821411] Call Trace:
      <4>[  347.821555]  i915_gem_object_prepare_read+0xea/0x2a0 [i915]
      <4>[  347.821706]  intel_engine_cmd_parser+0x5ce/0xe90 [i915]
      <4>[  347.821834]  ? __i915_sw_fence_complete+0x1a0/0x250 [i915]
      <4>[  347.821990]  i915_gem_do_execbuffer+0xb4c/0x2550 [i915]
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191119100929.2628356-8-chris@chris-wilson.co.uk
      53019779
    • C
      drm/i915/gem: Merge GGTT vma flush into a single loop · 62d1c851
      Chris Wilson 提交于
      We only need the one loop to find the dirty vma flush them and their
      chipset.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191119100929.2628356-6-chris@chris-wilson.co.uk
      62d1c851
  30. 07 11月, 2019 1 次提交
    • D
      drm/i915: Switch obj->mm.lock lockdep annotations on its head · f86dbacb
      Daniel Vetter 提交于
      The trouble with having a plain nesting flag for locks which do not
      naturally nest (unlike block devices and their partitions, which is
      the original motivation for nesting levels) is that lockdep will
      never spot a true deadlock if you screw up.
      
      This patch is an attempt at trying better, by highlighting a bit more
      of the actual nature of the nesting that's going on. Essentially we
      have two kinds of objects:
      
      - objects without pages allocated, which cannot be on any lru and are
        hence inaccessible to the shrinker.
      
      - objects which have pages allocated, which are on an lru, and which
        the shrinker can decide to throw out.
      
      For the former type of object, memory allocations while holding
      obj->mm.lock are permissible. For the latter they are not. And
      get/put_pages transitions between the two types of objects.
      
      This is still not entirely fool-proof since the rules might change.
      But as long as we run such a code ever at runtime lockdep should be
      able to observe the inconsistency and complain (like with any other
      lockdep class that we've split up in multiple classes). But there are
      a few clear benefits:
      
      - We can drop the nesting flag parameter from
        __i915_gem_object_put_pages, because that function by definition is
        never going allocate memory, and calling it on an object which
        doesn't have its pages allocated would be a bug.
      
      - We strictly catch more bugs, since there's not only one place in the
        entire tree which is annotated with the special class. All the
        other places that had explicit lockdep nesting annotations we're now
        going to leave up to lockdep again.
      
      - Specifically this catches stuff like calling get_pages from
        put_pages (which isn't really a good idea, if we can call get_pages
        so could the shrinker). I've seen patches do exactly that.
      
      Of course I fully expect CI will show me for the fool I am with this
      one here :-)
      
      v2: There can only be one (lockdep only has a cache for the first
      subclass, not for deeper ones, and we don't want to make these locks
      even slower). Still separate enums for better documentation.
      
      Real fix: don't forget about phys objs and pin_map(), and fix the
      shrinker to have the right annotations ... silly me.
      
      v3: Forgot usertptr too ...
      
      v4: Improve comment for pages_pin_count, drop the IMPORTANT comment
      and instead prime lockdep (Chris).
      
      v5: Appease checkpatch, no double empty lines (Chris)
      
      v6: More rebasing over selftest changes. Also somehow I forgot to
      push this patch :-/
      
      Also format comments consistently while at it.
      
      v7: Fix typo in commit message (Joonas)
      
      Also drop the priming, with the lmem merge we now have allocations
      while holding the lmem lock, which wreaks the generic priming I've
      done in earlier patches. Should probably be resurrected when lmem is
      fixed. See
      
      commit 232a6eba
      Author: Matthew Auld <matthew.auld@intel.com>
      Date:   Tue Oct 8 17:01:14 2019 +0100
      
          drm/i915: introduce intel_memory_region
      
      I'm keeping the priming patch locally so it wont get lost.
      
      Cc: Matthew Auld <matthew.auld@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: "Tang, CQ" <cq.tang@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v5)
      Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v6)
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191105090148.30269-1-daniel.vetter@ffwll.ch
      [mlankhorst: Fix commit typos pointed out by Michael Ruhl]
      f86dbacb
  31. 22 10月, 2019 1 次提交
  32. 04 10月, 2019 1 次提交
    • C
      drm/i915: Pull i915_vma_pin under the vm->mutex · 2850748e
      Chris Wilson 提交于
      Replace the struct_mutex requirement for pinning the i915_vma with the
      local vm->mutex instead. Note that the vm->mutex is tainted by the
      shrinker (we require unbinding from inside fs-reclaim) and so we cannot
      allocate while holding that mutex. Instead we have to preallocate
      workers to do allocate and apply the PTE updates after we have we
      reserved their slot in the drm_mm (using fences to order the PTE writes
      with the GPU work and with later unbind).
      
      In adding the asynchronous vma binding, one subtle requirement is to
      avoid coupling the binding fence into the backing object->resv. That is
      the asynchronous binding only applies to the vma timeline itself and not
      to the pages as that is a more global timeline (the binding of one vma
      does not need to be ordered with another vma, nor does the implicit GEM
      fencing depend on a vma, only on writes to the backing store). Keeping
      the vma binding distinct from the backing store timelines is verified by
      a number of async gem_exec_fence and gem_exec_schedule tests. The way we
      do this is quite simple, we keep the fence for the vma binding separate
      and only wait on it as required, and never add it to the obj->resv
      itself.
      
      Another consequence in reducing the locking around the vma is the
      destruction of the vma is no longer globally serialised by struct_mutex.
      A natural solution would be to add a kref to i915_vma, but that requires
      decoupling the reference cycles, possibly by introducing a new
      i915_mm_pages object that is own by both obj->mm and vma->pages.
      However, we have not taken that route due to the overshadowing lmem/ttm
      discussions, and instead play a series of complicated games with
      trylocks to (hopefully) ensure that only one destruction path is called!
      
      v2: Add some commentary, and some helpers to reduce patch churn.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191004134015.13204-4-chris@chris-wilson.co.uk
      2850748e
  33. 11 9月, 2019 1 次提交