From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 11/15] drm/i915: Protect DSPARB registers with a spinlock
Date: Fri, 2 Dec 2016 11:57:46 +0200 [thread overview]
Message-ID: <20161202095746.GQ31595@intel.com> (raw)
In-Reply-To: <9254f61c-e3e6-6089-a12c-7217bc39c7a9@linux.intel.com>
On Thu, Dec 01, 2016 at 03:45:35PM +0100, Maarten Lankhorst wrote:
> Op 01-12-16 om 14:13 schreef Ville Syrjälä:
> > On Thu, Dec 01, 2016 at 12:56:16PM +0100, Maarten Lankhorst wrote:
> >> Op 28-11-16 om 18:37 schreef ville.syrjala@linux.intel.com:
> >>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >>>
> >>> Each DSPARB register can house bits for two separate pipes, hence
> >>> we must protect the registers during reprogramming so that parallel
> >>> FIFO reconfigurations happening simultaneosly on multiple pipes won't
> >>> corrupt each others values.
> >>>
> >>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >>> ---
> >>> drivers/gpu/drm/i915/i915_drv.c | 1 +
> >>> drivers/gpu/drm/i915/i915_drv.h | 3 +++
> >>> drivers/gpu/drm/i915/intel_pm.c | 6 ++++++
> >>> 3 files changed, 10 insertions(+)
> >>>
> >>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> >>> index 0fba4bb5655e..c98032e9112b 100644
> >>> --- a/drivers/gpu/drm/i915/i915_drv.c
> >>> +++ b/drivers/gpu/drm/i915/i915_drv.c
> >>> @@ -811,6 +811,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
> >>> spin_lock_init(&dev_priv->uncore.lock);
> >>> spin_lock_init(&dev_priv->mm.object_stat_lock);
> >>> spin_lock_init(&dev_priv->mmio_flip_lock);
> >>> + spin_lock_init(&dev_priv->wm.dsparb_lock);
> >> Can we make sure all wm updates are done with dev_priv->wm.wm_mutex held instead?
> > We can't grab a mutex from the vblank evade critical section. We'd have
> > to hold the mutex across the whole thing then. Not sure if that would be
> > a good or a bad thing.
> Ah right, I missed that part since it didn't happen in the patches yet, might be worth pointing out in the commit message.
Right. A bit of tunnel vision on my part here. I'll plop in a note about it.
>
> Will vlv_wm_values also be updated with that lock in the future? Looks like it could be a fun race otherwise.
Yes, wm_mutex will be protecting all the global wm state.
> >> gen9 wm's and ilk wm's use that mutex, for similar reasons.
> >>> mutex_init(&dev_priv->sb_lock);
> >>> mutex_init(&dev_priv->modeset_restore_lock);
> >>> mutex_init(&dev_priv->av_mutex);
> >>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> >>> index 9d808b706824..75439e9a67f7 100644
> >>> --- a/drivers/gpu/drm/i915/i915_drv.h
> >>> +++ b/drivers/gpu/drm/i915/i915_drv.h
> >>> @@ -2169,6 +2169,9 @@ struct drm_i915_private {
> >>> } sagv_status;
> >>>
> >>> struct {
> >>> + /* protects DSPARB registers on pre-g4x/vlv/chv */
> >>> + spinlock_t dsparb_lock;
> >>> +
> >>> /*
> >>> * Raw watermark latency values:
> >>> * in 0.1us units for WM0,
> >>> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> >>> index 24d85a4e4ed3..9f25f2195a6a 100644
> >>> --- a/drivers/gpu/drm/i915/intel_pm.c
> >>> +++ b/drivers/gpu/drm/i915/intel_pm.c
> >>> @@ -1215,6 +1215,8 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)
> >>> pipe_name(crtc->pipe), sprite0_start,
> >>> sprite1_start, fifo_size);
> >>>
> >>> + spin_lock(&dev_priv->wm.dsparb_lock);
> >>> +
> >>> switch (crtc->pipe) {
> >>> uint32_t dsparb, dsparb2, dsparb3;
> >>> case PIPE_A:
> >>> @@ -1271,6 +1273,10 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)
> >>> default:
> >>> break;
> >>> }
> >>> +
> >>> + POSTING_READ(DSPARB);
> >>> +
> >>> + spin_unlock(&dev_priv->wm.dsparb_lock);
> >>> }
> >>>
> >>> #undef VLV_FIFO
>
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-12-02 9:57 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-28 17:37 [PATCH 00/15] drm/i915: VLV/CHV atomic wm prep work ville.syrjala
2016-11-28 17:37 ` [PATCH 01/15] drm/i915: Drop the nop intel_update_watermarks() call from haswell_crtc_enable() ville.syrjala
2016-11-28 17:37 ` [PATCH 02/15] drm/i915: Use the ilk_disable_lp_wm() return value ville.syrjala
2016-11-28 17:37 ` [PATCH 03/15] drm/i915: Fix the level 0 max_wm hack on VLV/CHV ville.syrjala
2016-11-28 17:37 ` [PATCH 04/15] drm/i915: Clean up VLV/CHV maxfifo watermark setup ville.syrjala
2016-11-28 17:37 ` [PATCH 05/15] drm/i915: Remove duplicated wm setup for vlv and chv ville.syrjala
2016-11-28 17:37 ` [PATCH 06/15] drm/i915: Organize vlv/chv watermarks by plane_id ville.syrjala
2016-11-28 17:37 ` [PATCH 07/15] drm/i915: Introduce vlv_invert_wm_value() ville.syrjala
2016-11-28 17:37 ` [PATCH 08/15] drm/i915: Pass around dev_priv in vlv wm functions ville.syrjala
2016-12-01 11:51 ` Maarten Lankhorst
2016-11-28 17:37 ` [PATCH 09/15] drm/i915: Protect cxsr state with wm_mutex ville.syrjala
2016-11-28 17:37 ` [PATCH 10/15] drm/i915: Skip vblank wait if cxsr was already off ville.syrjala
2016-11-28 17:37 ` [PATCH 11/15] drm/i915: Protect DSPARB registers with a spinlock ville.syrjala
2016-12-01 11:56 ` Maarten Lankhorst
2016-12-01 13:13 ` Ville Syrjälä
2016-12-01 14:45 ` Maarten Lankhorst
2016-12-02 9:57 ` Ville Syrjälä [this message]
2016-12-05 14:13 ` [PATCH v2 " ville.syrjala
2016-12-06 8:26 ` Maarten Lankhorst
2016-12-07 15:57 ` Ville Syrjälä
2016-11-28 17:37 ` [PATCH 12/15] drm/i915: Zero out HOWM registers before writing new WM/HOWM register values ville.syrjala
2016-12-01 14:43 ` Maarten Lankhorst
2016-12-02 9:51 ` Ville Syrjälä
2016-11-28 17:37 ` [PATCH 13/15] drm/i915: Write all DDL registers in one go ville.syrjala
2016-11-28 17:37 ` [PATCH 14/15] drm/i915: Clean up vlv_program_watermarks() ville.syrjala
2016-11-28 17:37 ` [PATCH 15/15] drm/i915: Pass crtc state to vlv_compute_wm_level() ville.syrjala
2016-12-01 14:47 ` Maarten Lankhorst
2016-12-02 9:59 ` Ville Syrjälä
2016-12-02 13:07 ` Ville Syrjälä
2016-12-06 8:27 ` Maarten Lankhorst
2016-11-28 18:14 ` ✓ Fi.CI.BAT: success for drm/i915: VLV/CHV atomic wm prep work Patchwork
2016-11-29 12:45 ` Patchwork
2016-12-05 14:33 ` [PATCH 00/15] " Ville Syrjälä
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=20161202095746.GQ31595@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.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 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.