From patchwork Wed Apr 12 15:55:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Bragg X-Patchwork-Id: 9677695 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 9023C60383 for ; Wed, 12 Apr 2017 15:57:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 838BA27317 for ; Wed, 12 Apr 2017 15:57:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 786FF28395; Wed, 12 Apr 2017 15:57:15 +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 9C12227317 for ; Wed, 12 Apr 2017 15:57:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F9FD6E76F; Wed, 12 Apr 2017 15:57:14 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 841CF6E76F for ; Wed, 12 Apr 2017 15:57:12 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id x75so7314092wma.1 for ; Wed, 12 Apr 2017 08:57:12 -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=nk8Jm/qbyq3o5dr6gMxxgVTZgwAyicYwkU1GyAf6Me4=; b=sG3jBc2NVNpwTomqy18sfSabMwktzpJ9ssm2Z2fNJ5XG3YbYI2NOJa0Bu0Dawm0N8R +KHbp84gSqAZ6JRFAPoh7u6hQHtE5M5OFiOsp4ihg5VkPNLBYhJn8GgpnQNdVpKUQJ26 X7Jo4lxlZjfsuZk0UlDyXFvn0+o/1kfJB6mhgrA6GdBEZlkRljNsYw2Cs2y33ZPauXA/ vukOWtZ5UJlKXknObV06g68YGei7ehJR1OeL++y4RtOx1TE1a/Xp99vXDu0aFdmdnEAQ Ih3GxZc0TWMOFwAnFRqUDQH8HTejWh/CS9PaId8I+4vIE3IvBuR4ET5KgTQLWO1HkrU5 HnNQ== 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=nk8Jm/qbyq3o5dr6gMxxgVTZgwAyicYwkU1GyAf6Me4=; b=fI82HmQbBOnrjLI15JhgZC//ZmdYhtwvkrqhbyUmA/iyoNIxt85C6yxr+t5x4tyJwg fZqwFikYSOHbnIwRmt2AVvY3zx9PAWC4CVKvLXkX978TOf4+qNwKTSaS8f2ycL3TbCtX Bm808bPDQPd2HN7ORZoiKqw87kR6HylC1gnWPVDCDbkRpM1dv5j9lvwjTlIcfP2nTUjv A689jxWoMV6QaDSgWB16MBwddYacHUin0Xf3v4AX6Qr1Rk0yJsHVSrSXxT/CELZVa23C SgQ9yotjDBEriLEQwHeDXiAA3ExEX0RUR+tJyiL04uwCtZqIvcr9TvhQQh7/lxPeJzS1 glWw== X-Gm-Message-State: AN3rC/5WKBPZ2teEiVpaadcpi38rXdqcRKmHM4M2h8tUKjPlBSiwQKLj hVlMrxwd6NbGDQIkXNg= X-Received: by 10.28.105.11 with SMTP id e11mr2436777wmc.7.1492012630941; Wed, 12 Apr 2017 08:57:10 -0700 (PDT) Received: from sixbynine.org (host-78-151-16-127.as13285.net. [78.151.16.127]) by smtp.gmail.com with ESMTPSA id q131sm7099823wmd.0.2017.04.12.08.57.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Apr 2017 08:57:10 -0700 (PDT) From: Robert Bragg To: intel-gfx@lists.freedesktop.org Date: Wed, 12 Apr 2017 16:55:56 +0100 Message-Id: <20170412155556.6602-16-robert@sixbynine.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170412155556.6602-1-robert@sixbynine.org> References: <20170412155556.6602-1-robert@sixbynine.org> Subject: [Intel-gfx] [PATCH v4 15/15] 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 Acked-by: Lionel Landwerlin --- 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 59dcce3b40a9..94c1f5331daf 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2438,8 +2438,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 5de8d57e0b77..1f25a6690f61 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -1690,9 +1690,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 = @@ -1715,25 +1723,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; @@ -3014,7 +3003,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); oa_sample_rate_hard_limit =