From: Daniel Vetter <daniel@ffwll.ch>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: Egbert Eich <eich@suse.de>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 8/8] drm/i915: fix hpd interrupt register locking
Date: Thu, 27 Jun 2013 19:44:49 +0200 [thread overview]
Message-ID: <20130627174449.GT18285@phenom.ffwll.local> (raw)
In-Reply-To: <CA+gsUGSs7n4pBErMdf68LtzYRyDabcX66AUxMW++Z+iYyoyicg@mail.gmail.com>
On Thu, Jun 27, 2013 at 11:41:25AM -0300, Paulo Zanoni wrote:
> 2013/6/27 Daniel Vetter <daniel.vetter@ffwll.ch>:
> > Our interrupt handler (in hardird context) could race with the timer
>
> s/hardird/hardirq/
>
> > (in softirq context), hence we need to hold the spinlock around the
> > call to ->hdp_irq_setup in intel_hpd_irq_handler, too.
> >
> > But as an optimization (and more so to clarify things) we don't need
> > to do the irqsave/restore dance in the hardirq context.
> >
> > Note also that on ilk+ the race isn't just against the hotplug
> > reenable timer, but also against the fifo underrun reporting. That one
> > also modifies the SDEIMR register (again protected by the same
> > dev_priv->irq_lock).
> >
> > To lock things down again sprinkle a assert_spin_locked. But exclude
> > the functions touching SDEIMR for now, I want to extract them all into
> > a new helper function (like we do already for pipestate, display
> > interrupts and all the various gt interrupts).
> >
> > v2: Add the missing 't' Egbert spotted in a comment.
> >
> > Cc: Egbert Eich <eich@suse.de>
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > ---
> > drivers/gpu/drm/i915/i915_irq.c | 17 +++++++++++------
> > 1 file changed, 11 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> > index 95999bc..6637575 100644
> > --- a/drivers/gpu/drm/i915/i915_irq.c
> > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > @@ -881,15 +881,13 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev,
> > const u32 *hpd)
> > {
> > drm_i915_private_t *dev_priv = dev->dev_private;
> > - unsigned long irqflags;
> > int i;
> > bool storm_detected = false;
> >
> > if (!hotplug_trigger)
> > return;
> >
> > - spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
> > -
> > + spin_lock(&dev_priv->irq_lock);
> > for (i = 1; i < HPD_NUM_PINS; i++) {
> >
> > if (!(hpd[i] & hotplug_trigger) ||
> > @@ -912,10 +910,9 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev,
> > }
> > }
> >
> > - spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
> > -
> > if (storm_detected)
> > dev_priv->display.hpd_irq_setup(dev);
> > + spin_unlock(&dev_priv->irq_lock);
> >
> > queue_work(dev_priv->wq,
> > &dev_priv->hotplug_work);
> > @@ -2851,7 +2848,7 @@ static int valleyview_irq_postinstall(struct drm_device *dev)
> > I915_WRITE(PIPESTAT(1), 0xffff);
> > POSTING_READ(VLV_IER);
> >
> > - /* Interrup setup is already guaranteed to be single-threaded, this is
> > + /* Interrupt setup is already guaranteed to be single-threaded, this is
>
> Here you're fixing an error introduced in patch 03, instead of the
> error pointed by Egbert.
>
> > * just to make the assert_spin_locked check happy. */
> > spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
> > i915_enable_pipestat(dev_priv, 0, pipestat_enable);
> > @@ -3395,6 +3392,8 @@ static void i915_hpd_irq_setup(struct drm_device *dev)
> > struct intel_encoder *intel_encoder;
> > u32 hotplug_en;
> >
> > + assert_spin_locked(&dev_priv->irq_lock);
> > +
> > if (I915_HAS_HOTPLUG(dev)) {
> > hotplug_en = I915_READ(PORT_HOTPLUG_EN);
> > hotplug_en &= ~HOTPLUG_INT_EN_MASK;
> > @@ -3678,6 +3677,7 @@ void intel_hpd_init(struct drm_device *dev)
> > struct drm_i915_private *dev_priv = dev->dev_private;
> > struct drm_mode_config *mode_config = &dev->mode_config;
> > struct drm_connector *connector;
> > + unsigned long irqflags;
> > int i;
> >
> > for (i = 1; i < HPD_NUM_PINS; i++) {
> > @@ -3690,6 +3690,11 @@ void intel_hpd_init(struct drm_device *dev)
> > if (!connector->polled && I915_HAS_HOTPLUG(dev) && intel_connector->encoder->hpd_pin > HPD_NONE)
> > connector->polled = DRM_CONNECTOR_POLL_HPD;
> > }
> > +
> > + /* Interrup setup is already guaranteed to be single-threaded, this is
>
> s/Interrup/Interrupt/
>
>
>
> > + * just to make the assert_spin_locked checks happy. */
> > + spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
> > if (dev_priv->display.hpd_irq_setup)
> > dev_priv->display.hpd_irq_setup(dev);
> > + spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
> > }
> > --
> > 1.8.1.4
> >
>
> So here's the review status for the 8 patches resent today:
> - Patches 1 and 2: Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> - Patch 3: in two comments you need to s/Interrup/Interrupt/. Then you
> can add Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> - Patches 4-7: You already have my Reviewed-by, but if you look in the
> commit messages, some lines contain just my name and email, without
> the "Reviewed-by:" text before them. I also wouldn't mind if you
> resend patches 6 and 7 based on Chris's comments, but I don't really
> care since the problem is actually solved in patch 7.
> - Patch 8: due to the change you'll do in patch 3, you'll have to redo
> patch 8. If you fix both the "Interrup" and the "hardird" typo you can
> also add Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
>
> I also booted a Haswell with these new patches and after 120 seconds
> of uptime I don't see any new WARNs or ERRORs.
Ok, I've merged the first 8 patches from this series, thanks for the
review.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2013-06-27 17:44 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-12 11:37 [PATCH 00/24] irq locking review Daniel Vetter
2013-06-12 11:37 ` [PATCH 01/24] drm/i915: fix locking around ironlake_enable|disable_display_irq Daniel Vetter
2013-06-25 12:26 ` [PATCH] " Daniel Vetter
2013-06-26 21:15 ` Paulo Zanoni
2013-06-27 10:37 ` Daniel Vetter
2013-06-12 11:37 ` [PATCH 02/24] drm/i915: close tiny race in the ilk pcu even interrupt setup Daniel Vetter
2013-06-26 21:20 ` Paulo Zanoni
2013-06-12 11:37 ` [PATCH 03/24] drm/i915: assert_spin_locked for pipestat interrupt enable/disable Daniel Vetter
2013-06-26 21:44 ` Paulo Zanoni
2013-06-12 11:37 ` [PATCH 04/24] drm/i915: s/hotplug_irq_storm_detect/intel_hpd_irq_handler/ Daniel Vetter
2013-06-12 14:22 ` Egbert Eich
2013-06-12 11:37 ` [PATCH 05/24] drm/i915: fold the hpd_irq_setup call into intel_hpd_irq_handler Daniel Vetter
[not found] ` <20920.34096.704203.67316@linux-qknr.site>
2013-06-12 15:00 ` Daniel Vetter
2013-06-12 11:37 ` [PATCH 06/24] drm/i915: fold the queue_work " Daniel Vetter
2013-06-12 14:29 ` Egbert Eich
2013-06-12 11:37 ` [PATCH 07/24] drm/i915: fold the no-irq check " Daniel Vetter
2013-06-12 14:33 ` Egbert Eich
2013-06-26 22:35 ` Paulo Zanoni
2013-06-27 10:39 ` Daniel Vetter
2013-06-27 11:44 ` [PATCH 1/8] drm/i915: fix locking around ironlake_enable|disable_display_irq Daniel Vetter
2013-06-27 11:44 ` [PATCH 2/8] drm/i915: close tiny race in the ilk pcu even interrupt setup Daniel Vetter
2013-06-27 11:45 ` [PATCH 3/8] drm/i915: assert_spin_locked for pipestat interrupt enable/disable Daniel Vetter
2013-06-27 11:45 ` [PATCH 4/8] drm/i915: s/hotplug_irq_storm_detect/intel_hpd_irq_handler/ Daniel Vetter
2013-06-27 11:45 ` [PATCH 5/8] drm/i915: fold the hpd_irq_setup call into intel_hpd_irq_handler Daniel Vetter
2013-06-27 11:45 ` [PATCH 6/8] drm/i915: fold the queue_work " Daniel Vetter
2013-06-27 12:13 ` Chris Wilson
2013-06-27 11:45 ` [PATCH 7/8] drm/i915: fold the no-irq check " Daniel Vetter
2013-06-27 12:14 ` Chris Wilson
2013-06-27 11:45 ` [PATCH 8/8] drm/i915: fix hpd interrupt register locking Daniel Vetter
2013-06-27 14:41 ` Paulo Zanoni
2013-06-27 15:52 ` [PATCH 1/6] drm/i915: assert_spin_locked for pipestat interrupt enable/disable Daniel Vetter
2013-06-27 15:52 ` [PATCH 2/6] drm/i915: s/hotplug_irq_storm_detect/intel_hpd_irq_handler/ Daniel Vetter
2013-06-27 15:52 ` [PATCH 3/6] drm/i915: fold the hpd_irq_setup call into intel_hpd_irq_handler Daniel Vetter
2013-06-27 15:52 ` [PATCH 4/6] drm/i915: fold the queue_work " Daniel Vetter
2013-06-27 15:52 ` [PATCH 5/6] drm/i915: fold the no-irq check " Daniel Vetter
2013-06-27 15:52 ` [PATCH 6/6] drm/i915: fix hpd interrupt register locking Daniel Vetter
2013-07-04 19:22 ` [PATCH 1/6] drm/i915: assert_spin_locked for pipestat interrupt enable/disable Daniel Vetter
2013-06-27 17:44 ` Daniel Vetter [this message]
2013-06-12 11:37 ` [PATCH 08/24] drm/i915: fix hpd interrupt register locking Daniel Vetter
2013-06-12 14:59 ` Egbert Eich
2013-06-12 15:10 ` Daniel Vetter
2013-06-12 11:37 ` [PATCH 09/24] drm/i915: extract ibx_display_interrupt_update Daniel Vetter
2013-06-25 12:27 ` [PATCH] " Daniel Vetter
2013-06-12 11:37 ` [PATCH 10/24] drm/i915: remove SERR_INT clearing in the postinstall hook Daniel Vetter
2013-06-27 19:34 ` Paulo Zanoni
2013-07-04 19:49 ` Daniel Vetter
2013-06-12 11:37 ` [PATCH 11/24] drm/i915: improve SERR_INT clearing for fifo underrun reporting Daniel Vetter
2013-06-27 20:19 ` Paulo Zanoni
2013-07-04 19:55 ` Daniel Vetter
2013-06-12 11:37 ` [PATCH 12/24] drm/i915: improve GEN7_ERR_INT " Daniel Vetter
2013-06-12 11:37 ` [PATCH 13/24] drm/i915: kill lpt pch transcoder->crtc mapping code for fifo underruns Daniel Vetter
2013-06-12 13:04 ` Paulo Zanoni
2013-06-12 14:46 ` [PATCH] " Daniel Vetter
2013-06-27 20:45 ` Paulo Zanoni
2013-07-04 20:41 ` Daniel Vetter
2013-06-12 11:37 ` [PATCH 14/24] drm/i915: irq handlers don't need interrupt-safe spinlocks Daniel Vetter
2013-06-25 12:27 ` [PATCH] " Daniel Vetter
2013-06-27 21:14 ` Paulo Zanoni
2013-06-27 22:40 ` Daniel Vetter
2013-06-28 16:57 ` Paulo Zanoni
2013-06-12 11:37 ` [PATCH 15/24] drm/i915: streamline hsw_pm_irq_handler Daniel Vetter
2013-06-25 12:28 ` [PATCH] " Daniel Vetter
2013-06-12 11:37 ` [PATCH 16/24] drm/i915: queue work outside spinlock in hsw_pm_irq_handler Daniel Vetter
2013-06-12 11:37 ` [PATCH 17/24] drm/i915: kill dev_priv->rps.lock Daniel Vetter
2013-06-28 3:35 ` Ben Widawsky
2013-06-28 3:35 ` Ben Widawsky
2013-06-12 11:37 ` [PATCH 18/24] drm/i915: unify ring irq refcounts (again) Daniel Vetter
2013-06-28 17:24 ` Ben Widawsky
2013-07-04 20:52 ` Daniel Vetter
2013-06-12 11:37 ` [PATCH 19/24] drm/i915: don't enable PM_VEBOX_CS_ERROR_INTERRUPT Daniel Vetter
2013-06-12 17:13 ` Ben Widawsky
2013-06-12 17:18 ` Daniel Vetter
2013-06-12 18:19 ` Ben Widawsky
2013-06-12 18:32 ` Daniel Vetter
2013-06-12 18:51 ` Ben Widawsky
2013-06-28 17:25 ` Ben Widawsky
2013-06-12 11:37 ` [PATCH 20/24] drm/i915: kill bogus GTIIR clearing in vlv_preinstall hook Daniel Vetter
2013-06-28 17:01 ` Ben Widawsky
2013-07-04 20:56 ` Daniel Vetter
2013-06-12 11:37 ` [PATCH 21/24] drm/i915: unify PM interrupt preinstall sequence Daniel Vetter
2013-06-28 17:26 ` Ben Widawsky
2013-07-04 21:03 ` Daniel Vetter
2013-06-12 11:37 ` [PATCH 22/24] drm/i915: unify GT/PM irq postinstall code Daniel Vetter
2013-06-12 11:37 ` [PATCH 23/24] drm/i915: extract rps interrupt enable/disable helpers Daniel Vetter
2013-06-12 11:37 ` [PATCH 24/24] drm/i915: simplify rps interrupt enabling/disabling sequence Daniel Vetter
2013-06-12 22:32 ` Ben Widawsky
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=20130627174449.GT18285@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=daniel.vetter@ffwll.ch \
--cc=eich@suse.de \
--cc=intel-gfx@lists.freedesktop.org \
--cc=przanoni@gmail.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