From patchwork Fri Jun 16 13:46:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Wajdeczko X-Patchwork-Id: 9791709 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 0668A60325 for ; Fri, 16 Jun 2017 13:47:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 059DE28646 for ; Fri, 16 Jun 2017 13:47:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE6B128648; Fri, 16 Jun 2017 13:47:03 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 194EB28649 for ; Fri, 16 Jun 2017 13:47:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EEE9B6E8EB; Fri, 16 Jun 2017 13:47:00 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 31CA46E8EB for ; Fri, 16 Jun 2017 13:47:00 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jun 2017 06:46:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,347,1493708400"; d="scan'208";a="100275299" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 16 Jun 2017 06:46:58 -0700 Received: from mwajdecz-MOBL1.ger.corp.intel.com (mwajdecz-mobl1.ger.corp.intel.com [172.28.174.25]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id v5GDkor1029958; Fri, 16 Jun 2017 14:46:57 +0100 From: Michal Wajdeczko To: intel-gfx@lists.freedesktop.org Date: Fri, 16 Jun 2017 13:46:46 +0000 Message-Id: <20170616134647.21424-4-michal.wajdeczko@intel.com> X-Mailer: git-send-email 2.10.1.windows.1 In-Reply-To: <20170616134647.21424-1-michal.wajdeczko@intel.com> References: <20170616134647.21424-1-michal.wajdeczko@intel.com> Subject: [Intel-gfx] [PATCH v4 3/4] drm/i915: Highlight modified i915 params in gpu error state 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 We now know types and default values for all params. Use dedicated err_print macros to dump them in gpu error state and flag any that was modified. Suggested-by: Chris Wilson Signed-off-by: Michal Wajdeczko Cc: Chris Wilson --- drivers/gpu/drm/i915/i915_drv.h | 20 ++++++++++++++++++++ drivers/gpu/drm/i915/i915_gpu_error.c | 30 ++++++++++++++---------------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 158c87b..ea839e0 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -252,6 +252,26 @@ static inline const char *enableddisabled(bool v) return v ? "enabled" : "disabled"; } +static inline bool is_equal_int(int a, int b) +{ + return a == b; +} + +static inline bool is_equal_uint(unsigned int a, unsigned int b) +{ + return a == b; +} + +static inline bool is_equal_bool(bool a, bool b) +{ + return a == b; +} + +static inline bool is_equal_charp(const char *a, const char *b) +{ + return a && b ? !strcmp(a, b) : a == b; +} + enum pipe { INVALID_PIPE = -1, PIPE_A = 0, diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index 000f733..3e388b3 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -546,27 +546,25 @@ static void err_print_capabilities(struct drm_i915_error_state_buf *m, #undef PRINT_FLAG } -static __always_inline void err_print_param(struct drm_i915_error_state_buf *m, - const char *name, - const char *type, - const void *x) -{ - if (!__builtin_strcmp(type, "bool")) - err_printf(m, "i915.%s=%s\n", name, yesno(*(const bool *)x)); - else if (!__builtin_strcmp(type, "int")) - err_printf(m, "i915.%s=%d\n", name, *(const int *)x); - else if (!__builtin_strcmp(type, "uint")) - err_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x); - else if (!__builtin_strcmp(type, "charp")) - err_printf(m, "i915.%s=%s\n", name, *(const char **)x); - else - BUILD_BUG(); +#define err_print_param_int(m, name, x, flag) \ + err_printf(m, "i915.%s=%d%s\n", name, x, flag); +#define err_print_param_uint(m, name, x, flag) \ + err_printf(m, "i915.%s=%u%s\n", name, x, flag); +#define err_print_param_bool(m, name, x, flag) \ + err_printf(m, "i915.%s=%s%s\n", name, yesno(x), flag); +#define err_print_param_charp(m, name, x, flag) \ + err_printf(m, "i915.%s=%s%s\n", name, x, flag); + +static inline const char *param_flag(bool modified) +{ + return modified ? " [modified]" : ""; } static void err_print_params(struct drm_i915_error_state_buf *m, const struct i915_params *p) { -#define PRINT(X, T, V, U, M, B, D) err_print_param(m, #X, #T, &p->X); +#define PRINT(X, T, V, U, M, B, D) \ + err_print_param_##T(m, #X, p->X, param_flag(!is_equal_##T(V, p->X))); I915_PARAMS_FOR_EACH(PRINT); #undef PRINT }