From patchwork Mon Mar 28 10:22:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Anshuman" X-Patchwork-Id: 12793387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64D20C433F5 for ; Mon, 28 Mar 2022 10:22:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E4ABD10E65A; Mon, 28 Mar 2022 10:22:50 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6FCBA10E65A for ; Mon, 28 Mar 2022 10:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648462970; x=1679998970; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=peOpJ9GiLhqaM/IInlNQSAy3028uzVWvxw2+ABqq6+E=; b=GjQpOrLBZ+1bp52l/nhen2i2sagdNXhwbC5Tkp/2Lpqbb/9jn1BT3YSd 1bWP1eSjIKoWnedzeaxCldjUqu+htls5cEgLIhbttV2TR3ZxGQ5cM1xLf KbsHdc2IR1wOLaN6fjzusDr4iMRk/2w2lCGx6D5n696cuiCQp0q3KpSA2 NPxVRyKQo1wI9scYGtObCcw7pexqzM0tEbMYzRx0NQ9/TmAyAlGmbJN2y zD14UyeBs8kD2XOzh+VKH2OJgCuttq4JIrPjVbO925gHekwRSR4LwuNvI sfPMJ49sC3uI9LkeF4K+NFA21lNgX6SzzJwx6Kk+bgPon8iTz68h1mV3O g==; X-IronPort-AV: E=McAfee;i="6200,9189,10299"; a="258679698" X-IronPort-AV: E=Sophos;i="5.90,217,1643702400"; d="scan'208";a="258679698" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2022 03:22:49 -0700 X-IronPort-AV: E=Sophos;i="5.90,217,1643702400"; d="scan'208";a="517989080" Received: from srr4-3-linux-105-anshuma1.iind.intel.com ([10.223.74.179]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2022 03:22:47 -0700 From: Anshuman Gupta To: intel-gfx@lists.freedesktop.org Date: Mon, 28 Mar 2022 15:52:27 +0530 Message-Id: <20220328102227.14545-1-anshuman.gupta@intel.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915/debugfs: Dump i915 children runtime status X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chris Wilson , rodrigo.vivi@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" i915 doesn't use pm_suspend_ignore_children() which warrants that any runtime active child of i915 will block the runtime suspend of i915. i915_runtime_pm_status only exposes i915 runtime pm usage_count, which is not sufficient to debug in the scenarios when i915 has zero usage_count but there are runtime active children. Dump i915 child's runtime pm status to debug such i915 runtime suspend issues. Cc: Chris Wilson Signed-off-by: Anshuman Gupta Reviewed-by: Badal Nilawar --- drivers/gpu/drm/i915/i915_debugfs.c | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 445b4da23950..ea1730419f8d 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -483,6 +483,40 @@ static int i915_rps_boost_info(struct seq_file *m, void *data) return 0; } +#ifdef CONFIG_PM +static int i915_runtime_dump_child_status(struct device *dev, void *data) +{ + struct seq_file *m = data; + const char *rpm_status; + + /* Early return if runtime_pm is disabled */ + if (dev->power.disable_depth) + return 0; + + switch (dev->power.runtime_status) { + case RPM_SUSPENDED: + rpm_status = "suspended"; + break; + case RPM_SUSPENDING: + rpm_status = "suspending"; + break; + case RPM_RESUMING: + rpm_status = "resuming"; + break; + case RPM_ACTIVE: + rpm_status = "active"; + break; + default: + rpm_status = "unknown"; + } + + seq_printf(m, "\t%s %s: Runtime status: %s\n", dev_driver_string(dev), + dev_name(dev), rpm_status); + + return 0; +} +#endif + static int i915_runtime_pm_status(struct seq_file *m, void *unused) { struct drm_i915_private *dev_priv = node_to_i915(m->private); @@ -500,6 +534,10 @@ static int i915_runtime_pm_status(struct seq_file *m, void *unused) #ifdef CONFIG_PM seq_printf(m, "Usage count: %d\n", atomic_read(&dev_priv->drm.dev->power.usage_count)); + seq_printf(m, "Runtime active children: %d\n", + atomic_read(&dev_priv->drm.dev->power.child_count)); + device_for_each_child(&pdev->dev, m, i915_runtime_dump_child_status); + #else seq_printf(m, "Device Power Management (CONFIG_PM) disabled\n"); #endif