From mboxrd@z Thu Jan 1 00:00:00 1970 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 486353909A9 for ; Fri, 13 Mar 2026 12:55:57 +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=1773406560; cv=none; b=iwLhDIp3+SOX1zRQqvasZ4jDHfZdMEx3psTUSnTzZwEPmoeunRa8QeQE/iKmwv24WH5PfG6lMoziAAJlcz2zmdMe3rStUewfljA/nJv21wHcLpYL5b9Xsy0U3BQStosaOX4GMYH83AFpt2tQDJxhmwCxmmuTYxRp3iqC1magxkc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773406560; c=relaxed/simple; bh=zZ8llDTzpVVgz8J8CX+3/uARBQCFQ16AAxDJNfRtUTM=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=m8XR0ug3ooFd/pHiFKZBZjNN/H1Ik7fAGB3uY7zgA6Czl/XfqAk5Mh0KnSRmwLnOJ0fyLxRWGysx0yy/DKz9SmJ9x0+2H/LmfSFyRp7Cs+i75T10d4uEDVMaSg2nkMpcrjUsGZqZAnTsshGfCVSLlOZl+eQxzW4f1KjhCruQCe0= 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 [212.42.244.71] (helo=mail.avm.de) by mail.avm.de with ESMTP (eXpurgate 4.55.2) (envelope-from ) id 69b40955-e21d-7f0000032729-7f000001c6be-1 for ; Fri, 13 Mar 2026 13:55:49 +0100 Received: from mail-auth.avm.de (dovecot-mx-01.avm.de [212.42.244.71]) by mail.avm.de (Postfix) with ESMTPS; Fri, 13 Mar 2026 13:55:49 +0100 (CET) Date: Fri, 13 Mar 2026 13:55:18 +0100 From: Philipp Hahn To: Jason Baron , Jim Cromie , linux-kernel@vger.kernel.org Subject: Re: dyndbg: pr_fmt(fmt) with additional arguments? Message-ID: Mail-Followup-To: Jason Baron , Jim Cromie , linux-kernel@vger.kernel.org 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 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-purgate-ID: 149429::1773406549-8DE67F2F-5C54CD1B/0/0 X-purgate-type: clean X-purgate-size: 3258 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 Hello, Am Fri, Feb 27, 2026 at 12:33:18PM +0100 schrieb Philipp Hahn: > 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__ itself has the following example: > #define pr_fmt(fmt) "%s:%s: " fmt, KBUILD_MODNAME, __func__ This breaks pr_debug_ratelimited(). > This could be fixed easily by adding an additional '...' to > `DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt)` 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. Ping? Philipp Hahn > 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 >