12 Feb, 2019

1 commit


05 Jun, 2018

1 commit

  • commit 531beb067c6185aceabfdee0965234c6a8fd133b upstream.

    sg_table is being initialized and is never read before it is updated
    again later on, hence making the initialization redundant. Remove
    the initialization.

    Detected by clang scan-build:
    "warning: Value stored to 'sg_table' during its initialization is
    never read"

    Signed-off-by: Colin Ian King
    Reviewed-by: Chris Wilson
    Signed-off-by: Daniel Vetter
    Link: https://patchwork.freedesktop.org/patch/msgid/20170914230516.6056-1-colin.king@canonical.com
    Cc: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     

19 Mar, 2018

1 commit

  • [ Upstream commit 03e4e0a9e02cf703da331ff6cfd57d0be9bf5692 ]

    Ages ago Rob Clark noted,

    "Currently with fence-array, we have a potential deadlock situation. If
    we fence_add_callback() on an array-fence, the array-fence's lock is
    acquired first, and in it's ->enable_signaling() callback, it will install
    cbs on it's array-member fences, so the array-member's lock is acquired
    second.

    But in the signal path, the array-member's lock is acquired first, and
    the array-fence's lock acquired second."

    Rob proposed either extensive changes to dma-fence to unnest the
    fence-array signaling, or to defer the signaling onto a workqueue. This
    is a more refined version of the later, that should keep the latency
    of the fence signaling to a minimum by using an irq-work, which is
    executed asap.

    Reported-by: Rob Clark
    Suggested-by: Rob Clark
    References: 1476635975-21981-1-git-send-email-robdclark@gmail.com
    Signed-off-by: Chris Wilson
    Cc: Rob Clark
    Cc: Gustavo Padovan
    Cc: Sumit Semwal
    Cc: Christian König
    Reviewed-by: Christian König
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20171114162719.30958-1-chris@chris-wilson.co.uk
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Chris Wilson
     

22 Feb, 2018

1 commit

  • commit 5bffee867df7494ecd32c1e6ec4e8fc934c521b7 upstream.

    We need to set shared_count even if we already have a fence to wait for.

    v2: init i to -1 as well

    Signed-off-by: Christian König
    Cc: stable@vger.kernel.org
    Tested-by: Lyude Paul
    Reviewed-by: Lyude Paul
    Reviewed-by: Chris Wilson
    Signed-off-by: Alex Deucher
    Link: https://patchwork.freedesktop.org/patch/msgid/20180122200003.6665-1-christian.koenig@amd.com
    Signed-off-by: Greg Kroah-Hartman

    Christian König
     

10 Dec, 2017

1 commit

  • commit ea4d5a270b57fa8d4871f372ca9b97b7697fdfda upstream.

    To avoid hanging userspace components that might have been waiting on the
    active fences of the destroyed timeline we need to signal with error all
    remaining fences on such timeline.

    This restore the default behaviour of the Android sw_sync framework, which
    Android still relies on. It was broken on the dma fence conversion a few
    years ago and never fixed.

    v2: Do not bother with cleanup do the list (Chris Wilson)

    Reviewed-by: Chris Wilson
    Signed-off-by: Dominik Behr
    Signed-off-by: Gustavo Padovan
    Link: https://patchwork.freedesktop.org/patch/msgid/20170907190246.16425-2-gustavo@padovan.org
    Cc: Jisheng Zhang
    Signed-off-by: Greg Kroah-Hartman

    Dominik Behr
     

05 Dec, 2017

1 commit

  • commit 39e16ba16c147e662bf9fbcee9a99d70d420382f upstream.

    Stop requiring that the src reservation object is locked for this operation.

    Acked-by: Chunming Zhou
    Signed-off-by: Christian König
    Signed-off-by: Alex Deucher
    Link: https://patchwork.freedesktop.org/patch/msgid/1504551766-5093-1-git-send-email-deathsimple@vodafone.de
    Signed-off-by: Lyude Paul
    Signed-off-by: Greg Kroah-Hartman

    Christian König
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

10 Oct, 2017

1 commit

  • sync_file_ioctl_fence_info has a race between filling the status
    of the underlying fences and the overall status of the sync_file.
    If fence transitions in the time frame between its sync_fill_fence_info
    and the later dma_fence_is_signaled for the sync_file, the returned
    information is inconsistent showing non-signaled underlying fences but
    an overall signaled state.

    This patch changes sync_file_ioctl_fence_info to track what has been
    encoded and using that as the overall sync_file status.

    Tested-by: Vamsidhar Reddy Gaddam
    Signed-off-by: John Einar Reitan
    Cc: Sumit Semwal
    Cc: Gustavo Padovan
    Cc: dri-devel@lists.freedesktop.org
    Reviewed-by: Chris Wilson
    Signed-off-by: Gustavo Padovan
    Link: https://patchwork.freedesktop.org/patch/msgid/20171009134936.27219-1-john.reitan@arm.com

    John Einar Reitan
     

15 Aug, 2017

2 commits

  • With hardware resets in mind it is possible that all shared fences are
    signaled, but the exlusive isn't. Fix waiting for everything in this situation.

    v2: make sure we always wait for the exclusive fence

    Acked-by: Sumit Semwal
    Signed-off-by: Christian König
    Reviewed-by: Alex Deucher
    Reviewed-by: Chunming Zhou
    Signed-off-by: Alex Deucher
    Link: https://patchwork.freedesktop.org/patch/msgid/1502384509-10465-3-git-send-email-alexander.deucher@amd.com

    Christian König
     
  • Allows us to copy all the fences in a reservation object to another one.

    v2: handle NULL src_list

    Signed-off-by: Christian König
    Reviewed-by: Alex Deucher
    Signed-off-by: Alex Deucher
    Link: https://patchwork.freedesktop.org/patch/msgid/1502384509-10465-2-git-send-email-alexander.deucher@amd.com

    Christian König
     

10 Aug, 2017

1 commit


01 Aug, 2017

2 commits

  • If userspace already dropped its own reference by closing the sw_sync
    fence fd we might end up in a deadlock where
    dma_fence_is_signaled_locked() will trigger the release of the fence and
    thus try to hold the lock to remove the fence from the list.

    dma_fence_is_signaled_locked() tries to release/free the fence and hold
    the lock in the process.

    We fix that by changing the order operation and clean up the list and
    rb-tree first.

    v2: Drop fence get/put dance and manipulate the list first (Chris Wilson)

    Cc: Chris Wilson
    Signed-off-by: Gustavo Padovan
    Reviewed-by: Chris Wilson
    Link: https://patchwork.freedesktop.org/patch/msgid/20170729152217.8362-2-gustavo@padovan.org

    Gustavo Padovan
     
  • We are going to use timeline_fence_signaled() in a internal function in
    the next commit.

    Cc: Chris Wilson
    Signed-off-by: Gustavo Padovan
    Reviewed-by: Chris Wilson
    Link: https://patchwork.freedesktop.org/patch/msgid/20170729152217.8362-1-gustavo@padovan.org

    Gustavo Padovan
     

29 Jul, 2017

1 commit

  • Up until recently sync_file were create to export a single dma-fence to
    userspace, and so we could canabalise a bit insie dma-fence to mark
    whether or not we had enable polling for the sync_file itself. However,
    with the advent of syncobj, we do allow userspace to create multiple
    sync_files for a single dma-fence. (Similarly, that the sw-sync
    validation framework also started returning multiple sync-files wrapping
    a single dma-fence for a syncpt also triggering the problem.)

    This patch reverts my suggestion in commit e24165537312
    ("dma-buf/sync_file: only enable fence signalling on poll()") to use a
    single bit in the shared dma-fence and restores the sync_file->flags for
    tracking the bits individually.

    Reported-by: Gustavo Padovan
    Fixes: f1e8c67123cf ("dma-buf/sw-sync: Use an rbtree to sort fences in the timeline")
    Fixes: e9083420bbac ("drm: introduce sync objects (v4)")
    Signed-off-by: Chris Wilson
    Cc: Sumit Semwal
    Cc: Sean Paul
    Cc: Gustavo Padovan
    Cc: dri-devel@lists.freedesktop.org
    Cc: # v4.13-rc1+
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/20170728212951.7818-1-chris@chris-wilson.co.uk

    Chris Wilson
     

27 Jul, 2017

1 commit


26 Jul, 2017

1 commit

  • It makes debugging a massive pain.

    Signed-off-by: Daniel Vetter
    Cc: Sumit Semwal
    Cc: Gustavo Padovan
    Cc: linux-media@vger.kernel.org
    Cc: linaro-mm-sig@lists.linaro.org
    Reviewed-by: Lucas Stach
    Acked-by: Sumit Semwal
    Acked-by: Maarten Lankhorst
    Link: https://patchwork.freedesktop.org/patch/msgid/20170720125107.26693-1-daniel.vetter@ffwll.ch
    Signed-off-by: Daniel Vetter

    Daniel Vetter
     

17 Jul, 2017

1 commit


15 Jul, 2017

1 commit

  • [ 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:[] [] 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] [] i915_gem_request_retire+0x1cd/0x230
    [ 236.902439] [] i915_gem_request_alloc+0xa3/0x2f0
    [ 236.906435] [] i915_gem_do_execbuffer.isra.41+0xb6d/0x18b0
    [ 236.910434] [] i915_gem_execbuffer2+0x95/0x1e0
    [ 236.914390] [] drm_ioctl+0x1e5/0x460
    [ 236.918275] [] do_vfs_ioctl+0x8f/0x5c0
    [ 236.922168] [] SyS_ioctl+0x3c/0x70
    [ 236.926090] [] entry_SYSCALL_64_fastpath+0x17/0x93
    [ 236.930045] [] 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: Chris Wilson
    Cc: Sumit Semwal
    Cc: Gustavo Padovan
    Cc: Daniel Vetter
    Reported-by: Rafael Antognolli
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/20170214124001.1930-1-chris@chris-wilson.co.uk

    Chris Wilson
     

30 Jun, 2017

6 commits

  • Reduce the list iteration when incrementing the timeline by storing the
    fences in increasing order.

    v2: Prevent spinlock recursion on free during create
    v3: Fixup rebase conflict inside comments that escaped the compiler.

    Signed-off-by: Chris Wilson
    Cc: Sumit Semwal
    Cc: Sean Paul
    Cc: Gustavo Padovan
    Reviewed-by: Sean Paul
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/20170629211253.22766-1-chris@chris-wilson.co.uk

    Chris Wilson
     
  • The sync_pt were not adding themselves atomically to the timeline lists,
    corruption imminent. Only a single list is required to track the
    unsignaled sync_pt, so reduce it and rename the lock more appropriately
    along with using idiomatic names to distinguish a list from links along
    it.

    v2: Prevent spinlock recursion on free during create (next patch) and
    fixup crossref in kerneldoc

    Signed-off-by: Chris Wilson
    Cc: Sumit Semwal
    Cc: Sean Paul
    Cc: Gustavo Padovan
    Reviewed-by: Sean Paul
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/20170629210532.5617-1-chris@chris-wilson.co.uk

    Chris Wilson
     
  • Since sync_pt is only allocated from a single location and is no longer
    the base class for fences (that is struct dma_fence) it no longer needs
    a generic unsized allocator.

    Signed-off-by: Chris Wilson
    Cc: Sumit Semwal
    Cc: Sean Paul
    Cc: Gustavo Padovan
    Reviewed-by: Sean Paul
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/20170629125930.821-5-chris@chris-wilson.co.uk

    Chris Wilson
     
  • If we know the context under which we are called, then we can use the
    simpler form of spin_lock_irq (saving the save/restore).

    Signed-off-by: Chris Wilson
    Cc: Sumit Semwal
    Cc: Sean Paul
    Cc: Gustavo Padovan
    Reviewed-by: Sean Paul
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/20170629125930.821-4-chris@chris-wilson.co.uk

    Chris Wilson
     
  • The timeline is u32, which limits any single advance to INT_MAX so that
    we can detect all fences that need signaling.

    Signed-off-by: Chris Wilson
    Cc: Sumit Semwal
    Cc: Sean Paul
    Cc: Gustavo Padovan
    Reviewed-by: Sean Paul
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/20170629125930.821-3-chris@chris-wilson.co.uk

    Chris Wilson
     
  • Use the canonical __dma_fence_is_later() to compare the fence seqno
    against the timeline seqno to check if the fence is signaled.

    Signed-off-by: Chris Wilson
    Cc: Sumit Semwal
    Cc: Sean Paul
    Cc: Gustavo Padovan
    Reviewed-by: Sean Paul
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/20170629125930.821-2-chris@chris-wilson.co.uk

    Chris Wilson
     

25 May, 2017

1 commit

  • 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: Chris Wilson
    Cc: Sumit Semwal
    Cc: Gustavo Padovan
    Cc: Daniel Vetter
    Cc: David Herrmann
    Reviewed-by: Daniel Vetter
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/20170516111042.24719-1-chris@chris-wilson.co.uk

    Chris Wilson
     

08 May, 2017

4 commits


04 May, 2017

1 commit


28 Apr, 2017

1 commit

  • When a timeout of zero is specified, the caller is only interested in
    the fence status.

    In the current implementation, dma_fence_default_wait will always call
    schedule_timeout() at least once for an unsignaled fence. This adds a
    significant overhead to a fence status query.

    Avoid this overhead by returning early if a zero timeout is specified.

    v2: move early return after enable_signaling

    Signed-off-by: Andres Rodriguez
    Reviewed-by: Christian König
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/20170426144620.3560-1-andresx7@gmail.com

    Andres Rodriguez
     

20 Apr, 2017

1 commit

  • Seeing the kunmap_atomic dma_buf_ops share the same name with a macro
    in highmem.h, the former can be aliased if any dma-buf user includes
    that header.

    I'm personally trying to include highmem.h inside scatterlist.h and this
    breaks the dma-buf code proper.

    Christoph Hellwig suggested [1] renaming it and pushing this patch ASAP.

    To maintain consistency I've renamed all four of kmap* and kunmap* to be
    map* and unmap*. (Even though only kmap_atomic presently conflicts.)

    [1] https://www.spinics.net/lists/target-devel/msg15070.html

    Signed-off-by: Logan Gunthorpe
    Reviewed-by: Sinclair Yeh
    Acked-by: Daniel Vetter
    Acked-by: Sumit Semwal
    Signed-off-by: Sumit Semwal
    Link: http://patchwork.freedesktop.org/patch/msgid/1492630570-879-1-git-send-email-logang@deltatee.com

    Logan Gunthorpe
     

18 Apr, 2017

1 commit

  • sync_file uses the reference count of the file, the internal
    kref was never getting moved past 1.

    We can reintroduce this if we decide we need it later.

    [airlied: fix buildbot warnings]

    Reviewed-by: Chris Wilson
    Signed-off-by: Dave Airlie
    Acked-by: Sumit Semwal
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/20170413014144.637-2-airlied@gmail.com

    Dave Airlie
     

04 Apr, 2017

1 commit

  • Align the heading with the values output from debugfs.

    Signed-off-by: Russell King
    Signed-off-by: Sumit Semwal
    Link: http://patchwork.freedesktop.org/patch/msgid/E1cttOq-0006GX-U7@rmk-PC.armlinux.org.uk

    Russell King
     

31 Mar, 2017

1 commit

  • Add debugfs output to report shared and exclusive fences on a dma_buf
    object. This produces output such as:

    Dma-buf Objects:
    size flags mode count exp_name
    08294400 00000000 00000005 00000005 drm
    Exclusive fence: etnaviv 134000.gpu signalled
    Attached Devices:
    gpu-subsystem
    Total 1 devices attached

    Total 1 objects, 8294400 bytes

    Signed-off-by: Russell King
    Reviewed-by: Christian König
    Signed-off-by: Gustavo Padovan
    Link: http://patchwork.freedesktop.org/patch/msgid/E1cttMI-00068z-3X@rmk-PC.armlinux.org.uk

    Russell King
     

18 Mar, 2017

1 commit

  • Add a helper to check if all fences in a fence array are from a given
    context. For convenience, the function can also handle being given a
    non-array fence.

    Signed-off-by: Philipp Zabel
    Reviewed-by: Gustavo Padovan
    Acked-by: Sumit Semwal
    Signed-off-by: Sumit Semwal
    Link: http://patchwork.freedesktop.org/patch/msgid/1489768492-25190-1-git-send-email-p.zabel@pengutronix.de

    Philipp Zabel
     

14 Mar, 2017

1 commit


02 Mar, 2017

1 commit


27 Feb, 2017

1 commit

  • Add compat ioctl support to dma-buf. This lets one to use DMA_BUF_IOCTL_SYNC
    ioctl from 32bit application on 64bit kernel. Data structures for both 32
    and 64bit modes are same, so there is no need for additional translation
    layer.

    Signed-off-by: Marek Szyprowski
    Reviewed-by: Christian König
    Acked-by: Daniel Vetter
    Signed-off-by: Sumit Semwal
    Link: http://patchwork.freedesktop.org/patch/msgid/1487683261-2655-1-git-send-email-m.szyprowski@samsung.com

    Marek Szyprowski
     

16 Feb, 2017

1 commit