Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1433020

Re: [RFC v2 2/3] dma-buf/fence-array: add fence_array_teardown()

From Gustavo Padovan <gustavo.padovan@collabora.com>
Newsgroups linux.kernel
Subject Re: [RFC v2 2/3] dma-buf/fence-array: add fence_array_teardown()
Date 2016-06-28 16:20 +0200
Message-ID <rP21P-8cR-13@gated-at.bofh.it> (permalink)
References <rOKoh-4ws-11@gated-at.bofh.it> <rOKxY-4Bc-29@gated-at.bofh.it> <rP21P-8cR-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


2016-06-28 Christian König <christian.koenig@amd.com>:

> Am 27.06.2016 um 21:29 schrieb Gustavo Padovan:
> > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > 
> > As the array of fence callbacks held by an active struct fence_array
> > each has a reference to the struct fence_array, when the owner of the
> > fence_array is freed it must dispose of the callback references before
> > it can free the fence_array. This can not happen simply during
> > fence_release() because of the extra references and so we need a new
> > function to run before the final fence_put().
> 
> As I said previously as well, this is completely superfluous.
> 
> The fence array keeps a reference to itself as long as not all callbacks are
> signaled.
> 
> So you only need to unregister your callback from the array itself and drop
> your reference when you don't need it any more in the sync file.

Exactly, this should be called from sync_file_free() because of the
following use case:

	1. You create 2 sync_file with 1 fence each
	2. Merge both fences, which creates a fence array
	3. Close the sync_file fd without waiting for the fences to
	signal

At this point you leak the fence-array because the final fence_put() 
does not release it because of the extra references from the non
signalled fences so we need to clean up this somehow.

	Gustavo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v2 0/3] dma-buf/sync_file: rework fences on struct sync_file Gustavo Padovan <gustavo@padovan.org> - 2016-06-27 21:30 +0200
  [RFC v2 1/3] dma-buf/fence-array: add fence_is_array() Gustavo Padovan <gustavo@padovan.org> - 2016-06-27 21:40 +0200
  [RFC v2 2/3] dma-buf/fence-array: add fence_array_teardown() Gustavo Padovan <gustavo@padovan.org> - 2016-06-27 21:40 +0200
    Re: [RFC v2 2/3] dma-buf/fence-array: add fence_array_teardown() Gustavo Padovan <gustavo.padovan@collabora.com> - 2016-06-28 16:20 +0200
      Re: [RFC v2 2/3] dma-buf/fence-array: add fence_array_teardown() Gustavo Padovan <gustavo.padovan@collabora.com> - 2016-06-28 17:20 +0200
  [RFC v2 3/3] dma-buf/sync_file: rework fence storage in struct file Gustavo Padovan <gustavo@padovan.org> - 2016-06-27 21:40 +0200
    Re: [RFC v2 3/3] dma-buf/sync_file: rework fence storage in struct  file Chris Wilson <chris@chris-wilson.co.uk> - 2016-06-28 10:10 +0200
      Re: [RFC v2 3/3] dma-buf/sync_file: rework fence storage in struct  file Gustavo Padovan <gustavo.padovan@collabora.com> - 2016-06-28 16:30 +0200
        Re: [RFC v2 3/3] dma-buf/sync_file: rework fence storage in struct  file Gustavo Padovan <gustavo.padovan@collabora.com> - 2016-06-28 17:40 +0200
        Re: [RFC v2 3/3] dma-buf/sync_file: rework fence storage in struct  file Chris Wilson <chris@chris-wilson.co.uk> - 2016-06-28 18:50 +0200

csiph-web