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=1793107381; b=mR+17OsjAnqfqXDraHzSD+NLFjaodU4qSf6eNY2uoASZOzo4d+dWlrrwmq/4y4YBBZDQ BnLHSlhAp4dGMTyoS0QV93Q0tVYYtf+Bu25sCYTpthYbiJbElPxdBk0wkfuG4TLsgpFve Mgh56VjX/rcRKTw3qd5pRgsUcy+tkrfbycl6zCUfKijObahnxgoDe5pQ+S95FnVaqNnC8 f/WCoPIsWmmMQQHG3zdQVw80IYV+fisVrn5z2uxnPprfgHwDxDVInaFHj3TFqHB7vu5rt ddmVob4PPjfAK7V3k8uz+2+OKuEKfwwGG3lrhnbM4BdbDLZIAHluozu+7CFCiFdcU5A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793107381; 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=Oq3Nrn+TBfu+btbKbh/3KCeFiEPG1GLqF2geovTHD8maeb4fjJOdSuiK69ihOfjbjO/A 8faAL7XPrZI9zlTUfwbCOMTh7Me/2y5O5O+C4G5sBkk23E49btwyW2KzvOx2uM/cIx9bC 6MYW9OxcMwrinn+sPnJh9ZLOrRD3tiTomhajBo266vZjrxn13np8/BQhIQx0f9YkYT0zD sIjA8voiqc8k9DQ9q94EEFxGRu7vBOE9403BfrbS7jonHiYE8vUUvZXqcPXpST6xet3fA GH6F1NBvcYS98tVlkixuQc7mSyNTCKe9tnhIvJU/2KLfN1ZH7VYPojY4HL3M2zm+IuQ== 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 614E5606A334 for ; Tue, 27 Oct 2026 13:23:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 614E5606A334 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-48afcd7ba9bso2515306f8f.3 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=1BI6WZs823wOt3kzE8t70ekPBSZmVCdG25KcOmInUWjnl1QBuQFli4uhCGe4/vhj7H nDuDQ0lJ9yCidlN422+C8oi4bKL9ENWmaFqj3/2qHHd02rNMp9tdBOVPBvdazcpiRW+Y bVJSgOeXJ1fUeLp8f92KlSSS3/gizhKRarQxaBLyPz29YZguL1GyAx0lzubPmI1fkJ7v 6b23IM8sI6oEQXHh5YzDhIpZh/kmaez7Zqke7XPHexeXdpx+uhCJu7qR0ccfqYNvWziQ DuI5lWDdB9pMIXWK5z19AdkvTUg9c3yQT4B1tzktkoyEPV2iDfi/es2Uw0dMnMsmwzzm uRUQ== X-Forwarded-Encrypted: i=1; AKwUvBw5YtBk310mRWRGGUvnZr7SxLH3O4m3peAXtFoj/KOJIfQXNU1Zx8fbBnccKHBGvUR3afWp5PMdNKZj@vger.kernel.org X-Gm-Message-State: AFq9FYJKkXtJYzD+h4l73LM20wrxRJLQvmX53VsQQuhVtqlIdxgcEagT 3n4CzPq2hMKXMuXJ1D0mfxDhlB2MmVJtBEVQYJYoqCD+rS1PUVoskpHX X-Gm-Gg: AYBFou0do+MW/ypykYuHThIjOXlpL6wAfNIVF3s7410EpnphNwaJnvjnHBSekS09FOx +kFPLU7FrL8RoIXed0d0VzZ/KGyZ4Qsh2stYn8s6TKEuY3Mb3AquNxyfpZCcM2iQvN92kny1jC3 hiPbZJ62A5P1rdIYiaBPEHohjyRGsttznsmhLrmGxiR8dExXU5kPt7hFzjpiaoRYo4RGqQ5o1xP xYX9Gg3LYNy+nKMu6aopTbgTkfBl8yn7vOayk+kEniz8xuW8eBJP0qtuW8tbmZF82gHHzPHXdY9 7auso9vufEbivmjPCq7In4zc680XurM3nHo+BZeqlPEFVxgli8NNkT9vIQbuKBnwPc8SEYuW0IY 2XD7Hs6JJ9oUX+9jTgGvPEnqQit4FyOQ8xk/2GgU23f91DN6yTiice8W5e5AKE006fHIR8gXQHU 7omwbGKK/fNfj6dIhNFjqMvXvur642M3OWNCZ88nIBd9HDIpjRKpVSdZadNS+Jpy2JyV9OepP2N 9++L+YlUsR760nvVdd9LNAhJXYsSgMLrwLJ2cK/TwXSYeRN0JYs14kHRKQsBvgkq1hOFup9Vgbf i5uPzGIYBbcV8BKXq7QjVbY01nt3oyIVG4D5CA== 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-arch@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