An error occurred fetching the project authors.
  1. 04 May, 2022 1 commit
  2. 07 Mar, 2022 1 commit
  3. 28 Feb, 2022 1 commit
    • Thomas Hellström's avatar
      drm/i915: Clarify vma lifetime · c03d9826
      Thomas Hellström authored
      It's unclear what reference the initial vma kref reference refers to.
      A vma can have multiple weak references, the object vma list,
      the vm's bound list and the GT's closed_list, and the initial vma
      reference can be put from lookups of all these lists.
      
      With the current implementation this means
      that any holder of yet another vma refcount (currently only
      i915_gem_object_unbind()) needs to be holding two of either
      *) An object refcount,
      *) A vm open count
      *) A vma open count
      
      in order for us to not risk leaking a reference by having the
      initial vma reference being put twice.
      
      Address this by re-introducing i915_vma_destroy() which removes all
      weak references of the vma and *then* puts the initial vma refcount.
      This makes a strong vma reference hold on to the vma unconditionally.
      
      Perhaps a better name would be i915_vma_revoke() or i915_vma_zombify(),
      since other callers may still hold a refcount, but with the prospect of
      being able to replace the vma refcount with the object lock in the near
      future, let's stick with i915_vma_destroy().
      
      Finally this commit fixes a race in that previously i915_vma_release() and
      now i915_vma_destroy() could destroy a vma without taking the vm->mutex
      after an advisory check that the vma mm_node was not allocated.
      This would race with the ungrab_vma() function creating a trace similar
      to the below one. This was fixed in one of the __i915_vma_put() callsites
      in
      commit bc1922e5 ("drm/i915: Fix a race between vma / object destruction and unbinding")
      but although not seemingly triggered by CI, that
      is not sufficient. This patch is needed to fix that properly.
      
      [823.012188] Console: switching to colour dummy device 80x25
      [823.012422] [IGT] gem_ppgtt: executing
      [823.016667] [IGT] gem_ppgtt: starting subtest blt-vs-render-ctx0
      [852.436465] stack segment: 0000 [#1] PREEMPT SMP NOPTI
      [852.436480] CPU: 0 PID: 3200 Comm: gem_ppgtt Not tainted 5.16.0-CI-CI_DRM_11115+ #1
      [852.436489] Hardware name: Intel Corporation Alder Lake Client Platform/AlderLake-P DDR5 RVP, BIOS ADLPFWI1.R00.2422.A00.2110131104 10/13/2021
      [852.436499] RIP: 0010:ungrab_vma+0x9/0x80 [i915]
      [852.436711] Code: ef e8 4b 85 cf e0 e8 36 a3 d6 e0 8b 83 f8 9c 00 00 85 c0 75 e1 5b 5d 41 5c 41 5d c3 e9 d6 fd 14 00 55 53 48 8b af c0 00 00 00 <8b> 45 00 85 c0 75 03 5b 5d c3 48 8b 85 a0 02 00 00 48 89 fb 48 8b
      [852.436727] RSP: 0018:ffffc90006db7880 EFLAGS: 00010246
      [852.436734] RAX: 0000000000000000 RBX: ffffc90006db7598 RCX: 0000000000000000
      [852.436742] RDX: ffff88815349e898 RSI: ffff88815349e858 RDI: ffff88810a284140
      [852.436748] RBP: 6b6b6b6b6b6b6b6b R08: ffff88815349e898 R09: ffff88815349e8e8
      [852.436754] R10: 0000000000000001 R11: 0000000051ef1141 R12: ffff88810a284140
      [852.436762] R13: 0000000000000000 R14: ffff88815349e868 R15: ffff88810a284458
      [852.436770] FS:  00007f5c04b04e40(0000) GS:ffff88849f000000(0000) knlGS:0000000000000000
      [852.436781] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [852.436788] CR2: 00007f5c04b38fe0 CR3: 000000010a6e8001 CR4: 0000000000770ef0
      [852.436797] PKRU: 55555554
      [852.436801] Call Trace:
      [852.436806]  <TASK>
      [852.436811]  i915_gem_evict_for_node+0x33c/0x3c0 [i915]
      [852.437014]  i915_gem_gtt_reserve+0x106/0x130 [i915]
      [852.437211]  i915_vma_pin_ww+0x8f4/0xb60 [i915]
      [852.437412]  eb_validate_vmas+0x688/0x860 [i915]
      [852.437596]  i915_gem_do_execbuffer+0xc0e/0x25b0 [i915]
      [852.437770]  ? deactivate_slab+0x5f2/0x7d0
      [852.437778]  ? _raw_spin_unlock_irqrestore+0x50/0x60
      [852.437789]  ? i915_gem_execbuffer2_ioctl+0xc6/0x2c0 [i915]
      [852.437944]  ? init_object+0x49/0x80
      [852.437950]  ? __lock_acquire+0x5e6/0x2580
      [852.437963]  i915_gem_execbuffer2_ioctl+0x116/0x2c0 [i915]
      [852.438129]  ? i915_gem_do_execbuffer+0x25b0/0x25b0 [i915]
      [852.438300]  drm_ioctl_kernel+0xac/0x140
      [852.438310]  drm_ioctl+0x201/0x3d0
      [852.438316]  ? i915_gem_do_execbuffer+0x25b0/0x25b0 [i915]
      [852.438490]  __x64_sys_ioctl+0x6a/0xa0
      [852.438498]  do_syscall_64+0x37/0xb0
      [852.438507]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [852.438515] RIP: 0033:0x7f5c0415b317
      [852.438523] Code: b3 66 90 48 8b 05 71 4b 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 41 4b 2d 00 f7 d8 64 89 01 48
      [852.438542] RSP: 002b:00007ffd765039a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
      [852.438553] RAX: ffffffffffffffda RBX: 000055e4d7829dd0 RCX: 00007f5c0415b317
      [852.438562] RDX: 00007ffd76503a00 RSI: 00000000c0406469 RDI: 0000000000000017
      [852.438571] RBP: 00007ffd76503a00 R08: 0000000000000000 R09: 0000000000000081
      [852.438579] R10: 00000000ffffff7f R11: 0000000000000246 R12: 00000000c0406469
      [852.438587] R13: 0000000000000017 R14: 00007ffd76503a00 R15: 0000000000000000
      [852.438598]  </TASK>
      [852.438602] Modules linked in: snd_hda_codec_hdmi i915 mei_hdcp x86_pkg_temp_thermal snd_hda_intel snd_intel_dspcfg drm_buddy coretemp crct10dif_pclmul crc32_pclmul snd_hda_codec ttm ghash_clmulni_intel snd_hwdep snd_hda_core e1000e drm_dp_helper ptp snd_pcm mei_me drm_kms_helper pps_core mei syscopyarea sysfillrect sysimgblt fb_sys_fops prime_numbers intel_lpss_pci smsc75xx usbnet mii
      [852.440310] ---[ end trace e52cdd2fe4fd911c ]---
      
      v2: Fix typos in the commit message.
      
      Fixes: 7e00897b ("drm/i915: Add object locking to i915_gem_evict_for_node and i915_gem_evict_something, v2.")
      Fixes: bc1922e5 ("drm/i915: Fix a race between vma / object destruction and unbinding")
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      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/20220222133209.587978-1-thomas.hellstrom@linux.intel.com
      c03d9826
  4. 18 Jan, 2022 1 commit
  5. 11 Jan, 2022 3 commits
    • Thomas Hellström's avatar
      drm/i915: Use vma resources for async unbinding · 2f6b90da
      Thomas Hellström authored
      Implement async (non-blocking) unbinding by not syncing the vma before
      calling unbind on the vma_resource.
      Add the resulting unbind fence to the object's dma_resv from where it is
      picked up by the ttm migration code.
      Ideally these unbind fences should be coalesced with the migration blit
      fence to avoid stalling the migration blit waiting for unbind, as they
      can certainly go on in parallel, but since we don't yet have a
      reasonable data structure to use to coalesce fences and attach the
      resulting fence to a timeline, we defer that for now.
      
      Note that with async unbinding, even while the unbind waits for the
      preceding bind to complete before unbinding, the vma itself might have been
      destroyed in the process, clearing the vma pages. Therefore we can
      only allow async unbinding if we have a refcounted sg-list and keep a
      refcount on that for the vma resource pages to stay intact until
      binding occurs. If this condition is not met, a request for an async
      unbind is diverted to a sync unbind.
      
      v2:
      - Use a separate kmem_cache for vma resources for now to isolate their
        memory allocation and aid debugging.
      - Move the check for vm closed to the actual unbinding thread. Regardless
        of whether the vm is closed, we need the unbind fence to properly wait
        for capture.
      - Clear vma_res::vm on unbind and update its documentation.
      v4:
      - Take cache coloring into account when searching for vma resources
        pending unbind. (Matthew Auld)
      v5:
      - Fix timeout and error check in i915_vma_resource_bind_dep_await().
      - Avoid taking a reference on the object for async binding if
        async unbind capable.
      - Fix braces around a single-line if statement.
      v6:
      - Fix up the cache coloring adjustment. (Kernel test robot <lkp@intel.com>)
      - Don't allow async unbinding if the vma_res pages are not the same as
        the object pages. (Matthew Auld)
      v7:
      - s/unsigned long/u64/ in a number of places (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/20220110172219.107131-5-thomas.hellstrom@linux.intel.com
      2f6b90da
    • Thomas Hellström's avatar
      drm/i915: Use the vma resource as argument for gtt binding / unbinding · 39a2bd34
      Thomas Hellström authored
      When introducing asynchronous unbinding, the vma itself may no longer
      be alive when the actual binding or unbinding takes place.
      
      Update the gtt i915_vma_ops accordingly to take a struct i915_vma_resource
      instead of a struct i915_vma for the bind_vma() and unbind_vma() ops.
      Similarly change the insert_entries() op for struct i915_address_space.
      
      Replace a couple of i915_vma_snapshot members with their newly introduced
      i915_vma_resource counterparts, since they have the same lifetime.
      
      Also make sure to avoid changing the struct i915_vma_flags (in particular
      the bind flags) async. That should now only be done sync under the
      vm mutex.
      
      v2:
      - Update the vma_res::bound_flags when binding to the aliased ggtt
      v6:
      - Remove I915_VMA_ALLOC_BIT (Matthew Auld)
      - Change some members of struct i915_vma_resource from unsigned long to u64
        (Matthew Auld)
      v7:
      - Fix vma resource size parameters to be u64 rather than unsigned long
        (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/20220110172219.107131-3-thomas.hellstrom@linux.intel.com
      39a2bd34
    • Thomas Hellström's avatar
      drm/i915: Initial introduction of vma resources · e1a4bbb6
      Thomas Hellström authored
      Introduce vma resources, sort of similar to TTM resources,  needed for
      asynchronous bind management. Initially we will use them to hold
      completion of unbinding when we capture data from a vma, but they will
      be used extensively in upcoming patches for asynchronous vma unbinding.
      
      v6:
      - Some documentation updates
      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/20220110172219.107131-2-thomas.hellstrom@linux.intel.com
      e1a4bbb6
  6. 20 Dec, 2021 2 commits
  7. 19 Nov, 2021 2 commits
  8. 15 Oct, 2021 1 commit
    • Matthew Brost's avatar
      drm/i915: Multi-BB execbuf · 544460c3
      Matthew Brost authored
      Allow multiple batch buffers to be submitted in a single execbuf IOCTL
      after a context has been configured with the 'set_parallel' extension.
      The number batches is implicit based on the contexts configuration.
      
      This is implemented with a series of loops. First a loop is used to find
      all the batches, a loop to pin all the HW contexts, a loop to create all
      the requests, a loop to submit (emit BB start, etc...) all the requests,
      a loop to tie the requests to the VMAs they touch, and finally a loop to
      commit the requests to the backend.
      
      A composite fence is also created for the generated requests to return
      to the user and to stick in dma resv slots.
      
      No behavior from the existing IOCTL should be changed aside from when
      throttling because the ring for a context is full. In this situation,
      i915 will now wait while holding the object locks. This change was done
      because the code is much simpler to wait while holding the locks and we
      believe there isn't a huge benefit of dropping these locks. If this
      proves false we can restructure the code to drop the locks during the
      wait.
      
      IGT: https://patchwork.freedesktop.org/patch/447008/?series=93071&rev=1
      media UMD: https://github.com/intel/media-driver/pull/1252
      
      v2:
       (Matthew Brost)
        - Return proper error value if i915_request_create fails
      v3:
       (John Harrison)
        - Add comment explaining create / add order loops + locking
        - Update commit message explaining different in IOCTL behavior
        - Line wrap some comments
        - eb_add_request returns void
        - Return -EINVAL rather triggering BUG_ON if cmd parser used
       (Checkpatch)
        - Check eb->batch_len[*current_batch]
      v4:
       (CI)
        - Set batch len if passed if via execbuf args
        - Call __i915_request_skip after __i915_request_commit
       (Kernel test robot)
        - Initialize rq to NULL in eb_pin_timeline
      v5:
       (John Harrison)
        - Fix typo in comments near bb order loops
      Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
      Reviewed-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
      Signed-off-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20211014172005.27155-21-matthew.brost@intel.com
      544460c3
  9. 28 Jul, 2021 1 commit
  10. 03 Jun, 2021 1 commit
  11. 25 May, 2021 2 commits
  12. 24 Mar, 2021 3 commits
  13. 20 Jan, 2021 1 commit
  14. 07 Sep, 2020 1 commit
  15. 28 May, 2020 1 commit
  16. 01 Apr, 2020 1 commit
  17. 16 Mar, 2020 2 commits
  18. 30 Jan, 2020 1 commit
  19. 07 Jan, 2020 1 commit
  20. 23 Dec, 2019 1 commit
  21. 05 Dec, 2019 1 commit
  22. 04 Dec, 2019 1 commit
  23. 21 Oct, 2019 1 commit
  24. 04 Oct, 2019 3 commits
  25. 11 Sep, 2019 1 commit
  26. 09 Sep, 2019 2 commits
  27. 22 Aug, 2019 2 commits
  28. 20 Aug, 2019 1 commit