public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: don't update the dri1 breadcrumb with modesetting
@ 2013-12-10 12:24 Daniel Vetter
  2013-12-10 12:44 ` [Intel-gfx] " Chris Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2013-12-10 12:24 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Eugene Shatokhin, stable

The update is horribly racy since it doesn't protect at all against
concurrent closing of the master fd. And it can't really since that
requires us to grab a mutex.

Instead of jumping through hoops and offloading this to a worker
thread just block this bit of code for the modesetting driver.

Reported-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
Cc: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_dma.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 197db0993a24..0a42e2f7bcf8 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -83,6 +83,9 @@ void i915_update_dri1_breadcrumb(struct drm_device *dev)
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	struct drm_i915_master_private *master_priv;
 
+	if (drm_core_check_feature(dev, DRIVER_MODESET))
+		return;
+
 	if (dev->primary->master) {
 		master_priv = dev->primary->master->driver_priv;
 		if (master_priv->sarea_priv)
-- 
1.8.4.3

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

* Re: [Intel-gfx] [PATCH] drm/i915: don't update the dri1 breadcrumb with modesetting
  2013-12-10 12:24 [PATCH] drm/i915: don't update the dri1 breadcrumb with modesetting Daniel Vetter
@ 2013-12-10 12:44 ` Chris Wilson
  2013-12-10 13:48   ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2013-12-10 12:44 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Intel Graphics Development, Eugene Shatokhin, stable

On Tue, Dec 10, 2013 at 01:24:01PM +0100, Daniel Vetter wrote:
> The update is horribly racy since it doesn't protect at all against
> concurrent closing of the master fd. And it can't really since that
> requires us to grab a mutex.
> 
> Instead of jumping through hoops and offloading this to a worker
> thread just block this bit of code for the modesetting driver.
> 
> Reported-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
> Cc: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

We should also not be calling update_dri1_breadcrumb unless we have a
USER_INTERRUPT. The other updates to the breadcrumb hws index do not
appear to be serialised by anything other than polling.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

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

* Re: [Intel-gfx] [PATCH] drm/i915: don't update the dri1 breadcrumb with modesetting
  2013-12-10 12:44 ` [Intel-gfx] " Chris Wilson
@ 2013-12-10 13:48   ` Daniel Vetter
  2013-12-11 11:06     ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2013-12-10 13:48 UTC (permalink / raw)
  To: Chris Wilson, Daniel Vetter, Intel Graphics Development,
	Eugene Shatokhin, stable

On Tue, Dec 10, 2013 at 12:44:12PM +0000, Chris Wilson wrote:
> On Tue, Dec 10, 2013 at 01:24:01PM +0100, Daniel Vetter wrote:
> > The update is horribly racy since it doesn't protect at all against
> > concurrent closing of the master fd. And it can't really since that
> > requires us to grab a mutex.
> > 
> > Instead of jumping through hoops and offloading this to a worker
> > thread just block this bit of code for the modesetting driver.
> > 
> > Reported-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
> > Cc: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> We should also not be calling update_dri1_breadcrumb unless we have a
> USER_INTERRUPT. The other updates to the breadcrumb hws index do not
> appear to be serialised by anything other than polling.

Well, this is what's been there before and I don't really want to touch
dri1/ums code at all. So I think we'll just keep this here until we'll all
put it on the big pyre ;-)
-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

* Re: [PATCH] drm/i915: don't update the dri1 breadcrumb with modesetting
  2013-12-10 13:48   ` Daniel Vetter
@ 2013-12-11 11:06     ` Daniel Vetter
  2013-12-11 13:04       ` Eugene Shatokhin
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2013-12-11 11:06 UTC (permalink / raw)
  To: Chris Wilson, Daniel Vetter, Intel Graphics Development,
	Eugene Shatokhin, stable

On Tue, Dec 10, 2013 at 02:48:23PM +0100, Daniel Vetter wrote:
> On Tue, Dec 10, 2013 at 12:44:12PM +0000, Chris Wilson wrote:
> > On Tue, Dec 10, 2013 at 01:24:01PM +0100, Daniel Vetter wrote:
> > > The update is horribly racy since it doesn't protect at all against
> > > concurrent closing of the master fd. And it can't really since that
> > > requires us to grab a mutex.
> > > 
> > > Instead of jumping through hoops and offloading this to a worker
> > > thread just block this bit of code for the modesetting driver.
> > > 
> > > Reported-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
> > > Cc: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
> > > Cc: stable@vger.kernel.org
> > > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > We should also not be calling update_dri1_breadcrumb unless we have a
> > USER_INTERRUPT. The other updates to the breadcrumb hws index do not
> > appear to be serialised by anything other than polling.
> 
> Well, this is what's been there before and I don't really want to touch
> dri1/ums code at all. So I think we'll just keep this here until we'll all
> put it on the big pyre ;-)

Chris and I discusssed the commit message a bit on irc and now the hack
also spurts a code comment. Merged to -fixes for now, but I'd still like
to get a tested by from Eugene before sending off the pull request.
-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

* Re: [PATCH] drm/i915: don't update the dri1 breadcrumb with modesetting
  2013-12-11 11:06     ` Daniel Vetter
@ 2013-12-11 13:04       ` Eugene Shatokhin
  0 siblings, 0 replies; 5+ messages in thread
From: Eugene Shatokhin @ 2013-12-11 13:04 UTC (permalink / raw)
  To: Daniel Vetter, Chris Wilson, Intel Graphics Development, stable

On 12/11/2013 03:06 PM, Daniel Vetter wrote:
> On Tue, Dec 10, 2013 at 02:48:23PM +0100, Daniel Vetter wrote:
>> On Tue, Dec 10, 2013 at 12:44:12PM +0000, Chris Wilson wrote:
>>> On Tue, Dec 10, 2013 at 01:24:01PM +0100, Daniel Vetter wrote:
>>>> The update is horribly racy since it doesn't protect at all against
>>>> concurrent closing of the master fd. And it can't really since that
>>>> requires us to grab a mutex.
>>>>
>>>> Instead of jumping through hoops and offloading this to a worker
>>>> thread just block this bit of code for the modesetting driver.
>>>>
>>>> Reported-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
>>>> Cc: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
>>>> Cc: stable@vger.kernel.org
>>>> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>>
>>> We should also not be calling update_dri1_breadcrumb unless we have a
>>> USER_INTERRUPT. The other updates to the breadcrumb hws index do not
>>> appear to be serialised by anything other than polling.
>>
>> Well, this is what's been there before and I don't really want to touch
>> dri1/ums code at all. So I think we'll just keep this here until we'll all
>> put it on the big pyre ;-)
>
> Chris and I discusssed the commit message a bit on irc and now the hack
> also spurts a code comment. Merged to -fixes for now, but I'd still like
> to get a tested by from Eugene before sending off the pull request.
> -Daniel
>

Built 3.10.23 with the fix, tested today. The problem has not shown up 
so far.

Tested-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>

-- 
Eugene Shatokhin, ROSA Laboratory.
www.rosalab.com

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

end of thread, other threads:[~2013-12-11 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10 12:24 [PATCH] drm/i915: don't update the dri1 breadcrumb with modesetting Daniel Vetter
2013-12-10 12:44 ` [Intel-gfx] " Chris Wilson
2013-12-10 13:48   ` Daniel Vetter
2013-12-11 11:06     ` Daniel Vetter
2013-12-11 13:04       ` Eugene Shatokhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox