From: Chris Wilson Subject: Re: [PATCH v2] drm/i915: Fix forcewake active domain tracking Date: Fri, 10 Mar 2017 08:50:00 +0000 Message-ID: <20170310085000.GL28427@nuc-i3427.alporthouse.com> References: <20170309211216.GF28427@nuc-i3427.alporthouse.com> <20170310073251.31179-1-tvrtko.ursulin@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20170310073251.31179-1-tvrtko.ursulin@linux.intel.com> Sender: stable-owner@vger.kernel.org To: Tvrtko Ursulin Cc: Intel-gfx@lists.freedesktop.org, Tvrtko Ursulin , "Paneri, Praveen" , Daniel Vetter , Jani Nikula , "v4 . 10+" List-Id: intel-gfx@lists.freedesktop.org On Fri, Mar 10, 2017 at 07:32:51AM +0000, Tvrtko Ursulin wrote: > From: Tvrtko Ursulin > > In commit 003342a50021 ("drm/i915: Keep track of active > forcewake domains in a bitmask") I forgot to adjust the > newly introduce fw_domains_active state across reset. > > This caused the assert_forcewakes_inactive to trigger > during suspend and resume if there were user held > forcewakes. > > v2: Bitmask checks are required since vfuncs are not > always present. > > Signed-off-by: Tvrtko Ursulin > Fixes: 003342a50021 ("drm/i915: Keep track of active forcewake domains in a bitmask") > Testcase: igt/drv_suspend/forcewake > Cc: Tvrtko Ursulin > Cc: "Paneri, Praveen" > Cc: Chris Wilson > Cc: Daniel Vetter > Cc: Jani Nikula > Cc: intel-gfx@lists.freedesktop.org > Cc: v4.10+ > --- > drivers/gpu/drm/i915/intel_uncore.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c > index 2a3f35c30501..7efae77faca0 100644 > --- a/drivers/gpu/drm/i915/intel_uncore.c > +++ b/drivers/gpu/drm/i915/intel_uncore.c > @@ -304,12 +304,14 @@ static void intel_uncore_forcewake_reset(struct drm_i915_private *dev_priv, > fw = dev_priv->uncore.fw_domains_active; > if (fw) > dev_priv->uncore.funcs.force_wake_put(dev_priv, fw); > + dev_priv->uncore.fw_domains_active = 0; Hmm, I think we would be happier with (think of a good name) static void __intel_uncore_force_wake_get(i915, fw_domains) { i915->uncore.funcs.force_wake_get(i915, fw_domains); i915->uncore.funcs.fw_domains_active |= fw_domain; } static void __intel_uncore_force_wake_put(i915, fw_domains) { i915->uncore.funcs.force_wake_put(i915, fw_domains); i915->uncore.funcs.fw_domains_active &= ~fw_domain; } Another alternative would be to move the bitops down to the callbacks. gcc might be happier, at the expense of some duplication and risk of forgetting. Anyway worth the effort? -Chris -- Chris Wilson, Intel Open Source Technology Centre