From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [PATCH 2/8] drm/i915: fixup up debugfs rps state handling Date: Thu, 09 Aug 2012 10:32:21 +0100 Message-ID: <1344504744_63017@CP5-2952> References: <1344461740-1231-1-git-send-email-daniel.vetter@ffwll.ch> <1344461740-1231-3-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from fireflyinternet.com (smtp.fireflyinternet.com [109.228.6.236]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E9D59EB39 for ; Thu, 9 Aug 2012 02:32:28 -0700 (PDT) In-Reply-To: <1344461740-1231-3-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Intel Graphics Development Cc: Daniel Vetter List-Id: intel-gfx@lists.freedesktop.org On Wed, 8 Aug 2012 23:35:34 +0200, Daniel Vetter wrote: > - Take the dev->struct_mutex around access the corresponding state > (and adjusting the rps hw state). > - Add an assert to gen6_set_rps to ensure we don't forget about this > in the future. > - Don't set up the min/max_freq files if it doesn't apply to the hw. > And do the same for the gen6+ cache sharing file while at it. > > v2: Move the gen6+ checks into the read/write callbacks. Thanks to the > awesome drm midlayer we can't check that when registering the debugfs > files, because the driver is not yet fully set up, specifically the > ->load callback hasn't run yet. > > Oh how I despise this disaster ... > > v3: Also add a WARN_ON(mutex_is_locked) in set_rps to check the > locking. > > Reviewed-by: Ben Widawsky (for v2) > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/i915/i915_debugfs.c | 27 +++++++++++++++++++++++++++ > drivers/gpu/drm/i915/intel_pm.c | 2 ++ > 2 files changed, 29 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c > index 1312b79..2499610 100644 > --- a/drivers/gpu/drm/i915/i915_debugfs.c > +++ b/drivers/gpu/drm/i915/i915_debugfs.c > @@ -1710,8 +1710,13 @@ i915_max_freq_read(struct file *filp, > char buf[80]; > int len; > > + if (!(IS_GEN6(dev) || IS_GEN7(dev))) > + return -ENODEV; > + > + mutex_lock(&dev->struct_mutex); In debugfs, I advise that we use mutex_lock_interruptible(). -Chris -- Chris Wilson, Intel Open Source Technology Centre