From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.avm.de (mail.avm.de [212.42.244.120]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E57CB3ECBCA for ; Fri, 27 Feb 2026 11:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.42.244.120 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772191208; cv=none; b=CPfzXkZbcgbKww5RBHZWX+663DpO1Qnz//AaFuVIi6ZXt+iCULY6nF8KmKtwI8BguA+LVR7QPpubp2pbFXIlCHOKaTeUFQbPelegj+pK15zKmUDco1GE5S7DHOxc4M/+paO8Sdj29G42FnICaG/ksJCrAaox+ehXiVUqfWX1Cf0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772191208; c=relaxed/simple; bh=mMP39wVBeVEPNeq5TXPhF+Asl+2jnR0rzRl6G1NEl7U=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=YxtZOMWHSI4iqgv5uMlNljb4+io+a5W/DcYLH8/bNcfo70sLHUWg0J++dTdkN4IYc3CESvFaKyJWvyorrXEBXeF90sFORiIAtLG0gS5Pmqd6lK6Og4fcKkb3l8hMfocu10+iHet2M6KEw7Lz7y6aj14ySBIWhF2GpkPqjzSLnmo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=avm.de; spf=pass smtp.mailfrom=avm.de; arc=none smtp.client-ip=212.42.244.120 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=avm.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=avm.de Received: from [2001:bf0:244:244::71] (helo=mail.avm.de) by mail.avm.de with ESMTP (eXpurgate 4.55.2) (envelope-from ) id 69a17c1d-0473-7f0000032729-7f000001cd78-1 for ; Fri, 27 Feb 2026 12:12:29 +0100 Received: from mail-auth.avm.de (dovecot-mx-01.avm.de [IPv6:2001:bf0:244:244::71]) by mail.avm.de (Postfix) with ESMTPS; Fri, 27 Feb 2026 12:12:29 +0100 (CET) Date: Fri, 27 Feb 2026 12:12:28 +0100 From: Philipp Hahn To: Jason Baron , Jim Cromie , linux-kernel@vger.kernel.org Subject: dyndbg: pr_fmt(fmt) with additional arguments? Message-ID: Mail-Followup-To: Jason Baron , Jim Cromie , linux-kernel@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="CFwBZZ+b2rGOhDlc" Content-Disposition: inline Content-Transfer-Encoding: 8bit X-purgate-ID: 149429::1772190749-490E495F-6AF22552/0/0 X-purgate-type: clean X-purgate-size: 3701 X-purgate-Ad: Categorized by eleven eXpurgate (R) https://www.eleven.de X-purgate: This mail is considered clean (visit https://www.eleven.de for further information) X-purgate: clean --CFwBZZ+b2rGOhDlc Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hello Jason, hello Jim, I've been using the following in my modules to prefix all messages with the module and function name: #define pr_fmt(fmt) KBUILD_MODNAME ".%s ", __func__ This worked nicely until `pr_debug_ratelimit()` is used: The additional arguments breaks `DEFINE_DYNAMIC_DEBUG_METADATA_CLS`: #define pr_debug_ratelimited(fmt, ...) \ DEFINE_DYNAMIC_DEBUG_METADATA(…, pr_fmt(fmt)); \ #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, …, fmt) #define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt) \ static struct _ddebug __aligned(8) \ __section("__dyndbg") name = { \ … \ .format = (fmt), \ This could be fixed easily by adding an additional '...' to it to slurp any additional argument which `pr_fmt` might add. Would this be okay or do I miss something? For testing I have recompiled current 7.0.0-rc1 for x86_64 with no compile failures. Philipp Hahn --CFwBZZ+b2rGOhDlc Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0001-dyndbg-Ignore-additional-arguments-from-pr_fmt.quilt" Content-Transfer-Encoding: 8bit >From 545173a75e3928ec000b1127bfc99439b7fa2f8b Mon Sep 17 00:00:00 2001 Message-ID: <545173a75e3928ec000b1127bfc99439b7fa2f8b.1772186702.git.p.hahn@avm.de> From: Philipp Hahn Date: Fri, 27 Feb 2026 10:53:04 +0100 Subject: [PATCH] dyndbg: Ignore additional arguments from pr_fmt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Organization: FRITZ! Technology GmbH, Berlin, Germany pr_fmt can be used to add a common prefix to any output from a module: #define pr_fmt(fmt) KBUILD_MODNAME ".%s ", __func__ But adding additional arguments breaks dynamic debug: > error: macro "DEFINE_DYNAMIC_DEBUG_METADATA_CLS" passed 4 arguments, but takes just 3 > | pr_debug_ratelimited("%s", "Hello world!"); > | ^ > note: macro "DEFINE_DYNAMIC_DEBUG_METADATA_CLS" defined here > | #define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt) \ > | > error: ‘DEFINE_DYNAMIC_DEBUG_METADATA_CLS’ undeclared (first use in this function) > | DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, _DPRINTK_CLASS_DFLT, fmt) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > note: in expansion of macro ‘DEFINE_DYNAMIC_DEBUG_METADATA’ > | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, pr_fmt(fmt)); \ > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > note: in expansion of macro ‘pr_debug_ratelimited’ > | pr_debug_ratelimited("%s", "Hello world!"); > | ^~~~~~~~~~~~~~~~~~~~ Add an additional ', ...' to DEFINE_DYNAMIC_DEBUG_METADATA_CLS to slurp any additional argument, which `pr_fmt` might add. Signed-off-by: Philipp Hahn --- include/linux/dynamic_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 05743900a1169..0ac0df04bac00 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -167,7 +167,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, dump_stack(); \ } -#define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt) \ +#define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt, ...) \ static struct _ddebug __aligned(8) \ __section("__dyndbg") name = { \ .modname = KBUILD_MODNAME, \ -- 2.43.0 --CFwBZZ+b2rGOhDlc--