All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo.padovan@collabora.com>
To: Shuah Khan <shuahkh@osg.samsung.com>,
	Gustavo Padovan <gustavo@padovan.org>,
	Chris Wilson <chris@chris-wilson.co.uk>
Cc: Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/3] selftests: sync: add test that closes the fd before fence signal
Date: Wed, 02 Aug 2017 17:28:30 -0300	[thread overview]
Message-ID: <1501705710.14866.58.camel@collabora.com> (raw)
In-Reply-To: <12cba706-4d19-552b-c2b7-b5c3a69f59b7@osg.samsung.com>

Hi Shuah,

On Wed, 2017-08-02 at 13:45 -0600, Shuah Khan wrote:
> On 07/31/2017 01:43 PM, Gustavo Padovan wrote:
> > 2017-07-30 Chris Wilson <chris@chris-wilson.co.uk>:
> > 
> > > Quoting Gustavo Padovan (2017-07-29 16:22:17)
> > > > From: Gustavo Padovan <gustavo.padovan@collabora.com>
> > > > 
> > > > We found this bug in the sw_sync so adding a test case to
> > > > prevent it to
> > > > happen in the future.
> > > > 
> > > > Cc: Shuah Khan <shuahkh@osg.samsung.com>
> > > > Cc: linux-kselftest@vger.kernel.org
> > > > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
> > > > 
> > > > ---
> > > > To be applied after the TAP13 convertion patches.
> > > > ---
> > > >  tools/testing/selftests/sync/sync_fence.c | 23
> > > > +++++++++++++++++++++++
> > > >  tools/testing/selftests/sync/sync_test.c  |  1 +
> > > >  tools/testing/selftests/sync/synctest.h   |  1 +
> > > >  3 files changed, 25 insertions(+)
> > > > 
> > > > diff --git a/tools/testing/selftests/sync/sync_fence.c
> > > > b/tools/testing/selftests/sync/sync_fence.c
> > > > index 13f1752..70cfa61 100644
> > > > --- a/tools/testing/selftests/sync/sync_fence.c
> > > > +++ b/tools/testing/selftests/sync/sync_fence.c
> > > > @@ -29,6 +29,29 @@
> > > >  #include "sw_sync.h"
> > > >  #include "synctest.h"
> > > >  
> > > > +int test_close_fence_fd_before_inc(void)
> > > > +{
> > > > +       int fence, valid, ret;
> > > > +       int timeline = sw_sync_timeline_create();
> > > > +
> > > > +       valid = sw_sync_timeline_is_valid(timeline);
> > > > +       ASSERT(valid, "Failure allocating timeline\n");
> > > > +
> > > > +       fence = sw_sync_fence_create(timeline, "allocFence",
> > > > 1);
> > > > +       valid = sw_sync_fence_is_valid(fence);
> > > > +       ASSERT(valid, "Failure allocating fence\n");
> > > > +
> > > 
> > > /*
> > >  * We want the destroy + inc to run within the same RCU grace
> > > period so
> > >  * that the zombie fence still exists on the timeline.
> > >  */
> > > 
> > > > +       sw_sync_fence_destroy(fence);
> > > 
> > > I think this doesn't exercise the bug you found as we should be
> > > entering
> > > the timeline_inc loop with fence.refcount==0 rather than the
> > > refcount
> > > going to zero within the loop.
> > > 
> > > To achieve that we need to find a callback that does unreference
> > > a
> > > dma-fence and chain those together so that it frees a sw_sync
> > > from the
> > > same timeline.
> > 
> > Indeed. Without the internal callback this test is a bit useless.
> > We
> > could test this under drm atomic tests on IGT. Particulary, I hit
> > it
> > playing with tests for v4l2 fences.
> > 
> 
> Hi Gustavo,
> 
> Would you like this pulled into 4.14-rc1? Sounds like this test is
> for a
> feature that doesn't exist yet?

It is for the current code, but I need to find a better way to trigger
what I want. I'll rethink this test and resend.

Gustavo

-- 
Gustavo Padovan
Collabora Ltd.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-08-02 20:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-29 15:22 [PATCH 1/3] dma-buf/sw_sync: move timeline_fence_ops around Gustavo Padovan
2017-07-29 15:22 ` [PATCH 2/3] dma-buf/sw_sync: clean up list before signaling the fence Gustavo Padovan
2017-07-30  9:10   ` Chris Wilson
2017-07-31 19:32     ` Gustavo Padovan
2017-07-29 15:22 ` [PATCH 3/3] selftests: sync: add test that closes the fd before fence signal Gustavo Padovan
2017-07-30  9:20   ` Chris Wilson
2017-07-31 19:43     ` Gustavo Padovan
2017-08-02 19:45       ` Shuah Khan
2017-08-02 20:28         ` Gustavo Padovan [this message]
2017-07-30  9:09 ` [PATCH 1/3] dma-buf/sw_sync: move timeline_fence_ops around Chris Wilson
2017-07-31 19:32   ` 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=1501705710.14866.58.camel@collabora.com \
    --to=gustavo.padovan@collabora.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=shuahkh@osg.samsung.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.