From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793285816; b=MwMBgs5NdFFWZRtTXkZXD1IZF7xvolnB2VWYjkoGuNecNuIdGqPgr3sReGyrYWUFTwE8 1lyqDmC8teT0UzLKEn3sRMqFZt+Zq6NKO8qnY9xpNcaGYHKVI1K7NWLCfvC3cLQGcEygA oXPcKD7xTxTy4ODMAU1PL+HONz3g3QmdPeNPcmMMcgzhQ4pgOE8A7HAm2AnDdMMlRtNcf IaQr6E1YqrD6pESRRXwiS9dVxwTKTo0JU6xHVSk/g5LA19nD4lqLJz+0J7hnAdKIfy+h6 hDCG37WbB2EBZ3S5N2nAxiepm6+xVSGILkLIEZHOb3zSWWTVB1bpvbG9tDbDHcBNHTA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793285816; 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:References:MIME-Version: Content-Type:Content-Disposition:Content-Transfer-Encoding: In-Reply-To; bh=PiLUJIzj7M85elEEaNM0ojSu5Qbzbb6E3aVU0YwZNoU=; b=yolpPEXBHn2i5StwFR29d5tf3n1RqvnHu7A0QnRCZpfzhJei0eH625g59lrKwIQ+k1LP rlr2ULfV6zkZcKLNZCPlreLjoajztB1TUdQujOhTZSHbStUoHKIjqdG9irS8mId1wsgPw IX+NxpzGi7wQA9PzNZONPxUg2saUYS/eGEC+P8Amdn/803uBJKTyJfwM4G0NmXiZfd+hf 5PCSk5mIP4/TirZSyGSjS9Qb17yz5EZhmuGK8P495H04Q0C85/fuleepu7iGU9/PMbptC 8lViQHugydvdrrMRntGUXdnh2KLDP0xqt6ij+tPIv15wtpMF5Ieb875TlRQCFRteIxg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=VBBtzV54; arc=none smtp.remote-ip=209.85.221.48 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 24DFA606A321 for ; Thu, 29 Oct 2026 14:56:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 24DFA606A321 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, unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=VBBtzV54 Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-48dfdd0678dso1434778f8f.0 for ; Thu, 29 Oct 2026 07:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1793285814; x=1793890614; 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=PiLUJIzj7M85elEEaNM0ojSu5Qbzbb6E3aVU0YwZNoU=; b=VBBtzV543IUjp3L3nroXQrlC/QE6S+8gXo6jr4I0eHzp4Q3/fgQ96if7xtxcQ+VqLz s19qARniM3o+7h8g7xtxQPTJw/6p358LWMNXRgqkJIbnJXHxlMrWB7nJPDaF+NKET7mJ 0JgVER0btUhOoW8vZ34IN5qvDsQpFvfF6CMOLDdw4Cr5yB+LzHLeARk1o3ukGjmCmDUt kXFNpVftEBMuvndsJvgf76u6usMMe1SZa9+N1Z3DTuOK6veiNZBgg/utXmh9//asLtiU DoqQFHQyI8iPg6OBshBXAjQR+NUPAsqfXG2eCbmRTIiNmqjpPisFlRbuRJxjKj3j8X9p 322Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793285814; x=1793890614; 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=PiLUJIzj7M85elEEaNM0ojSu5Qbzbb6E3aVU0YwZNoU=; b=pWy025KYkOtm46fO7Ye86+oy8UPJgNNm+SQxyGwZwINVkaeFCQPRGGFQIdzeeg9OGq R6CuNN0Tw7yRw1yMOjbFuGHbElxnZRuv2oH55HmQd+Bin7H0Es/3fY0aJe1VefuqfJq6 YfOo5KIvXYgfLqPHvx/sDzg2ZOPH7ht3GsL1VDzmEz2eO4qa28JlEM/Kt4iu5i1nBXlI c50IWezTg83DUPVj6TtKMgKfwnKsh4zJVxzwrWvnP0PzeOEKe0ZJdBUR/0awSmVyLJ6q Wy3E7aAwNFWWPK2VIklx4BvbjNIhTp++L81BCD97s2l5n2TM8qvHPeGZCe0bx5SHrMib 7WVQ== X-Forwarded-Encrypted: i=1; AKwUvBxvOILolil0GrKxro/tuA8169lwIIJw0vHQFOxxzskXRdPLQGTdluVjagH0o9Yd48WdlrQIMH7izv4l26Uc@vger.kernel.org X-Gm-Message-State: AFq9FYI2SkibTrnkpfbBOEWjVcO7pWfzC/sjhe9odSMQJ3AZbcv0yJjJ G3xc1B3U49jeK+p/G/pi86E0vc5czoxjLuUyyIGdb4jsfO3VGrmp6TlVonCB0oYd080= X-Gm-Gg: AYBFou2J3rfyBnrayObJ/GMitIBJSLN/XeUGPOt3H10JFJwlTTe1moAbFQu2WxyTSNX Fo8fT3Iu5zxt1/WkJ5pyNYMcBEWEFTkRVDU8WPpWnpPF6g4CRmFntA754WbAAijlGpm4rYjE00v OdW+l6XUlW6tFCa0B2/aFVjZjhMNJIfiktECeP3vpgSfvJC9VNPzi2z4oOn4ZGkna7jTNuE++7s g6rz8TOvH7yvvzIpFc3nowt8eHeAnKltOu2qjev9AtT7HaQVw4n2qi+r2kzFr2aqbqy9ONbJ0nP KkbqaGTvDBYOas2VYTKVbh1x7NeBV9D+qlsZyz1GCzi2E+0LFyNFIUFDp2Ms9YEMSRVr+G8xmhA zdwSI1APvkGhH1363ixVtB7f1KDLFMSEAJn2Xfo/+L/P+2I/9V/tZ63cim7o5LVjQ3fkoVlU0hR IRuVtCQ6NPktCPnkGywkr9LAPEdl5HClaK1XdLZi0LSsKocLLr+K+dSXxamuUXdFTehnDhJeO3w Dr5IwtArKpBKii2Ibr1WEZ0Q7glTaja/paREAWKG125ADCPCxhQuxpC6jBjd+Z0PMkxii9XEWb4 7Ok01lS6SBF/FlhJMKfs2OZtV5YH2AnVgEs= X-Received: by 2002:a05:6000:290d:b0:48e:6a23:4a09 with SMTP id ffacd0b85a97d-48e6a234a62mr3002384f8f.54.1793285814407; Thu, 29 Oct 2026 07:56:54 -0700 (PDT) Received: from pathway (nat2.prg.suse.com. [195.250.132.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e3ebc39b3sm35816798f8f.10.2026.10.29.07.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2026 07:56:53 -0700 (PDT) Date: Thu, 29 Oct 2026 15:56:51 +0100 From: Petr Mladek To: David Laight 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 =?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> <20261027132253.5f3a461d@pumpkin> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20261027132253.5f3a461d@pumpkin> On Tue 2026-10-27 13:22:53, David Laight wrote: > 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 > > > > > > 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? > > 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. My understanding was that the format is stored in the metadata as is. I mean that the string is not formatted in this code path. So that the parameter values are or can be ignored. We just need to make the compiler happy. But I might miss something. Best Regards, Petr