From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793107380; b=cAnL8wZEyR4t8mG/w37G7WW4oRb7gENH5F7EW0/0s6TwL8s/LzRaRJgnZqnLhSEwaRL5 XZkgDFtvXVkW1NtunjJl+ZVnqIG+3UN7alcDLBwZ/qCF0QurtCPDD+0lPxjW9bR/d1wCF xLJzHozW+Y2RzHJxvsnwj2rv/19ixdhwcI65oCNImCncKW8ac95GNrdzcNSgUa8VIsdiq GLpdhS+/cMhgx/xoN+6VOR/LO2RBBEATl5ohiDzuycmuRb2eZMvt1wzEYWqJ3phAzivUp zTclliVGI5aF7UK5dXEQGzsVq4jrFvcAbxLlmQ2hrGeZVd7tqIr0OgoXU1F1BaqVoGw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793107380; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=bt8+RMZDmd6s3sr6pjCs6SFKWlDJZBaHmutX4rG7P/I=; b=Zz1HOvPmI3DeB90C6u7wVraGUzEnnH9qcJeeu6Z8cGargd3lCgpts40hpCdrxPJJBalr +WBMrPBeJ0rKeuY30XgPWO2xynKsOIV10G4EyLPWol36g3u8HJUlVU9jDs5W6bO4l+khh sJs/0+r8IKTZcRE12CJWUL0jJ4DEW+UBPu/m3WTapExdKeOyOjpJNQRegApJL0uHWzar1 RnqIRn4ZBSWm1gJaTVSZXV+q55LmGrf7gFK+CLvmidk5iC5Opm+3EsUT6OhraTVJtw9rV 4qDMZXUOESzashwyVlQRqGbeAcuOqgUnz/PkZA5l/eCk7m9IWuHTDHzMHa21iOxWSiA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=D9I2Gz1I; arc=none smtp.remote-ip=209.85.221.53 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61731606A335 for ; Tue, 27 Oct 2026 13:23:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 61731606A335 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=D9I2Gz1I Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-48e00eee27dso2677139f8f.0 for ; Tue, 27 Oct 2026 06:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1793107379; x=1793712179; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=bt8+RMZDmd6s3sr6pjCs6SFKWlDJZBaHmutX4rG7P/I=; b=D9I2Gz1I6TohXPedOvNnB4ot89+HPLVnTkGptL1nmvPR4Ebd0vQn2mx7tGT4eB0wit W+dL+ixtQthAPpXmXGw+in0Ctz2kcsbC7kvOahclFSp3KfkjUGqV3ABxYzaD+KwrlTD4 BeGIYXqQXlyJOjpqkE4+SfEnC7QOcgIF3nBUyOkghRDfERqmQA81j0Cf9h1GY+YVjcQT pmi0J//7BiN8/L+QE6jbor1n6tDO9QgrBax8oRoYgFG5p1K5OAkUDsAmLXxsJOJH/haN VJR4dII5YeaaxYhDUvgLePp4t+Vaoq38Df1PdbOvbABf7w3llPt9EfabyodDQesC4ZgT wM5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793107379; x=1793712179; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to: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=bt8+RMZDmd6s3sr6pjCs6SFKWlDJZBaHmutX4rG7P/I=; b=DekD38dW/hFGqkXBsXFH+d9KszDe/5RB4gansEBdJz1+S2RJooz4CPf6q1ufZmZgFH rl2cYC+AINUEERUbFS6H5VgP0er0gPd8wJD9tHBQy2Ixh7Gy6HcZBrwlvI3XsMpbMXax H4nYvAmORjoX9L8xWSn2LWWt2NYt7t5AzX36ytURlQ4l48C2v3ft9wCJFs8pb28cxURp akFhzlSdzu8OXjCYQO7g49dRxvooeKgUepni/4dxow7GHkINlAavpm0nbKxFuYHGHryO ESBqFJX3twSbiPAjBtBWo9JjRGzxTb4mmm0MP5dFhozYFjn543iGoGoXFeQN6tmPSecP vo+Q== X-Forwarded-Encrypted: i=1; AKwUvBwgmDC4wprUARZ2hMNraf2nsYU6EDEC7afHfMfxsQC+GI1Kgt9drOMa+wbiG6HnwrwY1NHBpqtG1vZOLLJ7@vger.kernel.org X-Gm-Message-State: AFq9FYJVd32FdSDBojZDxmYCnR/phwT5RGNg7aVIFi/i4G/w8Caxf0qC yOjrr0y3aMRAM5wfDcXze7uddUAz5QYguaPIcsWwAjkRrWS5z3l/U3GJ X-Gm-Gg: AYBFou2QVtLmmP5e/NiYlKhcUtzv+4cN06eO6VlJjvjZdGb8GPZmdqzURqLmnvtqa19 g3Py6H8i5SGYtVPramJ83VolJxZA82Vm+AT3TKIHctgIo+VrXcKSDEKsBpVW5/BpmR0sAEcvpXl t+WEvbya52QxT4miepzHgx75piGMwOpVMvk+mU0abo2U93cUiYJ2DomJPjPJzCIJZwFdCZaC610 oC9t/z+5wkFBltApduF+7BeOuh4g29mpGggpMqAJ7EfZxnH17Jms95tvre88/AYnl+GGCD362qY Cq3Fpy1cIQ1EHpLCdxkuyx5CrTjWNxjryfBUreoNSr4fE8KDL3dl/lTgnPFId+gARgsj98fWqOr 9kN5hp5lGrxH/UgLDJOE7+/KrlMRike0TVqxaRrekTHFzD+LSB94zOr6dGa2HsHf0pCdS7K7aJP UnPNqDCi/26x1wWcI0soLN9TMtW1n4o6ZcDHicjO/mxjPSd/7oVwhLg80gAbxhNfYQYsvP3vfQS 6ZPOv6eEuhiHCacgJ86u1Ji5Wj/x2hxEYbOahoQmd38abeMQFzkzBz/Dv3f+3qabchxPGxMtN1k xLqzqIk8Ttwgk26K4fh31lMvPVJ+KRSZTiPcWQ== X-Received: by 2002:a05:6000:2388:b0:48c:7386:af18 with SMTP id ffacd0b85a97d-48e3eb2cf0fmr19717600f8f.8.1793107378393; Tue, 27 Oct 2026 06:22:58 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e3ebc39a8sm23819954f8f.11.2026.10.27.06.22.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2026 06:22:56 -0700 (PDT) Date: Tue, 27 Oct 2026 13:22:53 +0000 From: David Laight To: Petr Mladek Cc: jim.cromie@gmail.com, 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 =?UTF-8?B?V2Vpw59zY2h1aA==?= , 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: <20261027132253.5f3a461d@pumpkin> In-Reply-To: References: <20261012-dd-cmap-part2-clean-v12-0-3c8cc5725def@gmail.com> <20261012-dd-cmap-part2-clean-v12-33-3c8cc5725def@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) X-Mailing-List: linux-modules@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, 13 Oct 2026 13:33:10 +0200 Petr Mladek wrote: > On Mon 2026-10-12 20:37:04, Jim Cromie via B4 Relay wrote: > > From: Philipp Hahn > >=20 > > 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__ > >=20 > > But adding additional arguments breaks dynamic debug: =20 > > > 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= (first use in this function) > > > | DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, _DPRINTK_CLASS_DFLT= , fmt) > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =20 >=20 > I wonder what this error about undeclared macro means. >=20 > > > 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!"); > > > | ^~~~~~~~~~~~~~~~~~~~ =20 > >=20 > > Add an additional ', ...' to DEFINE_DYNAMIC_DEBUG_METADATA_CLS to slurp > > any additional argument, which `pr_fmt` might add. > >=20 > > --- 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(); \ > > } > > =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_descs") name =3D { \ > > .modname =3D 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); \ =20 >=20 > 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? >=20 > Anyway, if we do not longer pass pr_fmt(fmt) then we should not > need to add "..." into DEFINE_DYNAMIC_DEBUG_METADATA_CLS(). >=20 > By other words, we newly pass just the format "fmt" without the parametes. > The 4th parameter was added by pr_fmt(). >=20 >=20 > 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: >=20 > #define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt, ...) \ > ... >=20 > #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt, ...) \ > DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, _DPRINTK_CLASS_DFLT, fmt, ##__VA= _ARGS__) >=20 >=20 > 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 >=20 > #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt, ...) \ > DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, _DPRINTK_CLASS_DFLT, fmt) >=20 >=20 > Or do I miss something, please? Don't think that will work. Won't you end up with ".%s" fmt as the string without the extra argument. So you need to keep the expansion of pr_fmt() together until is is finally substituted into a printf-like call. It is possible to enclose it in () so it is passed as one parameter and remove them on the final expansion. David >=20 > It is possible that the macros work another way. Or this depends > on another change. I checked only this patch... >=20 > Best Regards, > Petr >=20 > PS: I was curious what Sashiko says about this change and it seems > that it does not review this patchset from some reasons. >=20 > > if (DYNAMIC_DEBUG_BRANCH(descriptor) && \ > > __ratelimit(&_rs)) \ > > __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \ =20 >=20