1. 14 Jul, 2017 1 commit
    • Chris Wilson's avatar
      dma-buf/fence: Avoid use of uninitialised timestamp · 76250f2b
      Chris Wilson authored
      
      
      [  236.821534] WARNING: kmemcheck: Caught 64-bit read from uninitialized memory (ffff8802538683d0)
      [  236.828642] 420000001e7f0000000000000000000000080000000000000000000000000000
      [  236.839543]  i i i i u u u u i i i i i i i i u u u u u u u u u u u u u u u u
      [  236.850420]                                  ^
      [  236.854123] RIP: 0010:[<ffffffff81396f07>]  [<ffffffff81396f07>] fence_signal+0x17/0xd0
      [  236.861313] RSP: 0018:ffff88024acd7ba0  EFLAGS: 00010282
      [  236.865027] RAX: ffffffff812f6a90 RBX: ffff8802527ca800 RCX: ffff880252cb30e0
      [  236.868801] RDX: ffff88024ac5d918 RSI: ffff880252f780e0 RDI: ffff880253868380
      [  236.872579] RBP: ffff88024acd7bc0 R08: ffff88024acd7be0 R09: 0000000000000000
      [  236.876407] R10: 0000000000000000 R11: 0000000000000000 R12: ffff880253868380
      [  236.880185] R13: ffff8802538684d0 R14: ffff880253868380 R15: ffff88024cd48e00
      [  236.883983] FS:  00007f1646d1a740(0000) GS:ffff88025d000000(0000) knlGS:0000000000000000
      [  236.890959] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  236.894702] CR2: ffff880251360318 CR3: 000000024ad21000 CR4: 00000000001406f0
      [  236.898481]  [<ffffffff8130d1ad>] i915_gem_request_retire+0x1cd/0x230
      [  236.902439]  [<ffffffff8130e2b3>] i915_gem_request_alloc+0xa3/0x2f0
      [  236.906435]  [<ffffffff812fb1bd>] i915_gem_do_execbuffer.isra.41+0xb6d/0x18b0
      [  236.910434]  [<ffffffff812fc265>] i915_gem_execbuffer2+0x95/0x1e0
      [  236.914390]  [<ffffffff812ad625>] drm_ioctl+0x1e5/0x460
      [  236.918275]  [<ffffffff8110d4cf>] do_vfs_ioctl+0x8f/0x5c0
      [  236.922168]  [<ffffffff8110da3c>] SyS_ioctl+0x3c/0x70
      [  236.926090]  [<ffffffff814b7a5f>] entry_SYSCALL_64_fastpath+0x17/0x93
      [  236.930045]  [<ffffffffffffffff>] 0xffffffffffffffff
      
      We only set the timestamp before we mark the fence as signaled. It is
      done before to avoid observers having a window in which they may see the
      fence as complete but no timestamp. Having it does incur a potential for
      the timestamp to be written twice, and even for it to be corrupted if
      the u64 write is not atomic. Instead use a new bit to record the
      presence of the timestamp, and teach the readers to wait until it is set
      if the fence is complete. There still remains a race where the timestamp
      for the signaled fence may be shown before the fence is reported as
      signaled, but that's a pre-existing error.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Gustavo Padovan <gustavo@padovan.org>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Reported-by: default avatarRafael Antognolli <rafael.antognolli@intel.com>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170214124001.1930-1-chris@chris-wilson.co.uk
      76250f2b
  2. 24 May, 2017 1 commit
    • Chris Wilson's avatar
      dma-buf/sync-file: Defer creation of sync_file->name · 71ebc9a3
      Chris Wilson authored
      
      
      Constructing the name takes the majority of the time for allocating a
      sync_file to wrap a fence, and the name is very rarely used (only via
      the sync_file status user interface). To reduce the impact on the common
      path (that of creating sync_file to pass around), defer the construction
      of the name until it is first used.
      
      v2: Update kerneldoc (kbuild test robot)
      v3: sync_debug.c was peeking at the name
      v4: Comment upon the potential race between two users of
      sync_file_get_name() and claim that such a race is below the level of
      notice. However, to prevent any future nuisance, use a global spinlock
      to serialize the assignment of the name.
      v5: Completely avoid the read/write race by only storing the name passed
      in from the user inside sync_file->user_name and passing in a buffer to
      dynamically construct the name otherwise.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Gustavo Padovan <gustavo@padovan.org>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170516111042.24719-1-chris@chris-wilson.co.uk
      71ebc9a3
  3. 08 May, 2017 1 commit
  4. 09 Jan, 2017 1 commit
  5. 25 Oct, 2016 1 commit
    • Chris Wilson's avatar
      dma-buf: Rename struct fence to dma_fence · f54d1867
      Chris Wilson authored
      I plan to usurp the short name of struct fence for a core kernel struct,
      and so I need to rename the specialised fence/timeline for DMA
      operations to make room.
      
      A consensus was reached in
      https://lists.freedesktop.org/archives/dri-devel/2016-July/113083.html
      
      
      that making clear this fence applies to DMA operations was a good thing.
      Since then the patch has grown a bit as usage increases, so hopefully it
      remains a good thing!
      
      (v2...: rebase, rerun spatch)
      v3: Compile on msm, spotted a manual fixup that I broke.
      v4: Try again for msm, sorry Daniel
      
      coccinelle script:
      @@
      
      @@
      - struct fence
      + struct dma_fence
      @@
      
      @@
      - struct fence_ops
      + struct dma_fence_ops
      @@
      
      @@
      - struct fence_cb
      + struct dma_fence_cb
      @@
      
      @@
      - struct fence_array
      + struct dma_fence_array
      @@
      
      @@
      - enum fence_flag_bits
      + enum dma_fence_flag_bits
      @@
      
      @@
      (
      - fence_init
      + dma_fence_init
      |
      - fence_release
      + dma_fence_release
      |
      - fence_free
      + dma_fence_free
      |
      - fence_get
      + dma_fence_get
      |
      - fence_get_rcu
      + dma_fence_get_rcu
      |
      - fence_put
      + dma_fence_put
      |
      - fence_signal
      + dma_fence_signal
      |
      - fence_signal_locked
      + dma_fence_signal_locked
      |
      - fence_default_wait
      + dma_fence_default_wait
      |
      - fence_add_callback
      + dma_fence_add_callback
      |
      - fence_remove_callback
      + dma_fence_remove_callback
      |
      - fence_enable_sw_signaling
      + dma_fence_enable_sw_signaling
      |
      - fence_is_signaled_locked
      + dma_fence_is_signaled_locked
      |
      - fence_is_signaled
      + dma_fence_is_signaled
      |
      - fence_is_later
      + dma_fence_is_later
      |
      - fence_later
      + dma_fence_later
      |
      - fence_wait_timeout
      + dma_fence_wait_timeout
      |
      - fence_wait_any_timeout
      + dma_fence_wait_any_timeout
      |
      - fence_wait
      + dma_fence_wait
      |
      - fence_context_alloc
      + dma_fence_context_alloc
      |
      - fence_array_create
      + dma_fence_array_create
      |
      - to_fence_array
      + to_dma_fence_array
      |
      - fence_is_array
      + dma_fence_is_array
      |
      - trace_fence_emit
      + trace_dma_fence_emit
      |
      - FENCE_TRACE
      + DMA_FENCE_TRACE
      |
      - FENCE_WARN
      + DMA_FENCE_WARN
      |
      - FENCE_ERR
      + DMA_FENCE_ERR
      )
       (
       ...
       )
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Acked-by: default avatarSumit Semwal <sumit.semwal@linaro.org>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20161025120045.28839-1-chris@chris-wilson.co.uk
      f54d1867
  6. 15 Aug, 2016 2 commits
  7. 11 Aug, 2016 1 commit
    • Gustavo Padovan's avatar
      dma-buf/sync_file: refactor fence storage in struct sync_file · a02b9dc9
      Gustavo Padovan authored
      
      
      Create sync_file->fence to abstract the type of fence we are using for
      each sync_file. If only one fence is present we use a normal struct fence
      but if there is more fences to be added to the sync_file a fence_array
      is created.
      
      This change cleans up sync_file a bit. We don't need to have sync_file_cb
      array anymore. Instead, as we always have  one fence, only one fence
      callback is registered per sync_file.
      
      v2: Comments from Chris Wilson and Christian König
      	- Not using fence_ops anymore
      	- fence_is_array() was created to differentiate fence from fence_array
      	- fence_array_teardown() is now exported and used under fence_is_array()
      	- struct sync_file lost num_fences member
      
      v3: Comments from Chris Wilson and Christian König
      	- struct sync_file lost status member in favor of fence_is_signaled()
      	- drop use of fence_array_teardown()
      	- use sizeof(*fence) to allocate only an array on fence pointers
      
      v4: Comments from Chris Wilson
      	- use sizeof(*fence) to reallocate array
      	- fix typo in comments
      	- protect num_fences sum against overflows
      	- use array->base instead of casting the to struct fence
      
      v5: fixes checkpatch warnings
      
      v6: fix case where all fences are signaled.
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSumit Semwal <sumit.semwal@linaro.org>
      a02b9dc9
  8. 18 Jun, 2016 14 commits
  9. 30 Apr, 2016 4 commits
  10. 15 Feb, 2016 1 commit
    • Paul Gortmaker's avatar
      drivers/staging/android: don't use modular references in sync_debug.c · 9c583af9
      Paul Gortmaker authored
      In commit 8a004484
      
       ("staging/android:
      create a 'sync' dir for debugfs information"), modular references were
      introduced to this file.  However if we look, we find:
      
      drivers/staging/android/Makefile:obj-$(CONFIG_SYNC) += sync.o sync_debug.o
      
      drivers/staging/android/Kconfig:config SYNC
      drivers/staging/android/Kconfig:        bool "Synchronization framework"
      
      This file isn't currently buildable as a module, and hence the code
      for module_exit is just dead code.  Remove it and the module.h include.
      
      Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c583af9
  11. 08 Feb, 2016 7 commits
  12. 21 Dec, 2015 1 commit
  13. 18 Jan, 2015 1 commit
  14. 28 Oct, 2014 1 commit
  15. 12 Jul, 2014 1 commit
  16. 08 Jul, 2014 1 commit