All of lore.kernel.org
 help / color / mirror / Atom feed
* [i-g-t PATCH 1/2] igt_dummyload: clear signal handler on the desructor
@ 2016-12-01 10:58 Abdiel Janulgue
  2016-12-01 10:58 ` [i-g-t PATCH 2/2] igt/kms_flip: Fix set_dpms called with an idle bo Abdiel Janulgue
  2016-12-01 11:23 ` [i-g-t PATCH 1/2] igt_dummyload: clear signal handler on the desructor Chris Wilson
  0 siblings, 2 replies; 6+ messages in thread
From: Abdiel Janulgue @ 2016-12-01 10:58 UTC (permalink / raw)
  To: intel-gfx

Fixes an issue when calling igt_spin_batch_set_timeout and then
tearing down the spinner right away before it has the chance
to timeout, causes the associated signal handler to linger. Make
sure to remove the handler on the destructor as well.

Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
---
 lib/igt_dummyload.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 99515ea..b201af0 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -169,9 +169,17 @@ igt_spin_batch_new(int fd, int engine, unsigned int dep_handle)
 	return spin;
 }
 
-static void sig_handler(int sig, siginfo_t *info, void *arg)
+static void clear_sig_handler(int sig)
 {
 	struct sigaction act;
+
+	memset(&act, 0, sizeof(act));
+	act.sa_handler = SIG_DFL;
+	igt_assert(sigaction(sig, &act, NULL) == 0);
+}
+
+static void sig_handler(int sig, siginfo_t *info, void *arg)
+{
 	struct igt_spin *iter;
 
 	igt_list_for_each(iter, &spin_list, link) {
@@ -181,9 +189,7 @@ static void sig_handler(int sig, siginfo_t *info, void *arg)
 		}
 	}
 
-	memset(&act, 0, sizeof(act));
-	act.sa_handler = SIG_DFL;
-	igt_assert(sigaction(info->si_signo, &act, NULL) == 0);
+	clear_sig_handler(info->si_signo);
 }
 
 /**
@@ -248,6 +254,7 @@ void igt_spin_batch_end(igt_spin_t *spin)
 
 	*spin->batch = MI_BATCH_BUFFER_END;
 	__sync_synchronize();
+	clear_sig_handler(spin->signo);
 }
 
 /**
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [i-g-t PATCH 2/2] igt/kms_flip: Fix set_dpms called with an idle bo
  2016-12-01 10:58 [i-g-t PATCH 1/2] igt_dummyload: clear signal handler on the desructor Abdiel Janulgue
@ 2016-12-01 10:58 ` Abdiel Janulgue
  2016-12-01 11:23   ` Chris Wilson
  2016-12-01 11:23 ` [i-g-t PATCH 1/2] igt_dummyload: clear signal handler on the desructor Chris Wilson
  1 sibling, 1 reply; 6+ messages in thread
From: Abdiel Janulgue @ 2016-12-01 10:58 UTC (permalink / raw)
  To: intel-gfx

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);
 	}
 
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [i-g-t PATCH 1/2] igt_dummyload: clear signal handler on the desructor
  2016-12-01 10:58 [i-g-t PATCH 1/2] igt_dummyload: clear signal handler on the desructor Abdiel Janulgue
  2016-12-01 10:58 ` [i-g-t PATCH 2/2] igt/kms_flip: Fix set_dpms called with an idle bo Abdiel Janulgue
@ 2016-12-01 11:23 ` Chris Wilson
  1 sibling, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2016-12-01 11:23 UTC (permalink / raw)
  To: Abdiel Janulgue; +Cc: intel-gfx

On Thu, Dec 01, 2016 at 12:58:45PM +0200, Abdiel Janulgue wrote:
> Fixes an issue when calling igt_spin_batch_set_timeout and then
> tearing down the spinner right away before it has the chance
> to timeout, causes the associated signal handler to linger. Make
> sure to remove the handler on the destructor as well.
> 
> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
> ---
>  lib/igt_dummyload.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
> index 99515ea..b201af0 100644
> --- a/lib/igt_dummyload.c
> +++ b/lib/igt_dummyload.c
> @@ -169,9 +169,17 @@ igt_spin_batch_new(int fd, int engine, unsigned int dep_handle)
>  	return spin;
>  }
>  
> -static void sig_handler(int sig, siginfo_t *info, void *arg)
> +static void clear_sig_handler(int sig)
>  {
>  	struct sigaction act;
> +
> +	memset(&act, 0, sizeof(act));
> +	act.sa_handler = SIG_DFL;
> +	igt_assert(sigaction(sig, &act, NULL) == 0);
> +}
> +
> +static void sig_handler(int sig, siginfo_t *info, void *arg)
> +{
>  	struct igt_spin *iter;
>  
>  	igt_list_for_each(iter, &spin_list, link) {
> @@ -181,9 +189,7 @@ static void sig_handler(int sig, siginfo_t *info, void *arg)
>  		}
>  	}
>  
> -	memset(&act, 0, sizeof(act));
> -	act.sa_handler = SIG_DFL;
> -	igt_assert(sigaction(info->si_signo, &act, NULL) == 0);
> +	clear_sig_handler(info->si_signo);
>  }
>  
>  /**
> @@ -248,6 +254,7 @@ void igt_spin_batch_end(igt_spin_t *spin)
>  
>  	*spin->batch = MI_BATCH_BUFFER_END;
>  	__sync_synchronize();

Newline here since these are two different phases.

> +	clear_sig_handler(spin->signo);

I was also thinking about decoupling from the list of spinners here as
well. Just looked like some more work to use safe iterators and
list_del_init().

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [i-g-t PATCH 2/2] igt/kms_flip: Fix set_dpms called with an idle bo
  2016-12-01 10:58 ` [i-g-t PATCH 2/2] igt/kms_flip: Fix set_dpms called with an idle bo Abdiel Janulgue
@ 2016-12-01 11:23   ` Chris Wilson
  2017-03-24 11:55     ` Ander Conselvan De Oliveira
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2016-12-01 11:23 UTC (permalink / raw)
  To: Abdiel Janulgue; +Cc: intel-gfx

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

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [i-g-t PATCH 2/2] igt/kms_flip: Fix set_dpms called with an idle bo
  2016-12-01 11:23   ` Chris Wilson
@ 2017-03-24 11:55     ` Ander Conselvan De Oliveira
  2017-03-24 12:11       ` Chris Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Ander Conselvan De Oliveira @ 2017-03-24 11:55 UTC (permalink / raw)
  To: Chris Wilson, Abdiel Janulgue; +Cc: intel-gfx

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
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [i-g-t PATCH 2/2] igt/kms_flip: Fix set_dpms called with an idle bo
  2017-03-24 11:55     ` Ander Conselvan De Oliveira
@ 2017-03-24 12:11       ` Chris Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2017-03-24 12:11 UTC (permalink / raw)
  To: Ander Conselvan De Oliveira; +Cc: intel-gfx

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

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-24 12:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-01 10:58 [i-g-t PATCH 1/2] igt_dummyload: clear signal handler on the desructor Abdiel Janulgue
2016-12-01 10:58 ` [i-g-t PATCH 2/2] igt/kms_flip: Fix set_dpms called with an idle bo Abdiel Janulgue
2016-12-01 11:23   ` Chris Wilson
2017-03-24 11:55     ` Ander Conselvan De Oliveira
2017-03-24 12:11       ` Chris Wilson
2016-12-01 11:23 ` [i-g-t PATCH 1/2] igt_dummyload: clear signal handler on the desructor Chris Wilson

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.