From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2] RFC drm/i915: Mark runtime_pm as a special class of lock
Date: Mon, 6 Aug 2018 17:58:28 +0200 [thread overview]
Message-ID: <20180806155828.GS3008@phenom.ffwll.local> (raw)
In-Reply-To: <153148859799.24385.3761577009024576125@skylake-alporthouse-com>
On Fri, Jul 13, 2018 at 02:29:58PM +0100, Chris Wilson wrote:
> Quoting Daniel Vetter (2018-07-12 13:58:11)
> > On Thu, Jul 12, 2018 at 09:41:07AM +0100, Chris Wilson wrote:
> > > Quoting Chris Wilson (2018-07-12 09:36:33)
> > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > > ---
> > > > drivers/gpu/drm/i915/i915_drv.c | 5 +++++
> > > > drivers/gpu/drm/i915/i915_drv.h | 1 +
> > > > drivers/gpu/drm/i915/intel_runtime_pm.c | 11 +++++++++++
> > > > 3 files changed, 17 insertions(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > > > index 3eba3d1ab5b8..2e6d3259f6d0 100644
> > > > --- a/drivers/gpu/drm/i915/i915_drv.c
> > > > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > > > @@ -2603,6 +2603,7 @@ static int intel_runtime_suspend(struct device *kdev)
> > > > DRM_DEBUG_KMS("Suspending device\n");
> > > >
> > > > disable_rpm_wakeref_asserts(dev_priv);
> > > > + lock_map_acquire(&dev_priv->runtime_pm.lock);
> > > >
> > > > /*
> > > > * We are safe here against re-faults, since the fault handler takes
> > > > @@ -2637,11 +2638,13 @@ static int intel_runtime_suspend(struct device *kdev)
> > > > i915_gem_init_swizzling(dev_priv);
> > > > i915_gem_restore_fences(dev_priv);
> > > >
> > > > + lock_map_release(&dev_priv->runtime_pm.lock);
> > > > enable_rpm_wakeref_asserts(dev_priv);
> > > >
> > > > return ret;
> > > > }
> > > >
> > > > + lock_map_release(&dev_priv->runtime_pm.lock);
> > >
> > > What happens if we don't release the lock here? I think that's what we
> > > want... While suspended we are not allowed to do any action that would
> > > ordinarily require a wakeref. However that scares me for being both
> > > incredibly broad, and that I think lockdep is process centric so doesn't
> > > track locks in this manner?
> >
> > Lockdep requires that acquire&release are in the same process context. For
> > dependencies crossing boundaries we want a cross-release. And yes I think
> > a cross-release dependency between our rpm_suspend and rpm_get is required
> > for full anotation. But since cross-release is suffering in limbo due to
> > meltdown/spectre that's a way off still :-/
>
> Bah, we can't do it without cross-release as we pass our wakelock around
> a lot. We start off with an unbalanced lock and never recover. Drat, I
> was hoping this would make verifying the vm.mutex vs runtime_pm more
> convincing.
Yes rpm_get/put is essentially full rwsemaphore which can also move
between process. It's the most evil of locks, and cross-release would
help a lot.
But given how hard a time cross-release with just the minimal waitqueue
annotations has, and how much fun everyone has with making rpm not
deadlock too much, I'm not really holding out for proper cross-release
annotations for rpm in upstream. And we really need them in upstream or
we'll spend 200% of our time fixing everyone else's bugs :-/
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-08-06 15:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-12 8:20 [PATCH] RFC drm/i915: Mark runtime_pm as a special class of lock Chris Wilson
2018-07-12 8:33 ` Chris Wilson
2018-07-12 8:37 ` Daniel Vetter
2018-07-12 8:36 ` [PATCH v2] " Chris Wilson
2018-07-12 8:41 ` Chris Wilson
2018-07-12 12:58 ` Daniel Vetter
2018-07-13 13:29 ` Chris Wilson
2018-08-06 15:58 ` Daniel Vetter [this message]
2018-07-12 9:40 ` ✗ Fi.CI.SPARSE: warning for RFC drm/i915: Mark runtime_pm as a special class of lock (rev2) Patchwork
2018-07-12 10:12 ` ✓ Fi.CI.BAT: success " Patchwork
2018-07-12 10:14 ` Chris Wilson
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=20180806155828.GS3008@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=chris@chris-wilson.co.uk \
--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