public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Daniel Vetter <daniel@ffwll.ch>,
	intel-gfx@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH] drm/i915: Localise the fbdev console lock frobbing
Date: Wed, 13 Aug 2014 15:40:24 +0200	[thread overview]
Message-ID: <20140813134024.GC10500@phenom.ffwll.local> (raw)
In-Reply-To: <20140813130922.GH10052@nuc-i3427.alporthouse.com>

On Wed, Aug 13, 2014 at 02:09:22PM +0100, Chris Wilson wrote:
> On Wed, Aug 13, 2014 at 03:04:02PM +0200, Daniel Vetter wrote:
> > On Wed, Aug 13, 2014 at 01:58:30PM +0100, Chris Wilson wrote:
> > > On Wed, Aug 13, 2014 at 02:46:53PM +0200, Daniel Vetter wrote:
> > > > On Wed, Aug 13, 2014 at 01:09:46PM +0100, Chris Wilson wrote:
> > > > > Rather than take and release the console_lock() around a non-existent
> > > > > DRM_I915_FBDEV, move the lock acquisation into the callee where it will
> > > > > be compiled out by the config option entirely. This includes moving the
> > > > > deferred fb_set_suspend() dance and encapsulating it entirely within
> > > > > intel_fbdev.c.
> > > > > 
> > > > > v2: Use an integral work item so that we can explicitly flush the work
> > > > > upon suspend/unload.
> > > > > 
> > > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > > > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > > > ---
> > > > >  drivers/gpu/drm/i915/i915_dma.c    |  3 ---
> > > > >  drivers/gpu/drm/i915/i915_drv.c    | 28 ++-----------------------
> > > > >  drivers/gpu/drm/i915/i915_drv.h    |  9 +-------
> > > > >  drivers/gpu/drm/i915/intel_drv.h   |  4 ++--
> > > > >  drivers/gpu/drm/i915/intel_fbdev.c | 42 +++++++++++++++++++++++++++++++++++++-
> > > > >  5 files changed, 46 insertions(+), 40 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> > > > > index 860da759ae34..fbab9370cb5c 100644
> > > > > --- a/drivers/gpu/drm/i915/i915_dma.c
> > > > > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > > > > @@ -1339,8 +1339,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
> > > > >  	if (ret)
> > > > >  		goto cleanup_irq;
> > > > >  
> > > > > -	INIT_WORK(&dev_priv->console_resume_work, intel_console_resume);
> > > > > -
> > > > >  	intel_modeset_gem_init(dev);
> > > > >  
> > > > >  	/* Always safe in the mode setting case. */
> > > > > @@ -1857,7 +1855,6 @@ int i915_driver_unload(struct drm_device *dev)
> > > > >  	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> > > > >  		intel_fbdev_fini(dev);
> > > > >  		intel_modeset_cleanup(dev);
> > > > > -		cancel_work_sync(&dev_priv->console_resume_work);
> > > > 
> > > > This one here seems to have been lost - shouldn't we move this to
> > > > fbdev_fini instead? Otherwise this looks good imo, so I'll fix that up
> > > > while merging if you're ok.
> > > 
> > > Hmm, I counted on us calling suspend before intel_fbdev_fini() in
> > > unload. Is this not the case? Otherwise I think we should be suspending
> > > the console.
> > 
> > We don't do any of that. Unregistering the fbdev emulation in fbdev_fini
> > should be enough though to stop anyone from actually using the gpu, and
> > we're careful to unregister other console drivers like vgacon to make sure
> > no one else can grow stupid ideas.
> > 
> > So I think the only concern really is that the work item completes before
> > the text section disappears, and maybe (on multi-gpu systems) that we
> > don't keep all fbdev devices disabled forever after a racy module unload.
> 
> Ok, I followed the unload->fbdev_fini->unregister_console and concur
> that all you want is the flush_work() in fbdev_fini.

Done&merged, thanks a lot for the patch - looks much better than my #ifdef
hacks ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-08-13 13:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12 14:15 [PATCH] drm/i915: Localise the fbdev console lock frobbing Chris Wilson
2014-08-13 11:26 ` Daniel Vetter
2014-08-13 11:32   ` Chris Wilson
2014-08-13 11:39     ` Daniel Vetter
2014-08-13 12:00       ` Chris Wilson
2014-08-13 12:05       ` Chris Wilson
2014-08-13 12:09       ` Chris Wilson
2014-08-13 12:46         ` Daniel Vetter
2014-08-13 12:58           ` Chris Wilson
2014-08-13 13:04             ` Daniel Vetter
2014-08-13 13:09               ` Chris Wilson
2014-08-13 13:40                 ` Daniel Vetter [this message]
2014-08-14  6:54                   ` Chris Wilson
2014-08-14  8:35                     ` Daniel Vetter
2014-08-14 10:07                       ` BUG_ON vs WARN_ON (was: Re: [PATCH] drm/i915: Localise the fbdev console lock frobbing) Jani Nikula
2014-08-14 14:18                         ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140813134024.GC10500@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox