From patchwork Wed Jun 6 11:33:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Winiarski?= X-Patchwork-Id: 10450079 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 6040D60146 for ; Wed, 6 Jun 2018 11:34:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 519B42953F for ; Wed, 6 Jun 2018 11:34:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 455FF297AC; Wed, 6 Jun 2018 11:34:24 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, 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 B15672953F for ; Wed, 6 Jun 2018 11:34:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FF6D6EFD3; Wed, 6 Jun 2018 11:34:23 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id B8D206EFD3 for ; Wed, 6 Jun 2018 11:34:21 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jun 2018 04:34:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,483,1520924400"; d="scan'208";a="47187705" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga008.jf.intel.com with ESMTP; 06 Jun 2018 04:34:20 -0700 Received: from localhost (172.28.172.64) by IRSMSX102.ger.corp.intel.com (163.33.3.155) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 6 Jun 2018 12:34:19 +0100 From: =?UTF-8?q?Micha=C5=82=20Winiarski?= To: Date: Wed, 6 Jun 2018 13:33:56 +0200 Message-ID: <20180606113356.9222-1-michal.winiarski@intel.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 X-Originating-IP: [172.28.172.64] Subject: [Intel-gfx] [PATCH] drm/i915: Export number of fail injection checkpoints through debugfs X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP We'd like to start testing module load with fault injection. To avoid making any asumptions on number of available fault injection checkpoints (either in IGT or in i915), we can compute it at runtime and export it in debugfs. Signed-off-by: MichaƂ Winiarski Cc: Chris Wilson Cc: Imre Deak Cc: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_debugfs.c | 14 ++++++++++++++ drivers/gpu/drm/i915/i915_drv.c | 13 +++++-------- drivers/gpu/drm/i915/i915_drv.h | 7 +++++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 698af45e229c..32cf8bb83ed5 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2279,6 +2279,17 @@ static int i915_rps_boost_info(struct seq_file *m, void *data) return 0; } +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG) +static int i915_fail_injection_info(struct seq_file *m, void *data) +{ + struct drm_i915_private *i915 = node_to_i915(m->private); + + seq_printf(m, "Available checkpoints: %u\n", i915->load_fail_count); + + return 0; +} +#endif + static int i915_llc(struct seq_file *m, void *data) { struct drm_i915_private *dev_priv = node_to_i915(m->private); @@ -4797,6 +4808,9 @@ static const struct drm_info_list i915_debugfs_list[] = { {"i915_sseu_status", i915_sseu_status, 0}, {"i915_drrs_status", i915_drrs_status, 0}, {"i915_rps_boost_info", i915_rps_boost_info, 0}, +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG) + {"i915_fail_injection_info", i915_fail_injection_info, 0}, +#endif }; #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 6b599b1837dc..0c3acc255085 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -57,14 +57,11 @@ static struct drm_driver driver; #if IS_ENABLED(CONFIG_DRM_I915_DEBUG) -static unsigned int i915_load_fail_count; -bool __i915_inject_load_failure(const char *func, int line) +bool __i915_inject_load_failure(struct drm_i915_private *i915, + const char *func, int line) { - if (i915_load_fail_count >= i915_modparams.inject_load_failure) - return false; - - if (++i915_load_fail_count == i915_modparams.inject_load_failure) { + if (++i915->load_fail_count == i915_modparams.inject_load_failure) { DRM_INFO("Injecting failure at checkpoint %u [%s:%d]\n", i915_modparams.inject_load_failure, func, line); return true; @@ -114,11 +111,11 @@ __i915_printk(struct drm_i915_private *dev_priv, const char *level, va_end(args); } -static bool i915_error_injected(struct drm_i915_private *dev_priv) +static bool i915_error_injected(struct drm_i915_private *i915) { #if IS_ENABLED(CONFIG_DRM_I915_DEBUG) return i915_modparams.inject_load_failure && - i915_load_fail_count == i915_modparams.inject_load_failure; + i915->load_fail_count == i915_modparams.inject_load_failure; #else return false; #endif diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index a4bb30c32a52..f694e5ebd39f 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -107,9 +107,10 @@ I915_STATE_WARN((x), "%s", "WARN_ON(" __stringify(x) ")") #if IS_ENABLED(CONFIG_DRM_I915_DEBUG) -bool __i915_inject_load_failure(const char *func, int line); +bool __i915_inject_load_failure(struct drm_i915_private *i915, + const char *func, int line); #define i915_inject_load_failure() \ - __i915_inject_load_failure(__func__, __LINE__) + __i915_inject_load_failure(dev_priv, __func__, __LINE__) #else #define i915_inject_load_failure() false #endif @@ -2120,6 +2121,8 @@ struct drm_i915_private { struct i915_pmu pmu; + unsigned int load_fail_count; + /* * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch * will be rejected. Instead look for a better place.