[i-g-t,2/2] igt/kms_flip: Fix set_dpms called with an idle bo
diff mbox

Message ID 1480589926-23053-2-git-send-email-abdiel.janulgue@linux.intel.com
State New
Headers show

Commit Message

Abdiel Janulgue Dec. 1, 2016, 10:58 a.m. UTC
Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
---
 tests/kms_flip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Chris Wilson Dec. 1, 2016, 11:23 a.m. UTC | #1
On Thu, Dec 01, 2016 at 12:58:46PM +0200, Abdiel Janulgue wrote:
> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
> ---
>  tests/kms_flip.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index 289335a..f744b3d 100644
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -757,9 +757,9 @@ static unsigned int run_test_step(struct test_output *o)
>  
>  	if (o->flags & TEST_DPMS) {
>  		if (spin_rcs)
> -			igt_spin_batch_end(spin_rcs);
> +			igt_spin_batch_set_timeout(spin_rcs, NSEC_PER_SEC);
>  		if (spin_bcs)
> -			igt_spin_batch_end(spin_bcs);
> +		        igt_spin_batch_set_timeout(spin_bcs, NSEC_PER_SEC);
>  		set_dpms(o, DRM_MODE_DPMS_ON);
>  	}

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Ander Conselvan de Oliveira March 24, 2017, 11:55 a.m. UTC | #2
On Thu, 2016-12-01 at 11:23 +0000, Chris Wilson wrote:
> On Thu, Dec 01, 2016 at 12:58:46PM +0200, Abdiel Janulgue wrote:
> > Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>

How is the bug that this commit fixes triggered? Reverting this change seems to
fix [1] which, if I understand correctly, is caused by the atomic commit of
set_dpms() to be waiting for the dummy write to the frontbuffer complete, while 
the spin batch never ends since the test is blocked and so doesn't handle the
timer signal. 


[1] https://bugs.freedesktop.org/show_bug.cgi?id=100261

Thanks,
Ander

> > ---
> >  tests/kms_flip.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> > index 289335a..f744b3d 100644
> > --- a/tests/kms_flip.c
> > +++ b/tests/kms_flip.c
> > @@ -757,9 +757,9 @@ static unsigned int run_test_step(struct test_output *o)
> >  
> >  	if (o->flags & TEST_DPMS) {
> >  		if (spin_rcs)
> > -			igt_spin_batch_end(spin_rcs);
> > +			igt_spin_batch_set_timeout(spin_rcs, NSEC_PER_SEC);
> >  		if (spin_bcs)
> > -			igt_spin_batch_end(spin_bcs);
> > +		        igt_spin_batch_set_timeout(spin_bcs, NSEC_PER_SEC);
> >  		set_dpms(o, DRM_MODE_DPMS_ON);
> >  	}
> 
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris
>
Chris Wilson March 24, 2017, 12:11 p.m. UTC | #3
On Fri, Mar 24, 2017 at 01:55:00PM +0200, Ander Conselvan De Oliveira wrote:
> On Thu, 2016-12-01 at 11:23 +0000, Chris Wilson wrote:
> > On Thu, Dec 01, 2016 at 12:58:46PM +0200, Abdiel Janulgue wrote:
> > > Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
> 
> How is the bug that this commit fixes triggered? Reverting this change seems to
> fix [1] which, if I understand correctly, is caused by the atomic commit of
> set_dpms() to be waiting for the dummy write to the frontbuffer complete, while 
> the spin batch never ends since the test is blocked and so doesn't handle the
> timer signal. 

That is actually a kernel regression (that I'm responsible for). However
it raises a good point that we don't actually want to interrupt the
modeset to handle the signal in this case, otherwise the interrupt
modeset and when it restarts, it will find it doesn't have to wait -
invalidating our test that it can wait for completion. Hmm, that affects
all users.  We want to delegate that task to a thread/child to avoid
interrupting the syscall and perturbing the actual code under test.
-Chris

Patch
diff mbox

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 289335a..f744b3d 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -757,9 +757,9 @@  static unsigned int run_test_step(struct test_output *o)
 
 	if (o->flags & TEST_DPMS) {
 		if (spin_rcs)
-			igt_spin_batch_end(spin_rcs);
+			igt_spin_batch_set_timeout(spin_rcs, NSEC_PER_SEC);
 		if (spin_bcs)
-			igt_spin_batch_end(spin_bcs);
+		        igt_spin_batch_set_timeout(spin_bcs, NSEC_PER_SEC);
 		set_dpms(o, DRM_MODE_DPMS_ON);
 	}