All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: dont call irq_put when irq test is on
@ 2013-12-09 18:47 Mika Kuoppala
  2013-12-12 12:56 ` Ville Syrjälä
  0 siblings, 1 reply; 5+ messages in thread
From: Mika Kuoppala @ 2013-12-09 18:47 UTC (permalink / raw)
  To: intel-gfx

If test is running, irq_get was not called so we should
gain balance by not doing irq_put

v2: use local variable so it can't change during test (Chris)

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 92149bc..ab8fd3d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1015,6 +1015,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 			struct drm_i915_file_private *file_priv)
 {
 	drm_i915_private_t *dev_priv = ring->dev->dev_private;
+	const bool irq_test_in_progress = dev_priv->gpu_error.test_irq_rings & intel_ring_flag(ring);
 	struct timespec before, now;
 	DEFINE_WAIT(wait);
 	long timeout_jiffies;
@@ -1035,8 +1036,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 					 msecs_to_jiffies(100));
 	}
 
-	if (!(dev_priv->gpu_error.test_irq_rings & intel_ring_flag(ring)) &&
-	    WARN_ON(!ring->irq_get(ring)))
+	if (!irq_test_in_progress && WARN_ON(!ring->irq_get(ring)))
 		return -ENODEV;
 
 	/* Record current time in case interrupted by signal, or wedged */
@@ -1095,7 +1095,8 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 	getrawmonotonic(&now);
 	trace_i915_gem_request_wait_end(ring, seqno);
 
-	ring->irq_put(ring);
+	if (!irq_test_in_progress)
+		ring->irq_put(ring);
 
 	finish_wait(&ring->irq_queue, &wait);
 
-- 
1.7.9.5

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

* Re: [PATCH] drm/i915: dont call irq_put when irq test is on
  2013-12-09 18:47 [PATCH] drm/i915: dont call irq_put when irq test is on Mika Kuoppala
@ 2013-12-12 12:56 ` Ville Syrjälä
  2013-12-12 15:54   ` Mika Kuoppala
  0 siblings, 1 reply; 5+ messages in thread
From: Ville Syrjälä @ 2013-12-12 12:56 UTC (permalink / raw)
  To: Mika Kuoppala; +Cc: intel-gfx

On Mon, Dec 09, 2013 at 08:47:22PM +0200, Mika Kuoppala wrote:
> If test is running, irq_get was not called so we should
> gain balance by not doing irq_put
> 
> v2: use local variable so it can't change during test (Chris)
> 
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 92149bc..ab8fd3d 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1015,6 +1015,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
>  			struct drm_i915_file_private *file_priv)
>  {
>  	drm_i915_private_t *dev_priv = ring->dev->dev_private;
> +	const bool irq_test_in_progress = dev_priv->gpu_error.test_irq_rings & intel_ring_flag(ring);

Should this use ACCESS_ONCE() to make sure the value doesn't get
reloaded from the source later?

>  	struct timespec before, now;
>  	DEFINE_WAIT(wait);
>  	long timeout_jiffies;
> @@ -1035,8 +1036,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
>  					 msecs_to_jiffies(100));
>  	}
>  
> -	if (!(dev_priv->gpu_error.test_irq_rings & intel_ring_flag(ring)) &&
> -	    WARN_ON(!ring->irq_get(ring)))
> +	if (!irq_test_in_progress && WARN_ON(!ring->irq_get(ring)))
>  		return -ENODEV;
>  
>  	/* Record current time in case interrupted by signal, or wedged */
> @@ -1095,7 +1095,8 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
>  	getrawmonotonic(&now);
>  	trace_i915_gem_request_wait_end(ring, seqno);
>  
> -	ring->irq_put(ring);
> +	if (!irq_test_in_progress)
> +		ring->irq_put(ring);
>  
>  	finish_wait(&ring->irq_queue, &wait);
>  
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

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

* [PATCH] drm/i915: dont call irq_put when irq test is on
  2013-12-12 12:56 ` Ville Syrjälä
@ 2013-12-12 15:54   ` Mika Kuoppala
  2013-12-12 16:06     ` Ville Syrjälä
  0 siblings, 1 reply; 5+ messages in thread
From: Mika Kuoppala @ 2013-12-12 15:54 UTC (permalink / raw)
  To: intel-gfx

If test is running, irq_get was not called so we should gain
balance by not doing irq_put

"So the rule is: if you access unlocked values, you use ACCESS_ONCE().
You don't say "but it can't matter". Because you simply don't know."
-- Linus

v2: use local variable so it can't change during test (Chris)

v3: update commit msg and use ACCESS_ONCE (Ville)

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 279387a..e34b48e 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1015,6 +1015,8 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 			struct drm_i915_file_private *file_priv)
 {
 	drm_i915_private_t *dev_priv = ring->dev->dev_private;
+	const bool irq_test_in_progress =
+		ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring);
 	struct timespec before, now;
 	DEFINE_WAIT(wait);
 	unsigned long timeout_expire;
@@ -1035,8 +1037,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 					 msecs_to_jiffies(100));
 	}
 
-	if (!(dev_priv->gpu_error.test_irq_rings & intel_ring_flag(ring)) &&
-	    WARN_ON(!ring->irq_get(ring)))
+	if (!irq_test_in_progress && WARN_ON(!ring->irq_get(ring)))
 		return -ENODEV;
 
 	/* Record current time in case interrupted by signal, or wedged */
@@ -1093,7 +1094,8 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 	getrawmonotonic(&now);
 	trace_i915_gem_request_wait_end(ring, seqno);
 
-	ring->irq_put(ring);
+	if (!irq_test_in_progress)
+		ring->irq_put(ring);
 
 	finish_wait(&ring->irq_queue, &wait);
 
-- 
1.7.9.5

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

* Re: [PATCH] drm/i915: dont call irq_put when irq test is on
  2013-12-12 15:54   ` Mika Kuoppala
@ 2013-12-12 16:06     ` Ville Syrjälä
  2013-12-12 16:46       ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Ville Syrjälä @ 2013-12-12 16:06 UTC (permalink / raw)
  To: Mika Kuoppala; +Cc: intel-gfx

On Thu, Dec 12, 2013 at 05:54:42PM +0200, Mika Kuoppala wrote:
> If test is running, irq_get was not called so we should gain
> balance by not doing irq_put
> 
> "So the rule is: if you access unlocked values, you use ACCESS_ONCE().
> You don't say "but it can't matter". Because you simply don't know."
> -- Linus
> 
> v2: use local variable so it can't change during test (Chris)
> 
> v3: update commit msg and use ACCESS_ONCE (Ville)
> 
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>

Looks good.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 279387a..e34b48e 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1015,6 +1015,8 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
>  			struct drm_i915_file_private *file_priv)
>  {
>  	drm_i915_private_t *dev_priv = ring->dev->dev_private;
> +	const bool irq_test_in_progress =
> +		ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring);
>  	struct timespec before, now;
>  	DEFINE_WAIT(wait);
>  	unsigned long timeout_expire;
> @@ -1035,8 +1037,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
>  					 msecs_to_jiffies(100));
>  	}
>  
> -	if (!(dev_priv->gpu_error.test_irq_rings & intel_ring_flag(ring)) &&
> -	    WARN_ON(!ring->irq_get(ring)))
> +	if (!irq_test_in_progress && WARN_ON(!ring->irq_get(ring)))
>  		return -ENODEV;
>  
>  	/* Record current time in case interrupted by signal, or wedged */
> @@ -1093,7 +1094,8 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
>  	getrawmonotonic(&now);
>  	trace_i915_gem_request_wait_end(ring, seqno);
>  
> -	ring->irq_put(ring);
> +	if (!irq_test_in_progress)
> +		ring->irq_put(ring);
>  
>  	finish_wait(&ring->irq_queue, &wait);
>  
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

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

* Re: [PATCH] drm/i915: dont call irq_put when irq test is on
  2013-12-12 16:06     ` Ville Syrjälä
@ 2013-12-12 16:46       ` Daniel Vetter
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2013-12-12 16:46 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

On Thu, Dec 12, 2013 at 06:06:16PM +0200, Ville Syrjälä wrote:
> On Thu, Dec 12, 2013 at 05:54:42PM +0200, Mika Kuoppala wrote:
> > If test is running, irq_get was not called so we should gain
> > balance by not doing irq_put
> > 
> > "So the rule is: if you access unlocked values, you use ACCESS_ONCE().
> > You don't say "but it can't matter". Because you simply don't know."
> > -- Linus
> > 
> > v2: use local variable so it can't change during test (Chris)
> > 
> > v3: update commit msg and use ACCESS_ONCE (Ville)
> > 
> > Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> 
> Looks good.
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Queued for -next, thanks for the patch.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

end of thread, other threads:[~2013-12-12 16:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-09 18:47 [PATCH] drm/i915: dont call irq_put when irq test is on Mika Kuoppala
2013-12-12 12:56 ` Ville Syrjälä
2013-12-12 15:54   ` Mika Kuoppala
2013-12-12 16:06     ` Ville Syrjälä
2013-12-12 16:46       ` Daniel Vetter

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.