From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D492B4EE856 for ; Tue, 13 Oct 2026 11:33:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791891200; cv=none; b=Bq0krWp8Jz/TWzJ9KYULHjqIP4/Zb38Lk8YtcmcJrP6ivBPR5hSXEBvMqyZtsJ9ikikNNvQy/Aca91i5Z3ab8cLUxo772BAXnWMZtcddbpIDTUagX3lk167jBg9hTbAaw2TKlTDY77ZtJeKapBKsQZ+sQSaxAs7x1AR5ThTQ3HE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791891200; c=relaxed/simple; bh=SeTmFJlc7xESDzB6Iw10CIl8mg+WowrPSAr6+Ksx4bg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=U4I51dFJ88FdRE6QZLRV9dpTvbVOkltveYE42cu3jEZ38q2D82KDgUtA08Yds2KNzWNl8eafR0U0D+/Qr1+H0jchjOW49VyNqk+IohCCSVJEJbOgLymzBEfIEiyCwdJ8bn0qMgdAcalpc6DFvHTTcCAAjjWrI7LOy9F5b7f8jxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=WEsD157k; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="WEsD157k" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-48afcfc4bf5so2575229f8f.1 for ; Tue, 13 Oct 2026 04:33:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1791891194; x=1792495994; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=anitmvt5QBwY9lobKzDJl69qsHc8ScLJ3DQrPkwQ6aE=; b=WEsD157k7Qj/mlLooqinrQqIsxoUT5P+6SBfFm06g+BC9fjZmtKtIWcYq3PKYdBf/5 v1K5OV5hOvlHwKAho5ml7OmPQKjvCA63/ZqIhoV6ePuDIH+e9KemMJxS36tdnccc1g2z VxxaZba9DSrAnS9Lg7LBR6ADj7EZigCj/8J8kHCdzSWIYjU4qR6FIDY1IKPGjB+T+11F Ghc6KQnSkqnFRFGqPxIdMtKxDqEz7XyUhMbZ/FWQDNcTQsyInBbXRLkXr8EC9N2iMY+D nNCK5idnsJwe2kwWwvY7RVuw00blLrla7USHD+aA/4Naues3LqC76sQpXrxz38lia2i7 lzSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791891194; x=1792495994; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=anitmvt5QBwY9lobKzDJl69qsHc8ScLJ3DQrPkwQ6aE=; b=pSI/jz10g15ZfzIQf4cOk+psBg43n8R5wZVPBmH6wDxh0neVvye/8oomccK7Lql+z+ vxmZe9q5za3KrnFordWnxmXs0ZQIR5viSxxnojuRimF6SBP9oATFdDnen+oFuD9uuJUU onUs2OIJCuE7ScEiHqKUUnzUJLa8Jt9DAa3XfZhSK28o3Aehmv7G5IszzQtcRMmo+4gu h8clLQHdre51i/OXj7f8Chw0SIlNoIJGpwsk7DKjhYUTRahubsCFt0gSV6tR5wXeLzaN uzFEx+UV/t8G9U8NxPddKmDQCT45oBWbd6pcGPJi7cmUaNxEZPV+WfMBMAryR/b0H365 SWmg== X-Forwarded-Encrypted: i=1; AKwUvBydYWg7HV7OYHoB4xfI+xDZLvwuzRFg3jGMqVrT+LOPiU6U1r39RIXx8tr6QsvgyEp9UCp6sIV06EnQs+I6qfQ=@vger.kernel.org X-Gm-Message-State: AFq9FYILmFFkahSGY84Fzst89mRvF9emkaoeNkA/oQRu52gUg/9MCiT+ BVJhtDBWN9nqpbEj6F5LoZU8nj+h/RBBJzyXF77oPHslXaRTrPzhUu7+z40xELLnmHw= X-Gm-Gg: AYBFou1QsUFWtK2eVT3j0sJ0EZZ+bMcT4yeg0OhWUnBclgd8YuatwPo0w+ZhW65H9Uj eSUzvr2QrupShfGKc6h3zojlCEFgNoTLxHq00wrL+EMivRKqGC4FZphDV+oqgGabUTB8gfaJUhe Xf9Q1/1lson3wFbZKG2OUYPUczb+S+bW0dXdg4qAjkvZSVEPyKtHVYS8emne2o1s9QMo8ioFGB4 9jM4Mt2parcjJWuvcCprrMT5zL+Rf+McZytQrYm4S2RGBLMLfTGAH087r9K/lt+FhknsmvfB72+ 4vJRrmJRQsXN9TEdqqiZ2qUNO6KM2NLh8T0fXfoF2eL2VBPgtPDeYxEWUt0KNiJcnrdiCiWO/IR f6SyHoMc/P5VfbtcVq9AIDGBs2lqPeeIZFg7sXeNlEt9BouBhITwc7U818iBdjwQ3zbLwBmNqly h4lPHoFHnDEl3x39APMR8WTSFahyL6uomvCnBUfjKWiTQ3n8yHN3tfcjNL/UhKGfyh3fzWPzMv X-Received: by 2002:a05:600c:46c5:b0:4a0:eae0:769a with SMTP id 5b1f17b1804b1-4a18e4cd224mr244258165e9.28.1791891193452; Tue, 13 Oct 2026 04:33:13 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48de0bc50e0sm5960955f8f.49.2026.10.13.04.33.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2026 04:33:13 -0700 (PDT) Date: Tue, 13 Oct 2026 13:33:10 +0200 From: Petr Mladek To: jim.cromie@gmail.com Cc: Jason Baron , Shuah Khan , Andrew Morton , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Arnd Bergmann , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Jonathan Corbet , Greg Kroah-Hartman , Nathan Chancellor , Nicolas Schier , Shuah Khan , Randy Dunlap , "Rafael J. Wysocki" , Pavel Machek , Len Brown , Jonathan Corbet , Steven Rostedt , John Ogness , Sergey Senozhatsky , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-pm@vger.kernel.org, Philipp Hahn Subject: Re: [PATCH v12 33/40] dyndbg: Ignore additional arguments from pr_fmt Message-ID: References: <20261012-dd-cmap-part2-clean-v12-0-3c8cc5725def@gmail.com> <20261012-dd-cmap-part2-clean-v12-33-3c8cc5725def@gmail.com> Precedence: bulk X-Mailing-List: linux-kselftest@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: <20261012-dd-cmap-part2-clean-v12-33-3c8cc5725def@gmail.com> On Mon 2026-10-12 20:37:04, Jim Cromie via B4 Relay wrote: > From: Philipp Hahn > > 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: ‘DEFINE_DYNAMIC_DEBUG_METADATA_CLS’ undeclared (first use in this function) > > | DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, _DPRINTK_CLASS_DFLT, fmt) > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I wonder what this error about undeclared macro means. > > 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. > > --- a/include/linux/dynamic_debug.h > +++ b/include/linux/dynamic_debug.h > @@ -351,7 +351,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_descs") name = { \ > .modname = KBUILD_MODNAME, \ > diff --git a/include/linux/printk.h b/include/linux/printk.h > index f594c1266bfd..5d701952e739 100644 > --- a/include/linux/printk.h > +++ b/include/linux/printk.h > @@ -742,7 +742,7 @@ do { \ > static DEFINE_RATELIMIT_STATE(_rs, \ > DEFAULT_RATELIMIT_INTERVAL, \ > DEFAULT_RATELIMIT_BURST); \ > - DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, pr_fmt(fmt)); \ > + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ IMHO, this changes the existing behavior. The prefix added by pr_fmt() will no longer be stored in DEFINE_DYNAMIC_DEBUG_METADATA(). Is this intentional, please? Anyway, if we do not longer pass pr_fmt(fmt) then we should not need to add "..." into DEFINE_DYNAMIC_DEBUG_METADATA_CLS(). By other words, we newly pass just the format "fmt" without the parametes. The 4th parameter was added by pr_fmt(). IMHO, the right solution is to keep pr_fmt(fmt) here and extend both BEFINE_DYNAMIC_DEBUG_METADATA() and DEFINE_DYNAMIC_DEBUG_METADATA_CLS() to accept var args. I would expect something like: #define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt, ...) \ ... #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt, ...) \ DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, _DPRINTK_CLASS_DFLT, fmt, ##__VA_ARGS__) or maybe, we could "eat" the extra parameters in DEFINE_DYNAMIC_DEBUG_METADATA. It would mean to keep DEFINE_DYNAMIC_DEBUG_METADATA_CLS() as is and just add the "..." into DEFINE_DYNAMIC_DEBUG_METADATA(), aka #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt, ...) \ DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, _DPRINTK_CLASS_DFLT, fmt) Or do I miss something, please? It is possible that the macros work another way. Or this depends on another change. I checked only this patch... Best Regards, Petr PS: I was curious what Sashiko says about this change and it seems that it does not review this patchset from some reasons. > if (DYNAMIC_DEBUG_BRANCH(descriptor) && \ > __ratelimit(&_rs)) \ > __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \