From patchwork Thu Nov 11 22:01:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12692316 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21C81C433EF for ; Thu, 11 Nov 2021 22:06:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1F8E61269 for ; Thu, 11 Nov 2021 22:06:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E1F8E61269 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nNJFuVP02Teq2IcQF9UtnJtVle9Gcgn1AQDIjKQhGVQ=; b=NeEdJ1H1EHfc2T 6CD7+G6EnmAG5eaUUvsb1fxOdE3/UO0aw3WWjKNp3KNDmPtxY6w6AOOuCKujLjuyhd+oalXCqFel1 /smoQKCK+n+nogR5vsDyuHQtCv6UxZ5FWqxD1X+59ahDFonPAV4itTuzOorMdGt+x31XbxibgFwez Z/aKqv/0pECmXZ7asgZksCBcBaWitqulhkFfQ9NcaYUPLFvZfoFtgz3ecyc30+oLhf4XzC26VrBPf HDV3F5+f0nopg/Z50O6LuysxQlYUGKmgVaFljn/awF0GAEmkSLR9aCi42yx7lrq591SoCuYCYfkxx U7xmKg4D12fQrUjSlhnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlIAS-008q7i-Sn; Thu, 11 Nov 2021 22:03:37 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mlI9K-008pbH-J4 for linux-arm-kernel@lists.infradead.org; Thu, 11 Nov 2021 22:02:28 +0000 Received: by mail-il1-x133.google.com with SMTP id s15so7187943ild.9 for ; Thu, 11 Nov 2021 14:02:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W/eb6uDj0ZcPussZNWTyXvX7+BhhrBBdZ4eRtPk3Njs=; b=pkmN9aFmUvCHVM0y8octaoOSLL2D84Qi2xdBg4z2fk3sW6d1XPH/q4CjvttBUKGjeC xIwejMZMQO9qi1vwAb7AChnONzCruzpGLlDyXqVc01g98NrZVL1/DIcEhuml3Ibup6Xj nLcN5fjd/zzLCdt9ipYhqyGfsgNHQ6jMdJn3inmE5tp0XM6A4PYJVhtGXn69a+vcG3Q6 xzF5QFCGjsnxnr2BADQSUzRnc6R+NhF+duXC/MbAVuHi9gVsgGjT8I7TCO12mHC9Ty2P OvtmmU+mbzRMEXBtShHLgsd7ZE7xBTQISLD/edfdUr7T3zxN29wWB9PcNqR0ppi5esYx c6Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W/eb6uDj0ZcPussZNWTyXvX7+BhhrBBdZ4eRtPk3Njs=; b=Vbq6H2iA/Ax4Bla2vzwLlhZyR2j4GLFUPR2hopCNYdVI2FWMPVPSIEGXyKGzKpvXPR gkg4sE85UMfD4UaQuI2HndxrKdWLvg3qMshpDRG8gojeyDTu3I2QOYTCEXmQpjfyTYP1 pmgYfaiHTletG6rjcgGerW0+L7owt9Qb+HacHey+dBLN+QkeyDI7YnIDyrhEX1rUTVc9 8ihRDPFIRztjFeEH+AXLOn/qSyr4/nkHcrPWWkefAITo4F8SI7bNvw2OXwL1LcpbChEK 8CsyVFPMaPgNdGMjDzcHVWA8RwbdnuDbeWnC7cRXoIvbPJ/wUQSSa8E4SB1c4tL6QaW+ crlw== X-Gm-Message-State: AOAM531e5orl6nNOIIRctVJL+kIYyRA6O5jkoZSXZIj5IVtv622pbb+e OG50jq0p+TfcWIFv7X42Av8= X-Google-Smtp-Source: ABdhPJx6anogQ0dO7LsuIXNJzXEDRujujjsWcMLO0UFoTgFFwFE9Z53u3/uEPFJpppNAdDHHm6d0tA== X-Received: by 2002:a05:6e02:1709:: with SMTP id u9mr6278973ill.242.1636668145701; Thu, 11 Nov 2021 14:02:25 -0800 (PST) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id t5sm2612315ilp.8.2021.11.11.14.02.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 14:02:25 -0800 (PST) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, robdclark@gmail.com, sean@poorly.run, daniel.vetter@ffwll.ch, seanpaul@chromium.org, lyude@redhat.com, linux-kernel@vger.kernel.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v10 03/10] amdgpu: use dyndbg.BITGRPS to control existing pr_debugs Date: Thu, 11 Nov 2021 15:01:59 -0700 Message-Id: <20211111220206.121610-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211111220206.121610-1-jim.cromie@gmail.com> References: <20211111220206.121610-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211111_140226_688104_1626E8A6 X-CRM114-Status: GOOD ( 13.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org logger_types.h defines many DC_LOG_*() categorized debug wrappers. Most of these already use DRM debug API, so are controllable using drm.debug, but others use a bare pr_debug("$prefix: .."), with 1 of 13 different class-prefixes matching [:uppercase:] Use DEFINE_DYNAMIC_DEBUG_BITGRPS to create a sysfs location which maps from bits to these 13 sets of categorized pr_debugs to en/disable. Makefile adds -DDYNAMIC_DEBUG_MODULE for CONFIG_DYNAMIC_DEBUG_CORE, otherwise BUILD_BUG_ON triggers (obvious errors on subtle misuse is better than mysterious ones). Signed-off-by: Jim Cromie --- drivers/gpu/drm/amd/amdgpu/Makefile | 2 + .../gpu/drm/amd/display/dc/core/dc_debug.c | 47 ++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile index 653726588956..077342ca803f 100644 --- a/drivers/gpu/drm/amd/amdgpu/Makefile +++ b/drivers/gpu/drm/amd/amdgpu/Makefile @@ -38,6 +38,8 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \ -I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm \ -I$(FULL_AMD_PATH)/amdkfd +ccflags-$(CONFIG_DYNAMIC_DEBUG_CORE) += -DYNAMIC_DEBUG_MODULE + amdgpu-y := amdgpu_drv.o # add KMS driver diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_debug.c b/drivers/gpu/drm/amd/display/dc/core/dc_debug.c index 21be2a684393..e49a755c6a69 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_debug.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_debug.c @@ -36,8 +36,53 @@ #include "resource.h" -#define DC_LOGGER_INIT(logger) +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +#include + +unsigned long __debug_dc; +EXPORT_SYMBOL(__debug_dc); + +#define help_(_N, _cat) "\t Bit-" #_N "\t" _cat "\n" + +#define DC_DYNDBG_BITMAP_DESC(name) \ + "Control pr_debugs via /sys/module/amdgpu/parameters/" #name \ + ", where each bit controls a debug category.\n" \ + help_(0, "[SURFACE]:") \ + help_(1, "[CURSOR]:") \ + help_(2, "[PFLIP]:") \ + help_(3, "[VBLANK]:") \ + help_(4, "[HW_LINK_TRAINING]:") \ + help_(5, "[HW_AUDIO]:") \ + help_(6, "[SCALER]:") \ + help_(7, "[BIOS]:") \ + help_(8, "[BANDWIDTH_CALCS]:") \ + help_(9, "[DML]:") \ + help_(10, "[IF_TRACE]:") \ + help_(11, "[GAMMA]:") \ + help_(12, "[SMU_MSG]:") + +static struct dyndbg_bitdesc amdgpu_bitmap[] = { + [0] = { "[CURSOR]:" }, + [1] = { "[PFLIP]:" }, + [2] = { "[VBLANK]:" }, + [3] = { "[HW_LINK_TRAINING]:" }, + [4] = { "[HW_AUDIO]:" }, + [5] = { "[SCALER]:" }, + [6] = { "[BIOS]:" }, + [7] = { "[BANDWIDTH_CALCS]:" }, + [8] = { "[DML]:" }, + [9] = { "[IF_TRACE]:" }, + [10] = { "[GAMMA]:" }, + [11] = { "[SMU_MSG]:" } +}; + +DEFINE_DYNAMIC_DEBUG_LOG_GROUPS(debug_dc, __debug_dc, + DC_DYNDBG_BITMAP_DESC(debug_dc), + amdgpu_bitmap); + +#endif +#define DC_LOGGER_INIT(logger) #define SURFACE_TRACE(...) do {\ if (dc->debug.surface_trace) \