dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Gustavo Padovan <gustavo.padovan@collabora.com>
Cc: Gustavo Padovan <gustavo@padovan.org>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Daniel Stone <daniels@collabora.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Rob Clark <robdclark@gmail.com>,
	Greg Hackmann <ghackmann@google.com>,
	John Harrison <John.C.Harrison@Intel.com>,
	laurent.pinchart@ideasonboard.com, seanpaul@google.com,
	marcheu@google.com, m.chehab@samsung.com,
	Sumit Semwal <sumit.semwal@linaro.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
	Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [RFC v2 2/3] dma-buf/fence-array: add fence_array_teardown()
Date: Tue, 28 Jun 2016 17:05:25 +0200	[thread overview]
Message-ID: <57729235.7040308@amd.com> (raw)
In-Reply-To: <20160628141703.GJ2508@joana>

Am 28.06.2016 um 16:17 schrieb Gustavo Padovan:
> 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.

No, there won't be any leak and you don't need to cleanup anything.

The fences contained in the fence array are already enabled for 
signaling. So they will eventually signal sooner or later and drop the 
reference to the fence array freeing it when the last one finished.

This was done to avoid the need to call fence_remove_callback() all the 
time on the fences in the array because of the warning on the function.

Regards,
Christian.

>
> 	Gustavo

  reply	other threads:[~2016-06-28 15:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27 19:29 [RFC v2 0/3] dma-buf/sync_file: rework fences on struct sync_file Gustavo Padovan
2016-06-27 19:29 ` [RFC v2 1/3] dma-buf/fence-array: add fence_is_array() Gustavo Padovan
2016-06-27 19:29 ` [RFC v2 2/3] dma-buf/fence-array: add fence_array_teardown() Gustavo Padovan
2016-06-28  9:56   ` Christian König
2016-06-28 14:17     ` Gustavo Padovan
2016-06-28 15:05       ` Christian König [this message]
2016-06-28 15:17         ` Gustavo Padovan
2016-06-27 19:29 ` [RFC v2 3/3] dma-buf/sync_file: rework fence storage in struct file Gustavo Padovan
2016-06-28  8:02   ` Chris Wilson
2016-06-28 14:25     ` Gustavo Padovan
2016-06-28 15:09       ` Chris Wilson
2016-06-28 15:27         ` Gustavo Padovan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57729235.7040308@amd.com \
    --to=christian.koenig@amd.com \
    --cc=John.C.Harrison@Intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniels@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ghackmann@google.com \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=gustavo.padovan@collabora.com \
    --cc=gustavo@padovan.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marcheu@google.com \
    --cc=robdclark@gmail.com \
    --cc=seanpaul@google.com \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).