From: Daniel Vetter <daniel@ffwll.ch>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 6/8] drm/i915: add struct_mutex WARNs to i915_gem_stolen.c
Date: Wed, 1 Jul 2015 17:43:35 +0200 [thread overview]
Message-ID: <20150701154335.GA23343@phenom.ffwll.local> (raw)
In-Reply-To: <55940491.4010308@virtuousgeek.org>
On Wed, Jul 01, 2015 at 08:17:37AM -0700, Jesse Barnes wrote:
> On 07/01/2015 06:56 AM, Daniel Vetter wrote:
> > On Tue, Jun 30, 2015 at 01:30:27PM -0700, Jesse Barnes wrote:
> >> On 06/30/2015 07:36 AM, Chris Wilson wrote:
> >>> On Tue, Jun 30, 2015 at 11:26:11AM -0300, Paulo Zanoni wrote:
> >>>> 2015-06-30 11:15 GMT-03:00 Chris Wilson <chris@chris-wilson.co.uk>:
> >>>>> On Tue, Jun 30, 2015 at 10:53:10AM -0300, Paulo Zanoni wrote:
> >>>>>> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> >>>>>>
> >>>>>> Let's make sure the future Paulos don't forget that we need
> >>>>>> struct_mutex when touching dev_priv->mm.stolen.
> >>>>>>
> >>>>>> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> >>>>>> ---
> >>>>>> drivers/gpu/drm/i915/i915_gem_stolen.c | 13 +++++++++++++
> >>>>>> 1 file changed, 13 insertions(+)
> >>>>>>
> >>>>>> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> >>>>>> index 793bcba..cac1bce 100644
> >>>>>> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> >>>>>> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> >>>>>> @@ -160,6 +160,8 @@ static int find_compression_threshold(struct drm_device *dev,
> >>>>>> int compression_threshold = 1;
> >>>>>> int ret;
> >>>>>>
> >>>>>> + WARN_ON(!mutex_is_locked(&dev->struct_mutex));
> >>>>>
> >>>>> I'm not a huge fan of vague mutex warnings that don't even check the owner.
> >>>>> I'm espcially not a fan of adding a WARN and not handling the error.
> >>>>
> >>>> But then, what exactly is your proposal? What would you like to see here?
> >>>>
> >>>> We can discard this patch if you want. But I hope you're not
> >>>> advocating for lockdep_assert_held(), because if I switch to lockdep,
> >>>> then Daniel is going to deny it again. Also, this type of WARN_ON is a
> >>>> common pattern on our codebase...
> >>>
> >>> I'm just trying to convince Daniel that blindly using this pattern is
> >>> the wrong approach and encouraging a proliferation of unhandled WARN_ON
> >>> doesn't improve driver robustness.
> >>
> >> I think they serve as useful documentation at the very least, whether in
> >> lockdep form, WARN form, or BUG form. It's not really something we can
> >> recover from either (maybe returning early before touching data?), so...
> >
> > Not grabbing a lock is generally a harmless error since real races out
> > there are rare with X being single-threaded and all that. Especially in
> > stuff called from modeset code. Hence I think just WARN_ON plus continuing
> > on with blissful ignorance is the best approach.
> >
> > I don't the lockdep versions personally since they don't work when lockdep
> > is disabled, which is pretty much always the case. Might be useful to do
> > an assert_mutex_held which always does the most paranoid check (i.e.
> > WARN_ON without lockdep, lockdep_assert_held with lockdep).
>
> Maybe we should add WARN_ONs to the lockdep_assert macros in the
> !CONFIG_LOCKDEP case. That would give us documentation, checking in
> both cases, and everyone would be happy, right?
tbh never tried that ;-)
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-07-01 15:40 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 13:53 [PATCH 0/8] FBC locking v3 Paulo Zanoni
2015-06-30 13:53 ` [PATCH 1/8] drm/i915: don't increment the FBC threshold at fbc_enable Paulo Zanoni
2015-06-30 14:22 ` Chris Wilson
2015-07-01 13:52 ` Daniel Vetter
2015-06-30 13:53 ` [PATCH 2/8] drm/i915: add the FBC mutex Paulo Zanoni
2015-06-30 14:10 ` Chris Wilson
2015-06-30 14:12 ` Chris Wilson
2015-06-30 14:25 ` Chris Wilson
2015-06-30 14:34 ` Paulo Zanoni
2015-06-30 13:53 ` [PATCH 3/8] drm/i915: remove unneded locks on debugs FBC functions Paulo Zanoni
2015-06-30 13:53 ` [PATCH 4/8] drm/i915: remove struct_mutex lock from the FBC work function Paulo Zanoni
2015-06-30 13:53 ` [PATCH 5/8] drm/i915: simplify FBC start/stop at invalidate/flush Paulo Zanoni
2015-06-30 14:34 ` Chris Wilson
2015-06-30 21:12 ` Paulo Zanoni
2015-07-01 14:04 ` Chris Wilson
2015-06-30 13:53 ` [PATCH 6/8] drm/i915: add struct_mutex WARNs to i915_gem_stolen.c Paulo Zanoni
2015-06-30 14:15 ` Chris Wilson
2015-06-30 14:26 ` Paulo Zanoni
2015-06-30 14:36 ` Chris Wilson
2015-06-30 20:30 ` Jesse Barnes
2015-06-30 21:00 ` Chris Wilson
2015-07-01 13:56 ` Daniel Vetter
2015-07-01 15:17 ` Jesse Barnes
2015-07-01 15:43 ` Daniel Vetter [this message]
2015-06-30 14:34 ` Chris Wilson
2015-07-01 14:00 ` Daniel Vetter
2015-07-01 14:02 ` Chris Wilson
2015-07-01 14:03 ` Paulo Zanoni
2015-06-30 13:53 ` [PATCH 7/8] drm/i915: reduce struct_mutex coverage at intel_crtc_page_flip() Paulo Zanoni
2015-06-30 13:53 ` [PATCH 8/8] drm/i915: remove struct_mutex lock from intel_modeset_cleanup() Paulo Zanoni
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=20150701154335.GA23343@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.org \
--cc=paulo.r.zanoni@intel.com \
/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