linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915/fence: Do not use TIMER_IRQSAFE
@ 2019-02-12 16:28 Sebastian Andrzej Siewior
  2019-02-26 16:00 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2019-02-12 16:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Sebastian Andrzej Siewior, Jani Nikula, Joonas Lahtinen,
	Rodrigo Vivi, David Airlie, Daniel Vetter, intel-gfx, dri-devel

The timer is initialized with TIMER_IRQSAFE flag. It does look like the
timer callback requires this flag at all. Its sole purpose is to ensure
synchronisation in the workqueue code.

Remove TIMER_IRQSAFE flag because it is not required.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/gpu/drm/i915/i915_sw_fence.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c b/drivers/gpu/drm/i915/i915_sw_fence.c
index fc2eeab823b70..6d22d9df6a433 100644
--- a/drivers/gpu/drm/i915/i915_sw_fence.c
+++ b/drivers/gpu/drm/i915/i915_sw_fence.c
@@ -461,8 +461,7 @@ int i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
 		timer->dma = dma_fence_get(dma);
 		init_irq_work(&timer->work, irq_i915_sw_fence_work);
 
-		timer_setup(&timer->timer,
-			    timer_i915_sw_fence_wake, TIMER_IRQSAFE);
+		timer_setup(&timer->timer, timer_i915_sw_fence_wake, 0);
 		mod_timer(&timer->timer, round_jiffies_up(jiffies + timeout));
 
 		func = dma_i915_sw_fence_wake_timer;
-- 
2.20.1


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

* Re: [PATCH] drm/i915/fence: Do not use TIMER_IRQSAFE
  2019-02-12 16:28 [PATCH] drm/i915/fence: Do not use TIMER_IRQSAFE Sebastian Andrzej Siewior
@ 2019-02-26 16:00 ` Sebastian Andrzej Siewior
  2019-02-28 10:00   ` [Intel-gfx] " Chris Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2019-02-26 16:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, David Airlie,
	Daniel Vetter, intel-gfx, dri-devel

On 2019-02-12 17:28:57 [+0100], To linux-kernel@vger.kernel.org wrote:
> The timer is initialized with TIMER_IRQSAFE flag. It does look like the
> timer callback requires this flag at all. Its sole purpose is to ensure
> synchronisation in the workqueue code.
> 
> Remove TIMER_IRQSAFE flag because it is not required.

ping

> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/gpu/drm/i915/i915_sw_fence.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c b/drivers/gpu/drm/i915/i915_sw_fence.c
> index fc2eeab823b70..6d22d9df6a433 100644
> --- a/drivers/gpu/drm/i915/i915_sw_fence.c
> +++ b/drivers/gpu/drm/i915/i915_sw_fence.c
> @@ -461,8 +461,7 @@ int i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
>  		timer->dma = dma_fence_get(dma);
>  		init_irq_work(&timer->work, irq_i915_sw_fence_work);
>  
> -		timer_setup(&timer->timer,
> -			    timer_i915_sw_fence_wake, TIMER_IRQSAFE);
> +		timer_setup(&timer->timer, timer_i915_sw_fence_wake, 0);
>  		mod_timer(&timer->timer, round_jiffies_up(jiffies + timeout));
>  
>  		func = dma_i915_sw_fence_wake_timer;

Sebastian

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

* Re: [Intel-gfx] [PATCH] drm/i915/fence: Do not use TIMER_IRQSAFE
  2019-02-26 16:00 ` Sebastian Andrzej Siewior
@ 2019-02-28 10:00   ` Chris Wilson
  2019-02-28 10:09     ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2019-02-28 10:00 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, linux-kernel
  Cc: David Airlie, intel-gfx, dri-devel, tglx

Quoting Sebastian Andrzej Siewior (2019-02-26 16:00:38)
> On 2019-02-12 17:28:57 [+0100], To linux-kernel@vger.kernel.org wrote:
> > The timer is initialized with TIMER_IRQSAFE flag. It does look like the
> > timer callback requires this flag at all. Its sole purpose is to ensure
> > synchronisation in the workqueue code.
> > 
> > Remove TIMER_IRQSAFE flag because it is not required.
> 
> ping

We call del_timer_sync from irq context, which mandates using
TIMER_IRQSAFE. Failure to do so results in lots of explosions across CI
-- every machine managed to hit the warning.

It may not be the best of api, but it's the only one available for the
driver to use...
-Chris

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

* Re: [Intel-gfx] [PATCH] drm/i915/fence: Do not use TIMER_IRQSAFE
  2019-02-28 10:00   ` [Intel-gfx] " Chris Wilson
@ 2019-02-28 10:09     ` Thomas Gleixner
  2019-02-28 10:19       ` Chris Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2019-02-28 10:09 UTC (permalink / raw)
  To: Chris Wilson
  Cc: Sebastian Andrzej Siewior, LKML, David Airlie, intel-gfx,
	dri-devel, Peter Zijlstra

On Thu, 28 Feb 2019, Chris Wilson wrote:

> Quoting Sebastian Andrzej Siewior (2019-02-26 16:00:38)
> > On 2019-02-12 17:28:57 [+0100], To linux-kernel@vger.kernel.org wrote:
> > > The timer is initialized with TIMER_IRQSAFE flag. It does look like the
> > > timer callback requires this flag at all. Its sole purpose is to ensure
> > > synchronisation in the workqueue code.
> > > 
> > > Remove TIMER_IRQSAFE flag because it is not required.
> > 
> > ping
> 
> We call del_timer_sync from irq context, which mandates using
> TIMER_IRQSAFE. Failure to do so results in lots of explosions across CI
> -- every machine managed to hit the warning.
> 
> It may not be the best of api, but it's the only one available for the
> driver to use...

The comment in the header files says clearly:

 * Note: The irq disabled callback execution is a special case for
 * workqueue locking issues. It's not meant for executing random crap
 * with interrupts disabled. Abuse is monitored!                                   

So what's so special in drm that you need to call del_timer_sync() from
interrupt context?

Thanks

	tglx





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

* Re: [Intel-gfx] [PATCH] drm/i915/fence: Do not use TIMER_IRQSAFE
  2019-02-28 10:09     ` Thomas Gleixner
@ 2019-02-28 10:19       ` Chris Wilson
  2019-02-28 10:50         ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2019-02-28 10:19 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Sebastian Andrzej Siewior, LKML, David Airlie, intel-gfx,
	dri-devel, Peter Zijlstra

Quoting Thomas Gleixner (2019-02-28 10:09:26)
> On Thu, 28 Feb 2019, Chris Wilson wrote:
> 
> > Quoting Sebastian Andrzej Siewior (2019-02-26 16:00:38)
> > > On 2019-02-12 17:28:57 [+0100], To linux-kernel@vger.kernel.org wrote:
> > > > The timer is initialized with TIMER_IRQSAFE flag. It does look like the
> > > > timer callback requires this flag at all. Its sole purpose is to ensure
> > > > synchronisation in the workqueue code.
> > > > 
> > > > Remove TIMER_IRQSAFE flag because it is not required.
> > > 
> > > ping
> > 
> > We call del_timer_sync from irq context, which mandates using
> > TIMER_IRQSAFE. Failure to do so results in lots of explosions across CI
> > -- every machine managed to hit the warning.
> > 
> > It may not be the best of api, but it's the only one available for the
> > driver to use...
> 
> The comment in the header files says clearly:
> 
>  * Note: The irq disabled callback execution is a special case for
>  * workqueue locking issues. It's not meant for executing random crap
>  * with interrupts disabled. Abuse is monitored!                                   
> 
> So what's so special in drm that you need to call del_timer_sync() from
> interrupt context?

There's no protection against fence signaling from inside interrupt
context, and a lot of pressure to do so.
-Chris

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

* Re: [Intel-gfx] [PATCH] drm/i915/fence: Do not use TIMER_IRQSAFE
  2019-02-28 10:19       ` Chris Wilson
@ 2019-02-28 10:50         ` Thomas Gleixner
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2019-02-28 10:50 UTC (permalink / raw)
  To: Chris Wilson
  Cc: Sebastian Andrzej Siewior, LKML, David Airlie, intel-gfx,
	dri-devel, Peter Zijlstra

On Thu, 28 Feb 2019, Chris Wilson wrote:
> Quoting Thomas Gleixner (2019-02-28 10:09:26)
> > On Thu, 28 Feb 2019, Chris Wilson wrote:
> > > It may not be the best of api, but it's the only one available for the
> > > driver to use...
> > 
> > The comment in the header files says clearly:
> > 
> >  * Note: The irq disabled callback execution is a special case for
> >  * workqueue locking issues. It's not meant for executing random crap
> >  * with interrupts disabled. Abuse is monitored!                                 
> > 
> > So what's so special in drm that you need to call del_timer_sync() from
> > interrupt context?
> 
> There's no protection against fence signaling from inside interrupt
> context, and a lot of pressure to do so.

Whatever that means that still does not justify to pick something which is
clearly stated not to be for general usage without talking to the people
who added that restriction.

I looked at that code and it's so well commented that's it's utterly
obvious how all this is connected and why this is the only way to solve the
problem. Oh well..

Thanks,

	tglx



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

end of thread, other threads:[~2019-02-28 10:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-12 16:28 [PATCH] drm/i915/fence: Do not use TIMER_IRQSAFE Sebastian Andrzej Siewior
2019-02-26 16:00 ` Sebastian Andrzej Siewior
2019-02-28 10:00   ` [Intel-gfx] " Chris Wilson
2019-02-28 10:09     ` Thomas Gleixner
2019-02-28 10:19       ` Chris Wilson
2019-02-28 10:50         ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).