From: Daniel Vetter <daniel@ffwll.ch>
To: Ben Widawsky <benjamin.widawsky@intel.com>
Cc: "David E. Box" <david.e.box@intel.com>,
Intel GFX <intel-gfx@lists.freedesktop.org>,
Ben Widawsky <ben@bwidawsk.net>,
Kristen Carlson Accardi <kristen@linux.intel.com>
Subject: Re: [PATCH 11/11] [v4] drm/i915/bdw: Ensure a context is loaded before RC6
Date: Tue, 4 Mar 2014 15:30:14 +0100 [thread overview]
Message-ID: <20140304143014.GC17001@phenom.ffwll.local> (raw)
In-Reply-To: <1392877640-20588-1-git-send-email-benjamin.widawsky@intel.com>
On Wed, Feb 19, 2014 at 10:27:20PM -0800, Ben Widawsky wrote:
> RC6 works a lot like HW contexts in that when the GPU enters RC6 it
> saves away the state to a context, and loads it upon wake.
>
> It's to be somewhat expected that BIOS will not set up valid GPU state.
> As a result, if loading bad state can cause the GPU to get angry, it
> would make sense then that we need to load state first. There are two
> ways in which we can do this:
>
> 1. Create 3d state in the driver, load it up, then enable RC6.
> 1b. Reuse a known good state, [and if needed,] just bind objects where
> needed. Then enable RC6.
> 2. Hold off enabling RC6 until userspace has had a chance to complete
> batches.
>
> There has been discussions in the past with #1 as it has been
> recommended for fixes elsewhere. I'm not opposed to it, I'd just like to
> do the easy thing now to enable the platform.
>
> This patch is a hack that implement option #2. It will defer enabling
> rc6 until the first batch from userspace has been retired. It suffers
> two flaws. The first is, if the driver is loaded, but a batch is not
> submitted/completed, we'll never enter rc6. The other is, it expects
> userspace to submit a batch with 3d state first. Both of these things
> are not actual flaws for most users because most users will boot to a
> graphical composited desktop. Both mesa, and X will always emit the
> necessary 3d state.
>
> Once a context is loaded and we enable rc6, the default context should
> inherit the proper state because we always inhibit the restore for the
> default context. This assumes certain things about the workaround/issue
> itself to which I am not privy (primarily that the indirect state
> objects don't actually need to exist).
>
> With that, there are currently 4 options for BDW:
> 1. Don't use RC6.
> 2. Use RC6 and expect a hang on the first batch submitted for every
> context.
> 3. Use RC6 and use this patch.
> 4. Wait for another workaround implementation.
>
> NOTE: This patch could be used against other platforms as well.
>
> v2: Re-add accidentally dropped hunk (Ben)
>
> v3: Now more compilable (Ben)
>
> v4: Use the existing enable flag for rc6. This will also make the
> suspend/resume case work properly, which is broken in v3.
> Disable rc6 on reset, and defer re-enabling until the first batch.
>
> The fact that RC6 residency continues to increment, and that this patch
> prevents a hang on BDW silicon has been:
> Tested-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
>
> Cc: David E. Box <david.e.box@intel.com>
> Cc: Kristen Carlson Accardi <kristen@linux.intel.com>
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
>
> squash! drm/i915/bdw: Ensure a context is loaded before RC6
> ---
> drivers/gpu/drm/i915/i915_drv.c | 4 +++-
> drivers/gpu/drm/i915/i915_gem.c | 10 ++++++++++
> drivers/gpu/drm/i915/intel_display.c | 5 +++++
> 3 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 2d05d7c..7fdfc0e 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -679,6 +679,8 @@ int i915_reset(struct drm_device *dev)
> mutex_lock(&dev->struct_mutex);
>
> i915_gem_reset(dev);
> + if (IS_BROADWELL(dev))
> + intel_disable_gt_powersave(dev);
>
> simulated = dev_priv->gpu_error.stop_rings != 0;
>
> @@ -733,7 +735,7 @@ int i915_reset(struct drm_device *dev)
> * reset and the re-install of drm irq. Skip for ironlake per
> * previous concerns that it doesn't respond well to some forms
> * of re-init after reset. */
> - if (INTEL_INFO(dev)->gen > 5) {
> + if (INTEL_INFO(dev)->gen > 5 && !IS_BROADWELL(dev)) {
> mutex_lock(&dev->struct_mutex);
> intel_enable_gt_powersave(dev);
> mutex_unlock(&dev->struct_mutex);
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 3618bb0..25a97a6 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2420,6 +2420,7 @@ void i915_gem_reset(struct drm_device *dev)
> void
> i915_gem_retire_requests_ring(struct intel_ring_buffer *ring)
> {
> + struct drm_i915_private *dev_priv = ring->dev->dev_private;
> uint32_t seqno;
>
> if (list_empty(&ring->request_list))
> @@ -2443,6 +2444,15 @@ i915_gem_retire_requests_ring(struct intel_ring_buffer *ring)
> if (!i915_seqno_passed(seqno, obj->last_read_seqno))
> break;
>
> + /* Wa: can't find the w/a name.
> + * This doesn't actually implement the w/a, but it a workaround
> + * for the workaround. It defers using rc6 until we know valid
> + * state exists.
> + */
> + if (IS_BROADWELL(ring->dev) && intel_enable_rc6(ring->dev) &&
> + !dev_priv->rps.enabled && ring->id == RCS)
> + intel_enable_gt_powersave(ring->dev);
Nope, we won't rely on userspace submitting a command to enable a power
saving feature. There's a good chance that userspace won't submitting
anything, but still wake up from suspend, e.g. for background mail
checking. Especially on Android where opportunistic is used to
aggressively conserve battery power.
If just a MI_SET_CONTEXT isn't good enough and we need to save a valid 3d
context then we need to (shock, horror) emit the relevant minimal set of
3d state commands in the kernel before enabling rc6.
Aside: Series looks good otherwise, so I'll happily merge once it's
reviewed. No opinion on the RP* bikeshed (besides that your new names for
dev_priv->rps.foo are definitely clearer) as long as the connection
between the sane names and the Bspec names is documented somewhere.
-Daniel
> +
> i915_gem_object_move_to_inactive(obj);
> }
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index f19e6ea..72c8e1d 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10983,6 +10983,11 @@ void intel_modeset_init_hw(struct drm_device *dev)
>
> intel_reset_dpio(dev);
>
> + if (IS_BROADWELL(dev)) {
> + DRM_DEBUG_DRIVER("Deferring RC6 enabling until first batch is complete\n");
> + return;
> + }
> +
> mutex_lock(&dev->struct_mutex);
> intel_enable_gt_powersave(dev);
> mutex_unlock(&dev->struct_mutex);
> --
> 1.9.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2014-03-04 14:30 UTC|newest]
Thread overview: 97+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-29 4:25 [PATCH 0/9] Broadwel RC6 & RPS Ben Widawsky
2014-01-29 4:25 ` [PATCH 1/9] drm/i915: Clarify RC6 enabling Ben Widawsky
2014-02-06 13:38 ` Rodrigo Vivi
[not found] ` <CAOh5HuUmDmAC9Nuu3DWYO2kU+Q5kyHyxSmF4rjADaY1iY6=RaQ@mail.gmail.com>
2014-02-07 5:30 ` S, Deepak
2014-02-18 3:01 ` [PATCH 00/11] [v2] BDW RPS + RC6 + rps fixlets Ben Widawsky
2014-02-18 3:01 ` [PATCH 01/11] drm/i915: Reorganize the overclock code Ben Widawsky
2014-02-18 3:01 ` [PATCH 02/11] drm/i915: Fix coding style for RPS Ben Widawsky
2014-02-18 3:01 ` [PATCH 03/11] drm/i915: Rename and comment all the RPS *stuff* Ben Widawsky
2014-02-18 19:03 ` [PATCH 03/11] [v2] " Ben Widawsky
2014-02-22 13:37 ` [PATCH 03/11] " Chris Wilson
2014-02-22 19:34 ` Ben Widawsky
2014-02-22 19:37 ` Chris Wilson
2014-02-22 19:40 ` Ben Widawsky
2014-02-22 20:08 ` Chris Wilson
2014-02-25 0:54 ` Ben Widawsky
2014-02-22 19:38 ` Ben Widawsky
2014-02-22 20:14 ` Chris Wilson
2014-03-19 1:27 ` Ben Widawsky
2014-03-19 2:38 ` Ben Widawsky
2014-03-19 6:49 ` Chris Wilson
2014-02-18 3:01 ` [PATCH 04/11] drm/i915: Remove extraneous MMIO for RPS Ben Widawsky
2014-02-18 3:01 ` [PATCH 05/11] drm/i915: remove rps local variables Ben Widawsky
2014-02-18 3:01 ` [PATCH 06/11] drm/i915/bdw: Set initial rps freq to nominal Ben Widawsky
2014-02-18 3:01 ` [PATCH 07/11] drm/i915/bdw: Extract rp_state_caps logic Ben Widawsky
2014-02-18 3:01 ` [PATCH 08/11] drm/i915/bdw: RPS frequency bits are the same as HSW Ben Widawsky
2014-02-18 3:01 ` [PATCH 09/11] drm/i915/bdw: Implement a basic PM interrupt handler Ben Widawsky
2014-02-18 3:01 ` [PATCH 10/11] drm/i915/bdw: Enable RC6 Ben Widawsky
2014-02-18 3:01 ` [PATCH 11/11] drm/i915/bdw: Ensure a context is loaded before RC6 Ben Widawsky
2014-02-18 3:03 ` [PATCH 11/11] [v2] " Ben Widawsky
2014-02-18 3:56 ` [PATCH 11/11] [v3] " Ben Widawsky
2014-02-20 6:27 ` [PATCH 11/11] [v4] " Ben Widawsky
2014-03-04 14:30 ` Daniel Vetter [this message]
2014-03-20 0:41 ` Ben Widawsky
2014-03-20 13:42 ` Daniel Vetter
2014-03-20 17:30 ` Jesse Barnes
2014-03-20 20:12 ` Jesse Barnes
2014-03-20 1:31 ` [PATCH 00/12] [v3] BDW RPS + RC6 + rps fixlets Ben Widawsky
2014-03-20 1:31 ` [PATCH 01/12] drm/i915: Reorganize the overclock code Ben Widawsky
2014-03-20 7:23 ` Chris Wilson
2014-03-20 1:31 ` [PATCH 02/12] drm/i915: Fix coding style for RPS Ben Widawsky
2014-03-20 7:31 ` Chris Wilson
2014-03-24 10:30 ` Deepak S
2014-03-20 1:31 ` [PATCH 03/12] drm/i915: Store the HW min frequency as min_freq Ben Widawsky
2014-03-20 7:29 ` Chris Wilson
2014-03-24 10:31 ` Deepak S
2014-03-20 1:31 ` [PATCH 04/12] drm/i915: Rename and comment all the RPS *stuff* Ben Widawsky
2014-03-20 7:01 ` Chris Wilson
2014-03-20 1:31 ` [PATCH 05/12] drm/i915: Remove extraneous MMIO for RPS Ben Widawsky
2014-03-20 7:30 ` Chris Wilson
2014-03-20 1:31 ` [PATCH 06/12] drm/i915: remove rps local variables Ben Widawsky
2014-03-20 7:30 ` Chris Wilson
2014-03-20 13:46 ` Daniel Vetter
2014-03-20 1:31 ` [PATCH 07/12] drm/i915/bdw: Set initial rps freq to RP0 Ben Widawsky
2014-03-20 7:24 ` Chris Wilson
2014-03-22 18:42 ` Ben Widawsky
2014-03-22 21:06 ` Chris Wilson
2014-03-24 19:27 ` Ben Widawsky
2014-03-20 1:31 ` [PATCH 08/12] drm/i915/bdw: Extract rp_state_caps logic Ben Widawsky
2014-03-20 7:28 ` Chris Wilson
2014-03-22 18:46 ` Ben Widawsky
2014-03-20 1:31 ` [PATCH 09/12] drm/i915/bdw: RPS frequency bits are the same as HSW Ben Widawsky
2014-03-20 1:31 ` [PATCH 10/12] drm/i915/bdw: Implement a basic PM interrupt handler Ben Widawsky
2014-03-24 19:30 ` Ben Widawsky
2014-03-20 1:31 ` [PATCH 11/12] drm/i915/bdw: Ensure a context is loaded before RC6 Ben Widawsky
2014-03-20 7:35 ` Chris Wilson
2014-03-20 1:31 ` [PATCH 12/12] drm/i915/bdw: Enable RC6 Ben Widawsky
2014-03-24 10:27 ` Deepak S
2014-01-29 4:25 ` [PATCH 2/9] drm/i915: Stop pretending VLV has rc6+ Ben Widawsky
2014-02-06 13:39 ` Rodrigo Vivi
[not found] ` <CAOh5HuXxFqRixpPSeOpi=1t2sL=sVfmjdMR445dEQBozg1Z43w@mail.gmail.com>
2014-02-07 5:42 ` S, Deepak
2014-01-29 4:25 ` [PATCH 3/9] drm/i915: Just print rc6 facts Ben Widawsky
2014-02-06 13:41 ` Rodrigo Vivi
[not found] ` <CAOh5HuW+_5n=zfDSf_F1aT+v7xzdm_GwUxKC5t8g6_LVCX6X_g@mail.gmail.com>
2014-02-07 5:44 ` S, Deepak
2014-01-29 4:25 ` [PATCH 4/9] drm/i915/bdw: Use centralized rc6 info print Ben Widawsky
2014-02-06 13:42 ` Rodrigo Vivi
2014-02-11 16:12 ` Daniel Vetter
2014-02-14 20:34 ` Ben Widawsky
2014-02-14 20:41 ` Chris Wilson
2014-02-17 19:41 ` Ben Widawsky
[not found] ` <CAOh5HuVu0vvQNFKt2FhVf9CrXQa47WAfaqWP2EHp=mBMgExTkQ@mail.gmail.com>
2014-02-07 5:46 ` S, Deepak
2014-01-29 4:25 ` [PATCH 5/9] drm/i915/bdw: Extract rp_state_caps logic Ben Widawsky
2014-01-29 4:25 ` [PATCH 5/9] drm/i915/bdw: Set rp_state_caps Ben Widawsky
2014-02-06 13:45 ` Rodrigo Vivi
[not found] ` <CAOh5HuUqCUM-2-yxCbPcCZ53yTxN+8Q5+syiAXqa86Vp47T70A@mail.gmail.com>
2014-02-07 6:10 ` S, Deepak
2014-01-29 4:25 ` [PATCH 6/9] drm/i915/bdw: Set initial rps freq to nominal Ben Widawsky
2014-01-29 4:25 ` [PATCH 7/9] drm/i915/bdw: RPS frequency bits are the same as HSW Ben Widawsky
2014-02-06 13:52 ` Rodrigo Vivi
[not found] ` <CAOh5HuU8bnYppf7D5k39QuuDkbHCUVznuVHzvd2dW1mDN0GpBA@mail.gmail.com>
2014-02-07 6:25 ` S, Deepak
2014-01-29 4:25 ` [PATCH 8/9] drm/i915/bdw: Implement a basic PM interrupt handler Ben Widawsky
2014-02-06 14:15 ` Rodrigo Vivi
2014-02-17 20:01 ` Ben Widawsky
[not found] ` <CAOh5HuXYmUmGM2tDGO6KCT9Q1V6znbAwQf5OoC27++078bvfRg@mail.gmail.com>
2014-02-07 6:43 ` S, Deepak
2014-01-29 4:25 ` [PATCH 9/9] drm/i915/bdw: Enable RC6 Ben Widawsky
2014-02-06 13:54 ` Rodrigo Vivi
2014-02-17 20:04 ` Ben Widawsky
2014-02-17 20:07 ` Ben Widawsky
[not found] ` <CAOh5HuW-f4xdojasEP3wkSoVH3W1NJNdPACafgnPfVujFe4fjw@mail.gmail.com>
2014-02-07 6:47 ` S, Deepak
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=20140304143014.GC17001@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=ben@bwidawsk.net \
--cc=benjamin.widawsky@intel.com \
--cc=david.e.box@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=kristen@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox