From nobody Mon Apr 6 21:34:18 2026 Received: from mail.avm.de (mail.avm.de [212.42.244.94]) (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 36B3023EAA6 for ; Tue, 17 Mar 2026 20:40:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.42.244.94 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773780008; cv=none; b=gK9ESkSfcMjdrbQo8n/ZLqPHz6+Q8ABvcmuUYz3Z2qBFEVeFakMSCUlcx8/gUlzcf+jYKWmWZlSxURuHzudPjvkiA4ZS9Qimjbp2ohiitq619p/S+Q5gjqJOVGOnOKPIPtocuLk/EMrW5OI4mM4JJz4wL1E9t0bjiBNNQSqt4nw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773780008; c=relaxed/simple; bh=eof4qmXwFL6fwLnUP2Lc0S8wijNs4cHa6qS1tk6Z/H0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QaWDrVkmowULymnytB6WxiylVA4k/giqunTSWWKzYbfHYG7mv/OTr9xatFgMyJnI6A4K/g66r910ECm0NNOo9Kuwok8eqUxAbUzepEV9zOb+nF49GLCiW4pNySTxK2BxhiDhIYUw1IWfTWbYcwVMBvoTPaDJ9gHLP8DE6n3Ogx0= 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.94 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 69b9bc1c-a734-7f0000032729-7f000001dc08-1 for ; Tue, 17 Mar 2026 21:39:56 +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; Tue, 17 Mar 2026 21:39:56 +0100 (CET) From: Philipp Hahn To: Jason Baron , Jim Cromie Cc: linux-kernel@vger.kernel.org, Philipp Hahn Subject: [PATCH v2] dyndbg: Ignore additional arguments from pr_fmt Date: Tue, 17 Mar 2026 21:39:52 +0100 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Organization: FRITZ! Technology GmbH, Berlin, Germany Content-Transfer-Encoding: quoted-printable X-purgate-ID: 149429::1773779996-B7796A02-AE7AD82E/0/0 X-purgate-type: clean X-purgate-size: 2604 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 pr_fmt can be used to add a common prefix to any output from a module: #define pr_fmt(fmt) KBUILD_MODNAME ".%s " fmt, __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: =E2=80=98DEFINE_DYNAMIC_DEBUG_METADATA_CLS=E2=80=99 undeclared (fi= rst use in this function) > | DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, _DPRINTK_CLASS_DFLT, fm= t) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > note: in expansion of macro =E2=80=98DEFINE_DYNAMIC_DEBUG_METADATA=E2=80= =99 > | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, pr_fmt(fmt)); = \ > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > note: in expansion of macro =E2=80=98pr_debug_ratelimited=E2=80=99 > | 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 Acked-by: Jim Cromie --- include/linux/dynamic_debug.h | 2 +- lib/test_dynamic_debug.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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(); \ } =20 -#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 =3D { \ .modname =3D KBUILD_MODNAME, \ diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 77c2a669b6afd..cf1e3b5f6f0f8 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -6,7 +6,7 @@ * Jim Cromie */ =20 -#define pr_fmt(fmt) "test_dd: " fmt +#define pr_fmt(fmt) "test_dd: %s " fmt, __func__ =20 #include =20 @@ -155,7 +155,7 @@ static int __init test_dynamic_debug_init(void) =20 static void __exit test_dynamic_debug_exit(void) { - pr_debug("exited\n"); + pr_debug_ratelimited("exited\n"); } =20 module_init(test_dynamic_debug_init); --=20 2.43.0