<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Sep 26, 2018 at 3:18 AM Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Quoting Jason Ekstrand (2018-09-26 08:17:03)<br>
> We attempt to get fences earlier in the hopes that everything will<br>
> already have fences and no callbacks will be needed.  If we do succeed<br>
> in getting a fence, getting one a second time will result in a duplicate<br>
> ref with no unref.  This is causing memory leaks in Vulkan applications<br>
> that create a lot of fences; playing for a few hours can, apparently,<br>
> bring down the system.<br>
> <br>
> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=107899" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=107899</a><br>
> Signed-off-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>><br>
> Cc: <a href="mailto:stable@vger.kernel.org" target="_blank">stable@vger.kernel.org</a><br>
> ---<br>
>  drivers/gpu/drm/drm_syncobj.c | 5 +++++<br>
>  1 file changed, 5 insertions(+)<br>
> <br>
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c<br>
> index adb3cb27d31e..759278fef35a 100644<br>
> --- a/drivers/gpu/drm/drm_syncobj.c<br>
> +++ b/drivers/gpu/drm/drm_syncobj.c<br>
> @@ -97,6 +97,8 @@ static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj,<br>
>  {<br>
>         int ret;<br>
>  <br>
> +       WARN_ON(*fence);<br>
<br>
I would have just put if (*fence) return; since the function is tied to<br>
the array_wait implementation.<br></blockquote><div><br></div><div>I considered doing that but marginally liked this better.  If you have a preference, I'm happy to change itl.</div><div><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Reviewed-by: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk" target="_blank">chris@chris-wilson.co.uk</a>><br>
-Chris<br>
</blockquote></div></div>