1. 03 12月, 2020 1 次提交
    • C
      drm/i915/gt: Protect context lifetime with RCU · 9261a1db
      Chris Wilson 提交于
      Allow a brief period for continued access to a dead intel_context by
      deferring the release of the struct until after an RCU grace period.
      As we are using a dedicated slab cache for the contexts, we can defer
      the release of the slab pages via RCU, with the caveat that individual
      structs may be reused from the freelist within an RCU grace period. To
      handle that, we have to avoid clearing members of the zombie struct.
      
      This is required for a later patch to handle locking around virtual
      requests in the signaler, as those requests may want to move between
      engines and be destroyed while we are holding b->irq_lock on a physical
      engine.
      
      v2: Drop mutex_reinit(), if we never mark the mutex as destroyed we
      don't need to reset the debug code, at the loss of having the mutex
      debug code spot us attempting to destroy a locked mutex.
      v3: As the intended use will remain strongly referenced counted, with
      very little inflight access across reuse, drop the ctor.
      v4: Drop the unrequired change to remove the temporary reference around
      dropping the active context, and add back some more missing ctor
      operations.
      v5: The ctor is back. Tvrtko spotted that ce->signal_lock [introduced
      later] maybe accessed under RCU and so needs special care not to be
      reinitialised.
      v6: Don't mix SLAB_TYPESAFE_BY_RCU and RCU list iteration.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201126140407.31952-3-chris@chris-wilson.co.uk
      (cherry picked from commit 14d1eaf0)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      9261a1db
  2. 01 12月, 2020 1 次提交
  3. 25 11月, 2020 4 次提交
  4. 20 11月, 2020 1 次提交
  5. 19 11月, 2020 1 次提交
  6. 17 11月, 2020 2 次提交
  7. 13 11月, 2020 1 次提交
  8. 04 11月, 2020 3 次提交
  9. 21 10月, 2020 2 次提交
  10. 20 10月, 2020 5 次提交
  11. 19 10月, 2020 1 次提交
    • C
      drm/i915: use vmap in shmem_pin_map · bfed6708
      Christoph Hellwig 提交于
      shmem_pin_map somewhat awkwardly reimplements vmap using alloc_vm_area and
      manual pte setup.  The only practical difference is that alloc_vm_area
      prefeaults the vmalloc area PTEs, which doesn't seem to be required here
      (and could be added to vmap using a flag if actually required).  Switch to
      use vmap, and use vfree to free both the vmalloc mapping and the page
      array, as well as dropping the references to each page.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Matthew Auld <matthew.auld@intel.com>
      Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Stefano Stabellini <sstabellini@kernel.org>
      Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
      Link: https://lkml.kernel.org/r/20201002122204.1534411-7-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      bfed6708
  12. 01 10月, 2020 4 次提交
  13. 21 9月, 2020 1 次提交
  14. 18 9月, 2020 1 次提交
  15. 16 9月, 2020 1 次提交
    • C
      drm/i915: Be wary of data races when reading the active execlists · b82a8b93
      Chris Wilson 提交于
      To implement preempt-to-busy (and so efficient timeslicing and best utilization
      of the hardware submission ports) we let the GPU run asynchronously in respect
      to the ELSP submission queue. This created challenges in keeping and accessing
      the driver state mirroring the asynchronous GPU execution.
      
      The latest occurence of this was spotted by KCSAN:
      
      [ 1413.563200] BUG: KCSAN: data-race in __await_execution+0x217/0x370 [i915]
      [ 1413.563221]
      [ 1413.563236] race at unknown origin, with read to 0xffff88885bb6c478 of 8 bytes by task 9654 on cpu 1:
      [ 1413.563548]  __await_execution+0x217/0x370 [i915]
      [ 1413.563891]  i915_request_await_dma_fence+0x4eb/0x6a0 [i915]
      [ 1413.564235]  i915_request_await_object+0x421/0x490 [i915]
      [ 1413.564577]  i915_gem_do_execbuffer+0x29b7/0x3c40 [i915]
      [ 1413.564967]  i915_gem_execbuffer2_ioctl+0x22f/0x5c0 [i915]
      [ 1413.564998]  drm_ioctl_kernel+0x156/0x1b0
      [ 1413.565022]  drm_ioctl+0x2ff/0x480
      [ 1413.565046]  __x64_sys_ioctl+0x87/0xd0
      [ 1413.565069]  do_syscall_64+0x4d/0x80
      [ 1413.565094]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      To complicate matters, we have to both avoid the read tearing of *active and
      avoid any write tearing as perform the pending[] -> inflight[] promotion of the
      execlists.
      
      This is because we cannot rely on the memcpy doing u64 aligned copies on all
      kernels/platforms and so we opt to open-code it with explicit WRITE_ONCE
      annotations to satisfy KCSAN.
      
      v2: When in doubt, write the same comment again.
      v3: Expanded commit message.
      
      Fixes: b55230e5 ("drm/i915: Check for awaits on still currently executing requests")
      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/20200716142207.13003-1-chris@chris-wilson.co.ukSigned-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      [Joonas: Rebased and reordered into drm-intel-gt-next branch]
      [Joonas: Added expanded commit message from Tvrtko and Chris]
      Signed-off-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      (cherry picked from commit b4d9145b)
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      b82a8b93
  16. 07 9月, 2020 11 次提交