From patchwork Thu Dec 17 19:25:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonas Lahtinen X-Patchwork-Id: 7876501 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C1B7EBEEE5 for ; Thu, 17 Dec 2015 19:26:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0430C2041B for ; Thu, 17 Dec 2015 19:26:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 235B720416 for ; Thu, 17 Dec 2015 19:26:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F84B7A08A; Thu, 17 Dec 2015 11:26:25 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id E5AA26E3EF for ; Thu, 17 Dec 2015 11:26:18 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 17 Dec 2015 11:26:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,442,1444719600"; d="scan'208";a="709869255" Received: from jlahtine-mobl1.ger.corp.intel.com ([10.252.27.127]) by orsmga003.jf.intel.com with ESMTP; 17 Dec 2015 11:26:00 -0800 From: Joonas Lahtinen To: Intel graphics driver community testing & development Date: Thu, 17 Dec 2015 21:25:50 +0200 Message-Id: <1450380351-28397-6-git-send-email-joonas.lahtinen@linux.intel.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1450380351-28397-1-git-send-email-joonas.lahtinen@linux.intel.com> References: <1450380351-28397-1-git-send-email-joonas.lahtinen@linux.intel.com> Subject: [Intel-gfx] [PATCH 5/6] drm/i915: Add helpers to reduce (repetitive) noise 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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 Add helpers to reduce the amount of noise. Use the i915.debug parameter introduced in the previous patch to decide on whether to display all debug messages or just ones that are meaningful to end user. Take for example the CI environment, we want to see all possible warning messages even though the system continues to operate. Opposite to that is environment in daily use, repeating errors should be displayed once to indicate the need for a bug report, but if the machine continues to work, we should not spam the user continuously. Cc: Chris Wilson Signed-off-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_drv.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 37fce5a..07240af 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -110,6 +110,32 @@ unlikely(__ret_warn_on); \ }) +#define I915_DEBUG(condition, format...) ({ \ + int __ret_debug_on = !!(condition); \ + if (unlikely(__ret_debug_on)) \ + WARN(unlikely(i915.debug), format); \ + unlikely(__ret_debug_on); \ +}) + +#define I915_DEBUG_ON(condition) ({ \ + static const char __debug_on_txt[] = \ + "I915_DEBUG_ON(" __stringify(condition) ")\n"; \ + int __ret_debug_on = !!(condition); \ + if (unlikely( __ret_debug_on)) \ + WARN(unlikely(i915.debug), __debug_on_txt); \ + unlikely(__ret_debug_on); \ +}) + +#define I915_WARN_RECUR(condition, format...) ({ \ + static bool __section(.data.unlikely) __warned; \ + int __ret_warn_on = !!(condition); \ + if (unlikely(__ret_warn_on)) { \ + if (WARN(unlikely(!__warned || i915.debug), format)) \ + __warned = true; \ + } \ + unlikely(__ret_debug_on); \ +}) + static inline const char *yesno(bool v) { return v ? "yes" : "no";