All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [RFC 1/4] drm/i915: split out uncore_mmio_debug
Date: Wed, 26 Jun 2019 18:58:18 +0100	[thread overview]
Message-ID: <156157189800.26855.15905781510534161945@skylake-alporthouse-com> (raw)
In-Reply-To: <35062553-0982-376a-3b4a-4dcf19524c12@intel.com>

Quoting Daniele Ceraolo Spurio (2019-06-26 18:38:45)
> 
> 
> On 6/26/19 3:02 AM, Chris Wilson wrote:
> > Quoting Daniele Ceraolo Spurio (2019-06-24 21:31:49)
> >> @@ -605,18 +614,20 @@ void intel_uncore_forcewake_get(struct intel_uncore *uncore,
> >>   void intel_uncore_forcewake_user_get(struct intel_uncore *uncore)
> >>   {
> >>          spin_lock_irq(&uncore->lock);
> >> +       spin_lock(&uncore->debug->lock);
> >>          if (!uncore->user_forcewake.count++) {
> > 
> > Afaict, uncore->user_forcewake.count is only guarded by uncore->lock
> > and we only need to take debug->lock for the debug->unclaimed_mmio_check
> > manipulation. But there needs to be a shared usage counter around the
> > debug as it is shared state.
> > 
> >>                  intel_uncore_forcewake_get__locked(uncore, FORCEWAKE_ALL);
> >>   
> >>                  /* Save and disable mmio debugging for the user bypass */
> >>                  uncore->user_forcewake.saved_mmio_check =
> >> -                       uncore->unclaimed_mmio_check;
> >> +                       uncore->debug->unclaimed_mmio_check;
> >>                  uncore->user_forcewake.saved_mmio_debug =
> >>                          i915_modparams.mmio_debug;
> > 
> > Something more like
> > 
> > spin_lock_irq(&uncore->lock);
> > if (!uncore->user_forcewake_count++) {
> >       spin_lock(&uncore->debug->lock);
> >       if (!uncore->debug->usage_count++) {
> >               ...
> >       }
> >       spin_unlock(&uncore->debug->lock);
> > }
> > ...
> > spin_unlock_irq(&uncore->lock);
> > ?
> > -Chris
> > 
> 
> I do something similar in the next patch in the series (with the lock 
> still on the outside of the if). I've split that out because I've added 
> some functional changes to the flow. I can squash the 2 patches if you 
> thing it is better that way.

Yes. Looking at the second patch, that is clearer wrt what data we are
guarding with the locks.

Don't drop the intel_ prefix from intel_uncore_debug as it looks to
still be visible outside of its enclave (it's getting long, but it should
be more or less internal to the various intel_uncore implementations) and
squash these 2 as I feel more comfortable with intel_uncore_debug taking
control of the locking as required for sharing and reviewing the locking
wrt to the shared data.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-06-26 17:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24 20:31 [RFC 0/4] Display uncore Daniele Ceraolo Spurio
2019-06-24 20:31 ` [RFC 1/4] drm/i915: split out uncore_mmio_debug Daniele Ceraolo Spurio
2019-06-26 10:02   ` Chris Wilson
2019-06-26 17:38     ` Daniele Ceraolo Spurio
2019-06-26 17:58       ` Chris Wilson [this message]
2019-06-26 18:20         ` Daniele Ceraolo Spurio
2019-06-24 20:31 ` [RFC 2/4] drm/i915: rework mmio debug stop/start Daniele Ceraolo Spurio
2019-06-24 20:31 ` [RFC 3/4] drm/i915: introduce display_uncore Daniele Ceraolo Spurio
2019-06-26 18:42   ` Ville Syrjälä
2019-06-26 20:27     ` Daniele Ceraolo Spurio
2019-06-27 12:41       ` Ville Syrjälä
2019-06-24 20:31 ` [RFC 4/4] drm/i915: convert intel_hdmi to display reg accessors Daniele Ceraolo Spurio
2019-06-24 20:43 ` ✗ Fi.CI.SPARSE: warning for Display uncore (rev2) Patchwork
2019-06-24 21:37 ` ✓ Fi.CI.BAT: success " Patchwork
2019-06-25  1:04 ` ✓ Fi.CI.IGT: " Patchwork

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=156157189800.26855.15905781510534161945@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=daniele.ceraolospurio@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.