From mboxrd@z Thu Jan 1 00:00:00 1970 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 9D43FECAAA1 for ; Mon, 12 Sep 2022 05:29:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7ED710E101; Mon, 12 Sep 2022 05:29:13 +0000 (UTC) Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by gabe.freedesktop.org (Postfix) with ESMTPS id E007710E0BF; Mon, 12 Sep 2022 05:29:09 +0000 (UTC) Received: by mail-il1-x12b.google.com with SMTP id g12so3456772ilj.5; Sun, 11 Sep 2022 22:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=hvW6/T6Cu72NQNfFfc0LhYHeClJNDYHLK7XVJp6RWjY=; b=eppAjAsuUmGBxIeOj6rGT5Zzj4kd14EFQg7EeefJa06tgwqgcjL7pCtXjIqpTgMxTu IWg9xEhhX2cRxVmomkNo5CVf8pUgpx8USZA+YnIwiOD3whjJ11U6bebniALvADonx8Wb jKfs6HSmgUBSuF8noAcfkvEAqXRd+zKU/jMwZahue/n+QMxo6WK5q3ddpkwVDT1hLzJo XOrNKwsJQXSMFEDsDF1lC37OceslIDiHLe4MBDdzp0L/VCEQyqLyKOKSkDDmETPXA6Ql F2+VVER5RKWQ6VwhtRdejFqwE2dBTM6gpZ9/y9lGJ70Yu/CoL7S/H07XF9of86iaf9He sh+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=hvW6/T6Cu72NQNfFfc0LhYHeClJNDYHLK7XVJp6RWjY=; b=JDgecdfNo/hRfxVi/tBZyY27kHGk5mt55DMfdwwleAX0Y893n1HlU/lvFuvMKal4Q0 B42p4z/Jc6ansVMWv9FVKh2vbxU9pVpERwUQaDp04GdJFb97Qvjo7zeqNKDP5x/AIRGx QGq9xKgLKUH+EowCFRaqF1aU78RbATivmEtYIow22BDXeZC2CQBX/zBI8hpN2XDc/l+r RPA6zueGmOPhsZ0xHWmG0aeOT30X5Ssm8RaC8B+LLMl+kKQUfdaNHtS1uxNgTqyfGFFM gOFAqHTOliqp9EJ42OuxQeCYn+e9xTtzNjsHlL0mYmNI75WObWBuAHF0ujICk7LzzOvr 6Z/A== X-Gm-Message-State: ACgBeo2nmObXRvfAq1oOwcPUsgF0kl6+vZay8O2o3apss/B4Drrosr6t ryj7+II25M8IkBmR6rXycbk= X-Google-Smtp-Source: AA6agR4VJPaBwHPf7er126QoRWoFsAbD2ztO278tK6mflIQcNK3updSOLOr20syBs+uCTsSAZ5nxdQ== X-Received: by 2002:a05:6e02:1524:b0:2ec:71c6:7b85 with SMTP id i4-20020a056e02152400b002ec71c67b85mr9839711ilu.237.1662960549182; Sun, 11 Sep 2022 22:29:09 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id q16-20020a056e02079000b002eb75fb01dbsm3006057ils.28.2022.09.11.22.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Sep 2022 22:29:08 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 4/9] drm_print: wrap drm_*_dbg in dyndbg descriptor factory macro Date: Sun, 11 Sep 2022 23:28:47 -0600 Message-Id: <20220912052852.1123868-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220912052852.1123868-1-jim.cromie@gmail.com> References: <20220912052852.1123868-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jim Cromie , daniel.vetter@ffwll.ch, linux@rasmusvillemoes.dk, robdclark@gmail.com, seanpaul@chromium.org, joe@perches.com Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" For CONFIG_DRM_USE_DYNAMIC_DEBUG=y, wrap __drm_dbg() & __drm_dev_dbg() in one of dyndbg's Factory macros: _dynamic_func_call_no_desc(). This adds the callsite descriptor into the code, and an entry for each into /proc/dynamic_debug/control. #> echo class DRM_UT_ATOMIC +p > /proc/dynamic_debug/control CONFIG_DRM_USE_DYNAMIC_DEBUG=y/n is configurable because of the .data footprint cost of per-callsite control; 56 bytes/site * ~2k for i915, ~4k callsites for amdgpu. This is large enough that a kernel builder might not want it. Signed-off-by: Jim Cromie --- drivers/gpu/drm/Kconfig | 12 ++++++++++++ drivers/gpu/drm/Makefile | 2 ++ include/drm/drm_print.h | 12 ++++++++++++ 3 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 6c2256e8474b..2438e0dccfa1 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -50,6 +50,18 @@ config DRM_DEBUG_MM If in doubt, say "N". +config DRM_USE_DYNAMIC_DEBUG + bool "use dynamic debug to implement drm.debug" + default y + depends on DRM + depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE + depends on JUMP_LABEL + help + Use dynamic-debug to avoid drm_debug_enabled() runtime overheads. + Due to callsite counts in DRM drivers (~4k in amdgpu) and 56 + bytes per callsite, the .data costs can be substantial, and + are therefore configurable. + config DRM_DEBUG_SELFTEST tristate "kselftests for DRM" depends on DRM diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index e7af358e6dda..6828197967a6 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -3,6 +3,8 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. +CFLAGS-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE + drm-y := drm_aperture.o drm_auth.o drm_cache.o \ drm_file.o drm_gem.o drm_ioctl.o \ drm_drv.o \ diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index c429c258c957..2d2cef76b5c1 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -384,8 +384,14 @@ void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, } \ }) +#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) #define drm_dev_dbg(dev, cat, fmt, ...) \ __drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__) +#else +#define drm_dev_dbg(dev, cat, fmt, ...) \ + _dynamic_func_call_no_desc(fmt, __drm_dev_dbg, \ + dev, cat, fmt, ##__VA_ARGS__) +#endif /** * DRM_DEV_DEBUG() - Debug output for generic drm code @@ -492,7 +498,13 @@ void ___drm_dbg(enum drm_debug_category category, const char *format, ...); __printf(1, 2) void __drm_err(const char *format, ...); +#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) #define __drm_dbg(fmt, ...) ___drm_dbg(fmt, ##__VA_ARGS__) +#else +#define __drm_dbg(cat, fmt, ...) \ + _dynamic_func_call_no_desc(fmt, ___drm_dbg, \ + cat, fmt, ##__VA_ARGS__) +#endif /* Macros to make printk easier */ -- 2.37.3