From patchwork Wed Apr 5 16:23:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Bragg X-Patchwork-Id: 9664665 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BCA17602B8 for ; Wed, 5 Apr 2017 16:23:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF7C928395 for ; Wed, 5 Apr 2017 16:23:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A45FF2859F; Wed, 5 Apr 2017 16:23:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5639C28395 for ; Wed, 5 Apr 2017 16:23:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C23826E845; Wed, 5 Apr 2017 16:23:57 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9C1496E83F for ; Wed, 5 Apr 2017 16:23:56 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id g19so4124791wrb.0 for ; Wed, 05 Apr 2017 09:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=5fWr+wLGfQLlMNI4g77xMD6MzUGJDccsEgfiHEtyPyo=; b=DAN2DtL6tTBfDcunbVn/SI6xkN/nI3h22iY92FBOrUQF1XTvk2Ti9W1WPlp8cVUDe9 RlNeAjrNGEihoshDCTo58ExED+Hk4YYvWefkhevroGoVRO6EVadgWCIYHYKBN01TMD9m 880sbdjR201ZDKvy+AAqE/AiyFixy0hIvZwwzcAwRWOo8WuCNZaLwGkLBOa5fW0LwR05 YHRWdqWPAc6CuTQ6AEztD5O+v/wyYAWicTGdDSwJFDUf0wd9xTnlaM3X+m6P1Qelfaan cp+XpAnCNv+9uNXTlBHB1otctLMwzkerRrHXJo6YzcRxvZ+yLddZe/T2XxIOm2hS9D7Z pxeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=5fWr+wLGfQLlMNI4g77xMD6MzUGJDccsEgfiHEtyPyo=; b=PSkWbe3STpGmlQSsFjPwSN72SBf5/7OG5kwYBLvct3CjIUwoC1ZnO9IKk7ficE5t6R 4Ef5ei7tamDsUCiOr5w4EUfPjNtJcCALS8UYKWWA5EEitiJpeqBtmj9Cbx5BOeOX3pAS VJSizd0xpXt/9J/FJY7nSfheQ1N6N0Ste+UdHaU7HMluWNqkU8bTZPwlF5I7z8Urqd0a qybs+KTM/UTx0NQSGp0iBfXWpSUeBWutWi7eJGL25/Cd2rDswZGGZoBS3FfZfqZiL4nM Xiocpjbf4muMEi2X3w+XMNcxew9Q7fdx6RVPl0JI/arDyHNbc52xofG9V2wVh/Pyuqea k1gw== X-Gm-Message-State: AFeK/H31+8q6y/14QKa7s6MjXxWtdj6MlY/GCiZwhHrKf4O/w7SjP7w7tZkcLLe0BLK7Zw== X-Received: by 10.223.172.21 with SMTP id v21mr28221021wrc.100.1491409435246; Wed, 05 Apr 2017 09:23:55 -0700 (PDT) Received: from sixbynine.org (host-78-151-19-25.as13285.net. [78.151.19.25]) by smtp.gmail.com with ESMTPSA id c53sm2355050wra.16.2017.04.05.09.23.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Apr 2017 09:23:54 -0700 (PDT) From: Robert Bragg To: intel-gfx@lists.freedesktop.org Date: Wed, 5 Apr 2017 17:23:20 +0100 Message-Id: <20170405162320.30094-8-robert@sixbynine.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170405162320.30094-1-robert@sixbynine.org> References: <20170405162320.30094-1-robert@sixbynine.org> Subject: [Intel-gfx] [PATCH v3 7/7] drm/i915/perf: remove perf.hook_lock X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP In earlier iterations of the i915-perf driver we had a number of callbacks/hooks from other parts of the i915 driver to e.g. notify us when a legacy context was pinned and these could run asynchronously with respect to the stream file operations and might also run in atomic context. dev_priv->perf.hook_lock had been for serialising access to state needed within these callbacks, but as the code has evolved some of the hooks have gone away or are implemented to avoid needing to lock any state. The remaining use of this lock was actually redundant considering how the gen7 oacontrol state used to be updated as part of a context pin hook. Signed-off-by: Robert Bragg Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/i915_drv.h | 2 -- drivers/gpu/drm/i915/i915_perf.c | 32 ++++++++++---------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 48b07d706f06..67ac4e6dbccb 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2444,8 +2444,6 @@ struct drm_i915_private { struct mutex lock; struct list_head streams; - spinlock_t hook_lock; - struct { struct i915_perf_stream *exclusive_stream; diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index 87c0d1ce1b9f..63a1152766f8 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -1677,9 +1677,17 @@ static void gen8_disable_metric_set(struct drm_i915_private *dev_priv) /* NOP */ } -static void gen7_update_oacontrol_locked(struct drm_i915_private *dev_priv) +static void gen7_oa_enable(struct drm_i915_private *dev_priv) { - lockdep_assert_held(&dev_priv->perf.hook_lock); + /* Reset buf pointers so we don't forward reports from before now. + * + * Think carefully if considering trying to avoid this, since it + * also ensures status flags and the buffer itself are cleared + * in error paths, and we have checks for invalid reports based + * on the assumption that certain fields are written to zeroed + * memory which this helps maintains. + */ + gen7_init_oa_buffer(dev_priv); if (dev_priv->perf.oa.exclusive_stream->enabled) { struct i915_gem_context *ctx = @@ -1702,25 +1710,6 @@ static void gen7_update_oacontrol_locked(struct drm_i915_private *dev_priv) I915_WRITE(GEN7_OACONTROL, 0); } -static void gen7_oa_enable(struct drm_i915_private *dev_priv) -{ - unsigned long flags; - - /* Reset buf pointers so we don't forward reports from before now. - * - * Think carefully if considering trying to avoid this, since it - * also ensures status flags and the buffer itself are cleared - * in error paths, and we have checks for invalid reports based - * on the assumption that certain fields are written to zeroed - * memory which this helps maintains. - */ - gen7_init_oa_buffer(dev_priv); - - spin_lock_irqsave(&dev_priv->perf.hook_lock, flags); - gen7_update_oacontrol_locked(dev_priv); - spin_unlock_irqrestore(&dev_priv->perf.hook_lock, flags); -} - static void gen8_oa_enable(struct drm_i915_private *dev_priv) { u32 report_format = dev_priv->perf.oa.oa_buffer.format; @@ -2999,7 +2988,6 @@ void i915_perf_init(struct drm_i915_private *dev_priv) INIT_LIST_HEAD(&dev_priv->perf.streams); mutex_init(&dev_priv->perf.lock); - spin_lock_init(&dev_priv->perf.hook_lock); spin_lock_init(&dev_priv->perf.oa.oa_buffer.ptr_lock); dev_priv->perf.sysctl_header = register_sysctl_table(dev_root);