Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2482867rwb; Sun, 4 Sep 2022 17:26:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ZBSifYc9NW6sdiF6tNBaJ/6OxehjSkXfDJFdYBgTz1hLqZW2MwUN/Uc7LIrBJP1dpm+D4 X-Received: by 2002:a17:907:2bc7:b0:73d:d239:110b with SMTP id gv7-20020a1709072bc700b0073dd239110bmr34075703ejc.752.1662337610743; Sun, 04 Sep 2022 17:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662337610; cv=none; d=google.com; s=arc-20160816; b=J6IkreID2Y6mBk8clukovP8w5EOSKsXPTsJ3/50nqy+/e7Rs3qGRrr5UFxM5AxAhV1 mDMQekynJuvX8hFzClGfffZZiDaGYhGObR9T55qpK+tjFIDJPuAc1IC50SovuUART298 FtRlB2In4S9cN6zsqlIjM3GK4tzTKEtTelUhn8pnB88lNet4SGJu/y0kjjHsQeFAzsjp 851NZnrFyIiBOhVMwfBSc69FCBedxFZsvB1nm+xTKtXBwJxw4zXWBbKz+1IPvJND+OcW OqiCn0xoJFjQj7Y596lepfVTWjLxC/gtmxMf0jv5orNDTZ5MM97Xat9Apn8rREhlLdQx 8kiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AsutXgMDAJiXYIziQgoUHz04vuwS74Ufjn18RboeZlU=; b=01+d8vmUwQuQJ7mBT0gGqx8+vZl5qevBcXkKZr7L+aDPDxZifuoVKCfKZp019haWeJ lh76t0rawV+MUc92JZCLPepTlTzTJ5b7SiL+Gv9f6xBC03LUEQyuxASV+KlHxnkRIF6w SWZWpvgIi/2PyzpTAJL7NiOqYMaHYOQtEk3I6SPSFEuTOgWM08M0abrB3Dqm4ez+lt1t 3s3C1n9clMMocdfph9i6m+EDV7yPK7UaBfPWCyiXHLlNC6Vqnh/HJubMSLLe2ZcYC1XP v7t/WHqsp1pKIPu81OeW/zbY9fnTniU89H/nNb4N5/b12ogPPl6UHDHRX62pVDKM26X/ ELvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Qw5u5kHl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ky17-20020a170907779100b0073d6c60b4a4si5903699ejc.953.2022.09.04.17.26.26; Sun, 04 Sep 2022 17:26:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Qw5u5kHl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235432AbiIDVnv (ORCPT + 99 others); Sun, 4 Sep 2022 17:43:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235369AbiIDVmm (ORCPT ); Sun, 4 Sep 2022 17:42:42 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 781B92C109 for ; Sun, 4 Sep 2022 14:42:33 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id y187so5723838iof.0 for ; Sun, 04 Sep 2022 14:42:33 -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=AsutXgMDAJiXYIziQgoUHz04vuwS74Ufjn18RboeZlU=; b=Qw5u5kHlAuCdVRdp5boFr8w9l56DpQmLytG5X7x/gapi8SNDYyfHxGQ865EixG1rDF w+qm25s4Qx7V+r1LIT4Yojr69wswh53LgdFjuv5u8ss4N7Y3M6OvvXRH+gSQtLhrl51K 8MA7vqh1hp2ucRb7mbZmSegCHdgHh45ZtNYeJv2RuaJEfVrE7xjijSClBWTNNcJBAAfv QJ9VxUtPDKNoU59NHhpkj4z/UKL9NQ5pTTXZdMEXqLoRbGLT/+iXx3JIGAlyabOc3HOS z4XZEA/jjk7trB7VNHK/xQkhJcQcINVffpR5ej+XDbn5uk/XFMlCTA04L/CLoqDiCira /Okw== 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=AsutXgMDAJiXYIziQgoUHz04vuwS74Ufjn18RboeZlU=; b=wDJF0ECzoiTuIoeB+9r/Y+u7/aotJIkpBdxxbuEnjnxgmI9s4294lcHlMU68S2YlZC z2CAy86TS4sjEG4jMKxwI3qMlJR/BhCCgwA5I50pUVqmCmi4G6ZG/OJp5kIkyN3OTrt8 qW1wVDAN3FowBWIaYMQH0mzJXHnZD4u1zOQMky0CO7ZyXBvpcOXm12J+GTWu5HvimQHR 1FNilPjpqn9voSZbaLsowwn/CebuCrGd3j8jgSJ9Ft26Jj2oAQMKktMYwCMkvLc/y3N8 x9hVZ12FYLuAv97b/ptEgXf5/+dzcA5lGSsmbQU1rl/h8w06fG5Py1RG5UyFx0hzcCLh voFg== X-Gm-Message-State: ACgBeo0a0pvodLa1jUURPGps80tpprO8zsjF2GCGe4jSxloN7s6/Wg8Y Vp7W23wW7muP0Zunvq0ZjbY= X-Received: by 2002:a02:740b:0:b0:349:bcdd:ca20 with SMTP id o11-20020a02740b000000b00349bcddca20mr25953249jac.110.1662327753065; Sun, 04 Sep 2022 14:42:33 -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 e12-20020a056602044c00b006889ea7be7bsm3727688iov.29.2022.09.04.14.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Sep 2022 14:42:32 -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 Cc: daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, linux@rasmusvillemoes.dk, joe@perches.com, Jim Cromie Subject: [PATCH v6 24/57] drm_print: interpose drm_*dbg with forwarding macros Date: Sun, 4 Sep 2022 15:41:01 -0600 Message-Id: <20220904214134.408619-25-jim.cromie@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220904214134.408619-1-jim.cromie@gmail.com> References: <20220904214134.408619-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org change drm_dev_dbg & drm_dbg to macros, which forward to the renamed functions (with __ prefix added). Those functions sit below the categorized layer of macros implementing the DRM debug.category API, and implement most of it. These are good places to insert dynamic-debug jump-label mechanics, which will allow DRM to avoid the runtime cost of drm_debug_enabled(). no functional changes. memory cost baseline: (unchanged) bash-5.1# drms_load [ 9.220389] dyndbg: 1 debug prints in module drm [ 9.224426] ACPI: bus type drm_connector registered [ 9.302192] dyndbg: 2 debug prints in module ttm [ 9.305033] dyndbg: 8 debug prints in module video [ 9.627563] dyndbg: 127 debug prints in module i915 [ 9.721505] AMD-Vi: AMD IOMMUv2 functionality not available on this system - This is not a bug. [ 10.091345] dyndbg: 2196 debug prints in module amdgpu [ 10.106589] [drm] amdgpu kernel modesetting enabled. [ 10.107270] amdgpu: CRAT table not found [ 10.107926] amdgpu: Virtual CRAT table created for CPU [ 10.108398] amdgpu: Topology: Add CPU node [ 10.168507] dyndbg: 3 debug prints in module wmi [ 10.329587] dyndbg: 3 debug prints in module nouveau Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_print.c | 10 +++++----- include/drm/drm_print.h | 9 +++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index ec32df35a3e3..29a29949ad0b 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -279,8 +279,8 @@ void drm_dev_printk(const struct device *dev, const char *level, } EXPORT_SYMBOL(drm_dev_printk); -void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, - const char *format, ...) +void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, + const char *format, ...) { struct va_format vaf; va_list args; @@ -301,9 +301,9 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, va_end(args); } -EXPORT_SYMBOL(drm_dev_dbg); +EXPORT_SYMBOL(__drm_dev_dbg); -void __drm_dbg(enum drm_debug_category category, const char *format, ...) +void ___drm_dbg(enum drm_debug_category category, const char *format, ...) { struct va_format vaf; va_list args; @@ -320,7 +320,7 @@ void __drm_dbg(enum drm_debug_category category, const char *format, ...) va_end(args); } -EXPORT_SYMBOL(__drm_dbg); +EXPORT_SYMBOL(___drm_dbg); void __drm_err(const char *format, ...) { diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 668273e36c2c..c429c258c957 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -335,7 +335,7 @@ __printf(3, 4) void drm_dev_printk(const struct device *dev, const char *level, const char *format, ...); __printf(3, 4) -void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, +void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, const char *format, ...); /** @@ -384,6 +384,9 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, } \ }) +#define drm_dev_dbg(dev, cat, fmt, ...) \ + __drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__) + /** * DRM_DEV_DEBUG() - Debug output for generic drm code * @@ -485,10 +488,12 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, */ __printf(2, 3) -void __drm_dbg(enum drm_debug_category category, const char *format, ...); +void ___drm_dbg(enum drm_debug_category category, const char *format, ...); __printf(1, 2) void __drm_err(const char *format, ...); +#define __drm_dbg(fmt, ...) ___drm_dbg(fmt, ##__VA_ARGS__) + /* Macros to make printk easier */ #define _DRM_PRINTK(once, level, fmt, ...) \ -- 2.37.2