From patchwork Tue May 17 15:43:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 9113941 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 00D4A9FB14 for ; Tue, 17 May 2016 15:43:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CF172022A for ; Tue, 17 May 2016 15:43:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C814C20279 for ; Tue, 17 May 2016 15:43:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 513F86E69F; Tue, 17 May 2016 15:43:34 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id AF9CD6E68A for ; Tue, 17 May 2016 15:43:32 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 17 May 2016 08:43:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,324,1459839600"; d="scan'208";a="982969169" Received: from rosetta.fi.intel.com (HELO rosetta) ([10.237.72.90]) by fmsmga002.fm.intel.com with ESMTP; 17 May 2016 08:43:31 -0700 Received: by rosetta (Postfix, from userid 1000) id 4E56581948; Tue, 17 May 2016 18:43:29 +0300 (EEST) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Tue, 17 May 2016 18:43:28 +0300 Message-Id: <1463499808-3335-8-git-send-email-mika.kuoppala@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463499808-3335-1-git-send-email-mika.kuoppala@intel.com> References: <1463499808-3335-1-git-send-email-mika.kuoppala@intel.com> Subject: [Intel-gfx] [PATCH 7/7] drm/i915/debug: Warn when waiting on condition timeouts 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-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Warn if we timeout on waiting register or other condition. Signed-off-by: Mika Kuoppala --- drivers/gpu/drm/i915/i915_drv.h | 25 ++++++++++++++++++++----- drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++- drivers/gpu/drm/i915/intel_uncore.c | 10 +++++----- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index ccf6747894b1..3d03a17a8b7c 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2873,11 +2873,26 @@ static inline bool intel_vgpu_active(struct drm_i915_private *dev_priv) return dev_priv->vgpu.active; } -int intel_wait_until_register(struct drm_i915_private *dev_priv, - i915_reg_t reg, - u32 mask, - u32 value, - unsigned long timeout_ms); +int __intel_wait_until_register(struct drm_i915_private *dev_priv, + i915_reg_t reg, + u32 mask, + u32 value, + unsigned long timeout_ms); + +#if defined(CONFIG_DRM_I915_DEBUG) +#define intel_wait_until_register(dev_priv, reg, mask, value, timeout_ms) ({ \ + int __ret; \ + WARN_ON(__ret = __intel_wait_until_register((dev_priv), \ + (reg), (mask), \ + (value), \ + (timeout_ms))); \ + __ret; \ + }) +#else +#define intel_wait_until_register(dev_priv, reg, mask, value, timeout_ms) \ + __intel_wait_until_register((dev_priv), \ + (reg), (mask), (value), timeout_ms); +#endif #define wait_until_reg(reg, mask, value, timeout_ms) ({ \ if (__builtin_constant_p(timeout_ms)) \ diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 1b03461e75e4..917b649f84b6 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -80,7 +80,15 @@ ret__; \ }) -#define wait_for(COND, MS) __wait_for_ms((COND), (MS), 5) +#if defined(CONFIG_DRM_I915_DEBUG) +#define wait_for(COND, MS) ({ \ + int r__; \ + WARN_ON(r__ = __wait_for_ms((COND), (MS), 5)); \ + r__;\ + }) +#else +#define wait_for(COND, MS) __wait_for_ms((COND), (MS), 5) +#endif /* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. */ #if defined(CONFIG_DRM_I915_DEBUG) && defined(CONFIG_PREEMPT_COUNT) diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index f72420e00621..def601ba93d4 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -1859,11 +1859,11 @@ intel_uncore_forcewake_for_reg(struct drm_i915_private *dev_priv, return fw_domains; } -int intel_wait_until_register(struct drm_i915_private *dev_priv, - i915_reg_t reg, - u32 mask, - u32 value, - unsigned long timeout_ms) +int __intel_wait_until_register(struct drm_i915_private *dev_priv, + i915_reg_t reg, + u32 mask, + u32 value, + unsigned long timeout_ms) { return wait_for((I915_READ(reg) & mask) == value, timeout_ms); }