From nobody Sun May 24 19:33:39 2026 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 DE00934402B for ; Sat, 23 May 2026 07:14:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520493; cv=none; b=Yiu4UkQUvn4v4ZmegzU7xs+2GNNyAGJMvdy2O9ERoXBz0EXAfpQMQU5Wer7Ao6j4kd+4yglAMX5jgaFoibUyFLMaj1zFL3ZflVL+z8qFSAKd+zOXsI9Lu3KxtvrTYEvj46PU1mxIHPwct2d9ui0JZVclrM8IgwwHV+HAaee2TmY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520493; c=relaxed/simple; bh=/BEze5uZvE97vkdxdEKscGQmmLTlvHt75B8/b2suPbI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GJdLOb1uEYhd6uYMJktmdZodv2UCMmBHCJod4zpnrFxFtQsukbMQQGT9VuMjXa/SQz0u4Mj0MyTxLp5W7xbtWdB3ndRNHry4PBE8RtwYisC8CdCJZYHDj1/fzkyAPsdI7kAdPQ0xsZ+lKs88Uq6k15p4axTWFA85cDgT2pTrgkE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=THlgXCAl; arc=none smtp.client-ip=209.85.221.52 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) header.d=gmail.com header.i=@gmail.com header.b="THlgXCAl" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-44b330c5cc6so6126363f8f.1 for ; Sat, 23 May 2026 00:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520490; x=1780125290; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=CwPLhLRZkxVDbJ+XZfxPTCPSMzzunTFiSNGj95FvoLA=; b=THlgXCAlOECqGp3gfU7FqF1cecNGxTcXzN7FUn0YrMtUOLz2qrrIGsHNvppD+WVXHc 9q681FnNNwGjw9a/9xvsI3SSKGGXuldmNE1OaNtBxy6gCONvZIIMMeSLpRemJcx9GsTi 1wSeTcaZ02jAjR38ImuCH6D/hOadqna2tmUidwb23TVmSiJLr+c59QD65yq1oC9m1nZJ 9zrHslTamzg67Sq/Js+sLUkUy613NZM7V8/aT8JNCI7Z7XxbmTRxvw5rgcHfBE6To0MQ t1ZxvdzT2WStcUowbvIvqSwfed0zkEV8pEPFGWA/UnzHg4moZk4OUoXFFYy6mMJ1ohzW IUMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520490; x=1780125290; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=CwPLhLRZkxVDbJ+XZfxPTCPSMzzunTFiSNGj95FvoLA=; b=ih2CO+rPrE4gkkhzaO1yQO3WxCfjNgSFa6FI308Cdd8Ykf1qKrqDcrFfNNM41g1hOo ggcCtNGPIkF76udJF5U1i6UEbOtXt0ACLCHfj7KAQTjGkKn6Aw+Lna3OwK5UoHQEVFAV 4eLhJbITltz+qrvQeFMcpnMGS0Xn8SageUEeSCXS8pLIPHgbU24Fd4ce32cU3LVwXBwv EUWKEkAOTNu5r0Z/VrppAWdu9Yw/+FRxK7jvz2oWCFT7dJOuNqNpvfBip4ZYt4mR7mFX gBBp7ubauKPqIH32CpVePriq6KMpKKPqak0suAILMlfrHf/9fd5tHeaZR658Zm0rjz1h kiHw== X-Forwarded-Encrypted: i=1; AFNElJ9vtCHA9Y6JcEwGVpJXL/aeZbtJ2x2MyYvVbWWGyA8tZraCwIcQhO1ELufEbOeXIYQonkbW7/bAWAy3jpo=@vger.kernel.org X-Gm-Message-State: AOJu0YyygfA4gbka4hoZ7Znq0R1K+7grYTqNtMIYPYYDFKjq0/L7Vv/l RtuiH/sG/8QKQLTGIqltxCZDQktq/yvOOl/OVl5lVH+qifXM2KvPs1Or X-Gm-Gg: Acq92OFvI9aQbZRRp+wiFpjTZavzwFrIonkp5ePxAkyQaLqGSSTzuYa3USdh1bBfOwm ovddxFqxdQmMHsJP1lOnIATHski1Mfdouph/nHSYRiUeNT3iYjmYEs3keMr+pX3Cqg/fy0UvEpS jeHV2R26kcDSCbAG/FPvbVBkl29yW8mKayI82J9ugWgachX/cbGzj2JF7ATpha/hhr9f/yKBBQL 2arKLp55FsQXO971qI7ddWiPMV6gdRQmcpG7cnkhSu/jXRw1ggVWBbtsv0JO03vF8aifWpF5rjt 3hsg9R3LXbnECuZtDWZV+y/mVZIEGX4dANzXSGo6r4sqa6ApyoIEP4a5klGSch/Zzey0eRk+MKf v1SIxwDmroPwXIPji346lkl37pFkRaZUP8+Holx6UnteLbAisHDYnovdkxeXVTtTQS4Hl46EzFU ZWebBW1b/+6WvpUMStjfjQ1Kpfbquu X-Received: by 2002:a05:6000:4283:b0:44d:261:54c5 with SMTP id ffacd0b85a97d-45eb38b7934mr10255969f8f.30.1779520490103; Sat, 23 May 2026 00:14:50 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:14:49 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:34 -0600 Subject: [PATCH v2 01/24] docs/dyndbg: update examples \012 to \n 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-1-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=2677; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=/BEze5uZvE97vkdxdEKscGQmmLTlvHt75B8/b2suPbI=; b=m4w5/JAevLLITYZXnWyLdNY/RNTDCpivVD8sWcmKmyXvw9E1IQYdDwsomaowr+2kpLJ+htivv h8ApCZJGep1AvCpisr3LF1/KMS84s8UihdsPJQdS4plwDlhoFbiHBfL X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= commit 47ea6f99d06e ("dyndbg: use ESCAPE_SPACE for cat control") changed the control-file to display format strings with "\n" rather than "\012". Update the docs to match the new reality. Reviewed-by: Louis Chauvet Tested-by: Louis Chauvet Signed-off-by: Jim Cromie --- Documentation/admin-guide/dynamic-debug-howto.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index 095a63892257..4b14d9fd0300 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -38,12 +38,12 @@ You can view the currently configured behaviour in the = *prdbg* catalog:: =20 :#> head -n7 /proc/dynamic_debug/control # filename:lineno [module]function flags format - init/main.c:1179 [main]initcall_blacklist =3D_ "blacklisting initcall %s= \012 - init/main.c:1218 [main]initcall_blacklisted =3D_ "initcall %s blackliste= d\012" - init/main.c:1424 [main]run_init_process =3D_ " with arguments:\012" - init/main.c:1426 [main]run_init_process =3D_ " %s\012" - init/main.c:1427 [main]run_init_process =3D_ " with environment:\012" - init/main.c:1429 [main]run_init_process =3D_ " %s\012" + init/main.c:1179 [main]initcall_blacklist =3D_ "blacklisting initcall %s= \n" + init/main.c:1218 [main]initcall_blacklisted =3D_ "initcall %s blackliste= d\n" + init/main.c:1424 [main]run_init_process =3D_ " with arguments:\n" + init/main.c:1426 [main]run_init_process =3D_ " %s\n" + init/main.c:1427 [main]run_init_process =3D_ " with environment:\n" + init/main.c:1429 [main]run_init_process =3D_ " %s\n" =20 The 3rd space-delimited column shows the current flags, preceded by a ``=3D`` for easy use with grep/cut. ``=3Dp`` shows enabled callsites. @@ -59,10 +59,10 @@ query/commands to the control file. Example:: =20 :#> ddcmd '-p; module main func run* +p' :#> grep =3Dp /proc/dynamic_debug/control - init/main.c:1424 [main]run_init_process =3Dp " with arguments:\012" - init/main.c:1426 [main]run_init_process =3Dp " %s\012" - init/main.c:1427 [main]run_init_process =3Dp " with environment:\012" - init/main.c:1429 [main]run_init_process =3Dp " %s\012" + init/main.c:1424 [main]run_init_process =3Dp " with arguments:\n" + init/main.c:1426 [main]run_init_process =3Dp " %s\n" + init/main.c:1427 [main]run_init_process =3Dp " with environment:\n" + init/main.c:1429 [main]run_init_process =3Dp " %s\n" =20 Error messages go to console/syslog:: =20 --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 7812B345752 for ; Sat, 23 May 2026 07:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520496; cv=none; b=RMvqQz6GDZjdBDNwVKJZeaIU3Zqu+s2oAwIbHPrPfh/AOmWMs71ovBpjrWko/qW+hWPTZbO4tlGFcPRlr/GPZIsC7rGvhAq5hoUnt7RyQtZgh9dE0oy14d0Wfs+qEEt+A3l9PsvG0onr1I1aVvUFdhp/EjEIuwwWuSZWko6fWK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520496; c=relaxed/simple; bh=Ybb0kJKNd2BJDDcZYbhZbCACFsLVAC7m/M+jXCdbe+s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NJvbVSue3SQkp9oqLs4whPXVDxrqOf+7KBLaRTaWpofko6yzkIocwtQbYGAty6n0P10sIBw9d5wn+1HoHAfxOlMID7JDxznQd3MolYqdApFUpfVUvMpIn1C0eF8xvUIXgSrxqHSFTgWxX77r4AhNo7aSefmky7S+gdj8Gl3sTFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qY20ayf8; arc=none smtp.client-ip=209.85.128.49 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) header.d=gmail.com header.i=@gmail.com header.b="qY20ayf8" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-48984d29fe3so83300485e9.0 for ; Sat, 23 May 2026 00:14:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520493; x=1780125293; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=T5zD1QygmB8fWogN5M5u4F28IFz6bLgLGYRTXYqao/U=; b=qY20ayf8XTd1/FaYC9R0/8Eup7n61+/B1DOOeWoXOo8DSN3avAnR2HUgnpY+TQq31e myfV0xZWbwbc08aNSIWszbQrqb0+/VDzx7x4DPZym43WDVTT/AYPxQwya68S+jl1Px0P BHq0t8KrfZLx/QtAHg/Zn64SNT/KF2puRIzSa5EIEziHZCErQA/m/HMUz/JHRx/MD+a4 g1koDtszSupJGveiZbRYUUX/CPfWHRu6PMlaGa4v6RC12dNDMXdL4y4bYq1QGOCWEFUt 17LQTBE6RZrD0xr/T4U3zNnZ6UO1dT84eswvsgaJ+TCEbS9Bux2YufupNgG4rQQWfzOl vYIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520493; x=1780125293; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=T5zD1QygmB8fWogN5M5u4F28IFz6bLgLGYRTXYqao/U=; b=rkSXKq1WAq3/JuPcbLXqZn1f03nKnkr1mHWYxC0v8TcuaAypX2dN0qpbThg9gT0VyW bb80phEck+2qGNu85XKI5pAn64N2c1R6Bwk30sp7pCWU9Bxz95NpMTireTmOnKEHNv1D g/j+hwZrv9Yh87zTYF5kusZ/H0mZhlh1t+xJzkUR2kYSy4dr/3DlNZWfiET+osa5zT2s 9LZmQyFxGEi4YA1EYTgtIb0tX3KLirM0TSsfGVlSE31wz7VzDeEi6i/CHdtn5OXrayl1 P/MaNay5wVyzW8YW8LKR700pLKvMn9T3B+spUzcidRSJ9scRN9AvOCS6KvsRk4OG6ncE fUsg== X-Forwarded-Encrypted: i=1; AFNElJ9IYnvqDtbCeaBpmJiQ+97gfm+TW5PFX1vi2UCBFRRk5HWxxhy6gY9aotu6Ccl1aHzzrtX9eSU5d1Jo4x0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5yXIl2T9PFxbyT7fqEvxQqH19m3EXZ9HlAj+2IKhnn3CVjXOg jRJhIB3/Hv8lR6+dPD+2wgiSsMkrFj73lJY8FPKXU2HM3J5SjXToo/cK X-Gm-Gg: Acq92OGT7I8IuPubMNtz43HwEAiPxkmlvmz9JvUN1DcSdKsd/7ibjrCSMgI/IDNnFmL vCGmGy3IlduN2Ia1gQDEG5p1g6C3J5FfQPjMKG5va7y50HDY5krE8VOFucZ1NJ3zvA1cPYhotFO e9h3fGXxWNg6NHn9fqRanNPnGxjfWauQp7fnXr4d1t3UuLJYJkpNOoJ5UI04/wo33+FAvHKQ74j /93Inc5CK96M6wZONlrJXp8y4oeEJZX+EdVYo7woL96jDRtBvIs4nWQMH/6JxC2cPkdSDFa7B4b S6+b5yRWckmKA3687HoDOElffXoeHuKSNt+2PZY2FeEnuF6KoAKo7bKpGZ359UFNU7qRulx7J2H GQqFNE57NxvwZeoLfqXybsiBsgqR35EbBz8XeQJxOKy7oK+5004tpP8woJu+FS8KrXDsVlXnf2s 6Ww7lQUVhl1+o3W4RglRtyTR1jpif1eZ/qCffk8Z0= X-Received: by 2002:a05:600c:1393:b0:490:3890:605b with SMTP id 5b1f17b1804b1-490428e0bf3mr95702355e9.31.1779520492801; Sat, 23 May 2026 00:14:52 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.14.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:14:51 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:35 -0600 Subject: [PATCH v2 02/24] docs/dyndbg: explain flags parse 1st 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-2-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=1814; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=Ybb0kJKNd2BJDDcZYbhZbCACFsLVAC7m/M+jXCdbe+s=; b=LDyIcN1thUtutyJAzsuSaLyDVoxR6fToU6bjihGjPO/ev9h0D9jBnvwywJk9EE3SFg1w7W3In LY27uL7o3wYAABSy+dtsNqblN6gjr6Y+4iVRe4Jf8b6l7r5euO2kJXS X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= When writing queries to >control, flags are parsed 1st, since they are the only required field, and they require specific compositions. So if the flags draw an error (on those specifics), then keyword errors aren't reported. This can be mildly confusing/annoying, so explain it instead. cc: linux-doc@vger.kernel.org Reviewed-by: Louis Chauvet Signed-off-by: Jim Cromie --- Documentation/admin-guide/dynamic-debug-howto.rst | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index 4b14d9fd0300..9c2f096ed1d8 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -109,10 +109,19 @@ The match-spec's select *prdbgs* from the catalog, up= on which to apply the flags-spec, all constraints are ANDed together. An absent keyword is the same as keyword "*". =20 - -A match specification is a keyword, which selects the attribute of -the callsite to be compared, and a value to compare against. Possible -keywords are::: +Note that since the match-spec can be empty, the flags are checked 1st, +then the pairs of keyword and value. Flag errs will hide keyword errs:: + + bash-5.2# ddcmd mod bar +foo + dyndbg: read 13 bytes from userspace + dyndbg: query 0: "mod bar +foo" mod:* + dyndbg: unknown flag 'o' + dyndbg: flags parse failed + dyndbg: processed 1 queries, with 0 matches, 1 errs + +So a match-spec is a keyword, which selects the attribute of the +callsite to be compared, and a value to compare against. Possible +keywords are:: =20 match-spec ::=3D 'func' string | 'file' string | --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 08725344044 for ; Sat, 23 May 2026 07:14:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520501; cv=none; b=RtIKdQKeCN0e/Q2qudDWKmVf50I/eEx/QBNjsBL00VV73mJZUxhUZl8zZ6+C46q9uqGCClLAUGx2rcmKQleWjf4IUJZ8ew8/mwhwLpX5VHuICn6/qynVbrq6kLQThQN/HroGL/MzMasNfiYPDcGx+GrxvZQF7Xx8gUGfyp9OpVQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520501; c=relaxed/simple; bh=pg9cpl0bo1AtFElQETrwEKQ1mUnu0drU6Mzj79jx4XY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lg0hvMdbniafFhC19EuRKrNSPYZCM4avTy2Bz/dq7+B7I21hrJMBkR8lT5E+Zh/hF9FVyCB4HbIv2pRk/Bw6zu2fTrZPqBsGTDpinK68IOtFSc+T8gOWUcSO2YBLTfZt7lZ85G8p7/UZx9VQ7GAg49LJaQbwdY48ge9hGoBrtnk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LQ70nyeE; arc=none smtp.client-ip=209.85.221.44 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) header.d=gmail.com header.i=@gmail.com header.b="LQ70nyeE" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-44e1ebb3122so4996160f8f.2 for ; Sat, 23 May 2026 00:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520494; x=1780125294; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=AgjU2Qt2uFal6066puOiKcG/bH5c3F/sQ7Yrgz0f2yo=; b=LQ70nyeEQ9O9F82G1YgfUf9f5MUMyZpCheu50vPLj6PxAsCr8NVFw0g4yZBpyEUmtg qP7TwIjl+ayxSyCMUKKpX0BW/hIzXqjOI+bvYmcqRD+YwyTJwzVP9MJ2ZHT+sMqfaVgK wyxujpfFLlhnYeYAEkJftsEAiLUgmMJ9DH+n3+u0t8wBYf9cwzlxEkAMOihoLIOIfYtV Zy0m2o03SmS3ICfW0wcNfTOcKvG8b80A6Vs2Q9rhgSeT247bkHvvH6zBK6+HLQjf1ORr O960bbSjVmT5Oi4d/GeI29jZFJO8GbqBKli0rXFJzHfOEbfLUoKHPTXEEcr8WbclTb6Z MHlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520494; x=1780125294; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=AgjU2Qt2uFal6066puOiKcG/bH5c3F/sQ7Yrgz0f2yo=; b=HWn1yNwbhk3Zw+DhqT4kAqdVPnSr4frj+CSu04F9Kb+sTawSocgd8NuGo/AY5/CFKU rxUb+yBstLuxytBKhkmMFcPah8VVspoKoYI9Sc/0+C9LrsRe2vyCvy/w8ypI+ES+reUh kSHYTHCZ23jzvhvLKbLaRi4GwEijA2gd7fp5ZjWDPSGKqiJrq559gsbMeTyIUqf61oeB W6xEKBlXrIuBZAGpHWnOZ5Oqqmq2zL7EsVpeD2qXWtw8aVFlqthfdu+EKhey6hPOAUQG ALY6uZv2O0nfQxZ3DIPcJdv3jgdupSRyYnNY+pigzVyjg5QWUpwqMhLgv5K7Kez05zC3 rn1g== X-Forwarded-Encrypted: i=1; AFNElJ8mQbRpWjL/C48oVEQl1BFe6yYev29/nOpM7gyLivNyGksthbOoG8ccRqYNX9hBqHUzkeQf0WyjbTZBE1E=@vger.kernel.org X-Gm-Message-State: AOJu0YxEiFVP1+Dfb7KFvCS+yZv9/bDEiYrdNchwJPCsHKYWsFxdMuAY 7KCYxIMomx3Zn3xv1urPGCADk+fTWlElMCR20ssBUr5wtDu9sulm+4DF X-Gm-Gg: Acq92OEDlkFtjRIXQxuX1ASndWVU0twyZaa1aR4H7D0VfOLzHuqC/qqL7cu+Nq8XnqZ 7rgdAK83bgJ/K2WG6SEQ0DMPqRXLboE68RfTbLSTFcRVoec7u6Rl2FKy2LrMSOJvdn6W835h3lF 4JI4kiAOr4M9RDFADpnwC2oLMmM7PKiz2EI4NuOZaU7QswzSq/U8VWfkm7iu1bjtpqMxVTy+Sxt rY3MADzCWThd5K8Z6/UBOwhiMnT2tGX9vs05BzEvamZeJAhT14Q044RZpkYmvJlSQbDBWZADCxp a9VxgwIwaP/mOGjiClpAm21vQD8oewf0OQZ3jCnBvT1XaqD2W0J0NeyUZFZsCxAiXtrY09DMf6K K4QRzM5I3iLAgp0rbpNTyzU4volMw+K6HMhLN4rq0MlmAs0K9w7VElqmOhdR4EGSut++EIU581m 9MXJ2tFMiI6siwM3zrfSunFvJzSJ4b427CzB5f9CI= X-Received: by 2002:a05:6000:1acb:b0:45d:b14b:2409 with SMTP id ffacd0b85a97d-45eb38a798dmr11656676f8f.2.1779520494334; Sat, 23 May 2026 00:14:54 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:14:53 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:36 -0600 Subject: [PATCH v2 03/24] vmlinux.lds.h: refactor BOUNDED_SECTION_* macros into bounded_sections.lds.h 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-3-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=4249; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=pg9cpl0bo1AtFElQETrwEKQ1mUnu0drU6Mzj79jx4XY=; b=WH0AntNe0OhurMiZGrWISX5Fi7F6HIZcFImYCZSWocR9Qe6r0AlL6iFIRm3OL+X7tRT5goYjE MWDUptwuglbBoUvOh8OP12aNyTgi93qwFSo+z6wgggVg7aRGBQ5Wo4b X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= Move BOUNDED_SECTION_* macros to a new helper file: include/asm-generic/bounded_sections.lds.h and include it back into vmlinux.lds.h. This allows its reuse later to fix a failure to keep dyndbg sections in some circumstances. NOTES: These macros are only for use in vmlinux.lds.h, where the _start & _end symbols are needed. Modules keep sections separate in ELF sections, with their boundaries known, so the _start and _end are not useful, and may confuse tools not expecting them. This patch ignores a checkpatch warning, because new file is covered by "GENERIC INCLUDE/ASM HEADER FILES" in MAINTAINERS CC: Arnd Bergmann CC: linux-arch@vger.kernel.org Signed-off-by: Jim Cromie --- v3: move include to top --- include/asm-generic/bounded_sections.lds.h | 36 ++++++++++++++++++++++++++= ++++ include/asm-generic/vmlinux.lds.h | 31 +------------------------ 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/include/asm-generic/bounded_sections.lds.h b/include/asm-gener= ic/bounded_sections.lds.h new file mode 100644 index 000000000000..8c29293ca7fb --- /dev/null +++ b/include/asm-generic/bounded_sections.lds.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef _ASM_GENERIC_BOUNDED_SECTIONS_H +#define _ASM_GENERIC_BOUNDED_SECTIONS_H + +#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) \ + _BEGIN_##_label_ =3D .; \ + KEEP(*(_sec_)) \ + _END_##_label_ =3D .; + +#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) \ + _label_##_BEGIN_ =3D .; \ + KEEP(*(_sec_)) \ + _label_##_END_ =3D .; + +#define BOUNDED_SECTION_BY(_sec_, _label_) \ + BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) + +#define BOUNDED_SECTION(_sec) BOUNDED_SECTION_BY(_sec, _sec) + +#define HEADERED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \ + _HDR_##_label_ =3D .; \ + KEEP(*(.gnu.linkonce.##_sec_)) \ + BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) + +#define HEADERED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_)= \ + _label_##_HDR_ =3D .; \ + KEEP(*(.gnu.linkonce.##_sec_)) \ + BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) + +#define HEADERED_SECTION_BY(_sec_, _label_) \ + HEADERED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) + +#define HEADERED_SECTION(_sec) HEADERED_SECTION_BY(_sec, _sec) + +#endif /* _ASM_GENERIC_BOUNDED_SECTIONS_H */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index 60c8c22fd3e4..9c61dd083f26 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -50,6 +50,7 @@ * [__nosave_begin, __nosave_end] for the nosave data */ =20 +#include #include =20 #ifndef LOAD_OFFSET @@ -211,36 +212,6 @@ # endif #endif =20 -#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) \ - _BEGIN_##_label_ =3D .; \ - KEEP(*(_sec_)) \ - _END_##_label_ =3D .; - -#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) \ - _label_##_BEGIN_ =3D .; \ - KEEP(*(_sec_)) \ - _label_##_END_ =3D .; - -#define BOUNDED_SECTION_BY(_sec_, _label_) \ - BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) - -#define BOUNDED_SECTION(_sec) BOUNDED_SECTION_BY(_sec, _sec) - -#define HEADERED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \ - _HDR_##_label_ =3D .; \ - KEEP(*(.gnu.linkonce.##_sec_)) \ - BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) - -#define HEADERED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_)= \ - _label_##_HDR_ =3D .; \ - KEEP(*(.gnu.linkonce.##_sec_)) \ - BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) - -#define HEADERED_SECTION_BY(_sec_, _label_) \ - HEADERED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) - -#define HEADERED_SECTION(_sec) HEADERED_SECTION_BY(_sec, _sec) - #ifdef CONFIG_TRACE_BRANCH_PROFILING #define LIKELY_PROFILE() \ BOUNDED_SECTION_BY(_ftrace_annotated_branch, _annotated_branch_profile) --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 B5C96345CDD for ; Sat, 23 May 2026 07:14:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520503; cv=none; b=mrdwMXicj+JRAkhLEDTPaif5ZxPIvpi/4hV2tjpCMUlju2w3iXZCqkwoYjspv0fpTe5GUWj6HAL+uM9Z5Zah1ByQR9N15iDXLELAToLu7KiMqfnZcmr1kYsNXXHYylmVjN/1jBnRDZXRn3+Rds6SJbotuzveqMyAHm2Pom0e+t8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520503; c=relaxed/simple; bh=gyhl2dDHOhDRfo2EoLm//e3PBy86xHd/L/qSVe14+FQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UfhIZONuH8rp6kUSm/xiWaaojlRIA5zD+kXjNpCbewg1nsbdz+7P4H2BicdwvpCE0Zdpxgt0Dprsdw0PS15YaiuVL6nkq12R4u7suoyEkD/7qKVp0MtuSeU9HS9DcIuX3COb1Yp2jU6Fz1Y7foLT59ZsW0nqmonFV3r/dYfOKQY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H1n9gbVQ; arc=none smtp.client-ip=209.85.128.49 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) header.d=gmail.com header.i=@gmail.com header.b="H1n9gbVQ" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-48a7fe4f40bso93090435e9.0 for ; Sat, 23 May 2026 00:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520496; x=1780125296; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=GsoCp+QEhPQqcC7YciJ1pPB6BZ3pQYi3CKXlL70tQeM=; b=H1n9gbVQ+PcR7fWPkOtzIrEwQ1rCF7DjxFYd5P0XECMz2WMW9N4Au5Ov859TzBQlK7 IpZ/Ove0C++0990zu0S2fTNAZHVx5hTyIijZc17oaRTGseT7DBVerY6D99v4jICXpr6+ pE5b6YmizttpJmiaua3GJngkEBJFzLIK3rBhnOeYumTUSk/6n5BNSkLlWmavh/i3H2KV jljF9YvKVU4QxDGenryZpD/GNzC0es012x3J2+wbjrI+ECAwqMkHlF8iiSDT92ROJeAL x4Vx+ANvPj9kxbEvrPg2XELJJc9DbXjxZ6Ij4ChcYAOXkrsqkQL+bDZJ20lUARu/JPE4 C7bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520496; x=1780125296; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=GsoCp+QEhPQqcC7YciJ1pPB6BZ3pQYi3CKXlL70tQeM=; b=KPruPWi5D4cvq6cbL9oByivSLdMbzdzKa8+cyKbWt7nL3IKdMOdagbZXI1YKGXlBIo Sg6L8mNFp3lCptM0rFiUdZe5Y5tlR3LUgugpez6PcNgoTngci840EBIgm7LEJnIGwwYr hszXlICv6xHIMhjcqkG54uY4BUzddHSF0VW2qQ0WP9R3gcHVGOISP6WKZzIfILbSKVRt Kq+hcTYTMexa37e1mSueRh0CLB488ea3RQ/1IJNoJ+uVnAius4M8MLx9GsFDskfwp6zS iszhnRlswgyMszmOw+m1rve+jxgGRROmyGF3x0OHigAZOq0K9VznaqP4y79EZftcr0FM YY0g== X-Forwarded-Encrypted: i=1; AFNElJ9uQaj9AVkhaC/4IFuTtBf/Tyge/uFDJjQDlMtXXa5/1dZy+r+8parq11VxnutvIdyjpGC8Vx8W10R8o20=@vger.kernel.org X-Gm-Message-State: AOJu0YzVpZdHTS/2EtbSEG/DK0bgCyu30cSK/b2/d+XNaKzgEh/+f4VN ui7Qdg6GHuaHIJPm7qPzNc41rWfjojWGKKEQMEFX0EGcRYFmlhUBpyT4 X-Gm-Gg: Acq92OFbeQz9YPPjbVwV+dHKwxOwhnj1lEzyR0ryKAQcsgzWVG58U6P+iwY64xQwdSt RFPyGSSxeMeA9FXIvbTG4Yxgxe5B7n2XUoPfa0ILdpiYvuxGEnckFuPgrjsoBX1ey0q7amXGdMp YQ1IGHoAQL6CYQRyDQhKNQxg/pLzKjrV0XgYCK4Z71fDMyW/XtS/fLr/qFZpaqlI2aoJ8ZLu1GE 8lx7bPT8JUF3VkJvAxNPrwvV96GOOi4xMy3fth7Pkx8LlKphx4p9UBh1ZBAmKZQliFKAVUNmScj VR90Mk1BeW6EndmDYbxurRIlzueAC9hV1MdHa0rnN2U5MZcWM7//dgsdK46DQsATvxKjBvQZQS2 WL2/NRq29Yk4UUEJ6tKYlLD/XnTokyVzzioKJxUPrSKsDXAOJjUJMyg/aCgEME4+dkrGf62so/0 rLQuNG0WENNqF3odvYfbrkh4edmvSToaIpJ/ZwD2A= X-Received: by 2002:a05:600c:34d5:b0:490:52c0:744c with SMTP id 5b1f17b1804b1-49052c07701mr17075745e9.20.1779520496290; Sat, 23 May 2026 00:14:56 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:14:55 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:37 -0600 Subject: [PATCH v2 04/24] vmlinux.lds.h: drop unused HEADERED_SECTION* macros 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-4-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=1428; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=gyhl2dDHOhDRfo2EoLm//e3PBy86xHd/L/qSVe14+FQ=; b=wXPve83EQqKwVYpNzugGXIZFVwTl7ZjlKozjC+ofq5HGuSZxa2pPjv2RM993nzrcpf2HgOQXe tD3CZakg70vDthyomfMbN9iNNuTYkFwz6pne0FZR6D1P0oeAnYeN0pf X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= These macros are unused, no point in carrying them any more. NB: these macros were just moved to bounded_sections.lds.h, from vmlinux.lds.h, which is the known entity, and therefore more meaningful in the 1-line summary, so thats what I used as the topic. Signed-off-by: Jim Cromie --- include/asm-generic/bounded_sections.lds.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/include/asm-generic/bounded_sections.lds.h b/include/asm-gener= ic/bounded_sections.lds.h index 8c29293ca7fb..268cdc34389b 100644 --- a/include/asm-generic/bounded_sections.lds.h +++ b/include/asm-generic/bounded_sections.lds.h @@ -18,19 +18,4 @@ =20 #define BOUNDED_SECTION(_sec) BOUNDED_SECTION_BY(_sec, _sec) =20 -#define HEADERED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \ - _HDR_##_label_ =3D .; \ - KEEP(*(.gnu.linkonce.##_sec_)) \ - BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) - -#define HEADERED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_)= \ - _label_##_HDR_ =3D .; \ - KEEP(*(.gnu.linkonce.##_sec_)) \ - BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) - -#define HEADERED_SECTION_BY(_sec_, _label_) \ - HEADERED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) - -#define HEADERED_SECTION(_sec) HEADERED_SECTION_BY(_sec, _sec) - #endif /* _ASM_GENERIC_BOUNDED_SECTIONS_H */ --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 55C5E343208 for ; Sat, 23 May 2026 07:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520503; cv=none; b=gwj7VS37togM4B4TyIqKpB0UwCOo6ZE7oweomP4GZ6CBN4b0imjQTkUeTPDtRE8pyIgxvvjysgxcyU74wKUmr2UO6RI7KEo55LLmTl2n0HdO3bu61w25g9WFiDifZiixRzyckmy/8BNC2s8fCehLW8LyHGb4cAuVDGq4iHDuzrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520503; c=relaxed/simple; bh=+PxUnhBt80sstYpQetbEqjhIty9CFiNlWXfpNo966yQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HvWdhL+u2EyJoEhVJCPrjuyxi2f9CfJay4XNO+mxu5JqaJAQQtTunMZzD62dr+H1GoRLnlK5Pj+VMjNVwmZoiCnRPydN9kHyWijX3qhVI/gD69oW6pwpLps0P3pqudj0pzuYidHXHWAqvndUCsdrAkNkMFqjCRilC7stpUhA+/M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZSFyqAEF; arc=none smtp.client-ip=209.85.221.46 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) header.d=gmail.com header.i=@gmail.com header.b="ZSFyqAEF" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-45d96d21e82so4539964f8f.0 for ; Sat, 23 May 2026 00:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520499; x=1780125299; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=mwLoso54ujA9DNLWzx95js6fjvDLg/xvtPDuNrBoMCc=; b=ZSFyqAEFCVUzDLOIdbU9IS0XcB69KphXFvtZrbq8UpiB6SJcwbTM7Pb/yWXWUR38b4 XX/b22JCJouz26gz4LbfemjtWwQg95Xmoi0fcppwO6fpDF4fBvjkh4asUQxwm6ZycIxm ruyF3znHEmaiVQ8SnCtSr0CvZFn3VZGDFCgnw4aKYhgmm/biqb2xXRfUqTsRUk/W+EGt Fax5gc6Hlsba+QMEj9tV1zo3xQBu8oKl/W6Ec7AmuivqKHXly69el/cqgr+XpMRd4BP8 RNNOpqeM0lv2btbYe2olZ8bzxS6gw/qlN2b0/v0Fpjh6+22Vp6050LXDEekI+WW2bbqP JuJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520499; x=1780125299; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=mwLoso54ujA9DNLWzx95js6fjvDLg/xvtPDuNrBoMCc=; b=EkJ3jHjNJun4ZK3qddiGYIYoyZmcYmmjMKUDPwKDohacgMaiCpa9j/vBeNo2AhX7ej 08dvnS1MPpbzaz455vOusSq5gf1T07EZd5WghG2Pjran/br3IjSygxjvz6/DNDhXS70T H6TzaMxRIEYpOcDbsi/0xTs0kC200ALidoA+/nnOP6RURqvAxDVitKlS/Uo3YlkdQR9m On4g1ku5ryKdMMwtk6sPdU9GDomtGc+2W5HbG84SM35gmF+R3LV2tI4PydDWjQu2SUto 2fnWVWpbZDrlbxgVn8xkQkLYlEBk6qPJKIKt2psBulpWa+Vo7OuDI04yk/Fw9SbNM+Sj RD6A== X-Forwarded-Encrypted: i=1; AFNElJ/UmPGW9rCMxLEOq3rLBzTUFPpKBx6RfL3aDvzfo47JoLj7Bc5vqpnZ8i+O8FCFtOrW/CJ55xahLrCY7yk=@vger.kernel.org X-Gm-Message-State: AOJu0YwiDjISAwosFLxmGY84Ovk5yfmah7mAcSOOqyxBs5EqCCOUPg7j srp7QlpiKtKchnLTAJFjfPL5WswlNDoGyZb8OLYWnFyqlP3AiffhivLA X-Gm-Gg: Acq92OHviYzNi3r+XXF7Ps1Z1eTBvUxKzznptEXV6Z+9PHvW8TPJgpBC4CyCW5q4y1U FGvTGSG9r5Uus+s5Xtco+X59Et7IwhBp67QT2EGuK89RJ0pjVozSGhGLelVmD6snc8x0kwo8L/h 8znxWNWD7Ad5N16DMvlMEUg3PoVFWn77rcVJu5ts0SCooTdq70V27nnrjY/BQs2aQ+BFU2ZP3eD AeTc4jXIjv04W7Qd5NKWdSwosP2Hs89fadB00xH0iSwOzn++SUVseVemOrLT9k9YpsjfGSuFWBv tSpShi+ZsKwjmIudvraBR1myKAPTmsIqn86RgdkuE7fVlKrTYeABtGIHs0DOspMHa3ZOhaGi1+E MF+TzLRxFrYv/u+zL8GkE1FizB2VcOM4jcMGaM6EBIE4yAlLkv09HPU0YnGZpTKNenq8id0Kq6d SwoMgVkv/i6ZYsM8dwFsNeYulRx4Hv X-Received: by 2002:a05:6000:41c9:b0:45d:4a00:b927 with SMTP id ffacd0b85a97d-45eb38a1840mr10734403f8f.31.1779520498673; Sat, 23 May 2026 00:14:58 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:14:58 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:38 -0600 Subject: [PATCH v2 05/24] vmlinux.lds.h: Fix ALIGN(8) omission causing NULL ptr on i386 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-5-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=5646; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=+PxUnhBt80sstYpQetbEqjhIty9CFiNlWXfpNo966yQ=; b=LC+g3SA21No6OnlSoBIeD8nbOvdfbK53Yfv1CyUMhk171BK4tL0+Ei5yTuw4ygNutkSE3nxf1 hnW3IqZv/xOA4i5ezOYhthXck6luafM78K/AYe49plfHWFl63MzFvLo X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= Almost all uses of the BOUNDED_SECTION macros are ALIGN(8), either explicitly, or by being below an aligned section containing x*8 byte objects. The noteworthy exception is BOUNDED_SECTION(__dyndbg), which immediately follows BOUNDED_SECTION(__dyndbg_classes). On i386, struct _ddebug_classmap is 28 bytes, so without an explicit ALIGN(8) in the macro, the following __dyndbg section gets misaligned, causing a NULL ptr deref in dynamic_debug_init(). So fix this with an explicit ALIGN(8) in the existing BOUNDED_SECTION macros, and introduce _ALIGNED variants to handle the cases with an explicit . =3D ALIGN(x) Also add explicit alignments for: EXCEPTION_TABLE, ORC_UNWIND_TABLE, TRACEDATA, and INIT_SETUP. update BOUNDED_SECTION uses inside . =3D ALIGN(x) stanzas to use _ALIGNED variants, but keep the outer ALIGNs so the symbols between them are not "re-aligned". In particular, scripts/sorttable.c does not tolerate sloppy padding. At the top of ORC_UNWIND_TABLE, add . =3D ALIGN(4) to match the struct orc_header __align() call in the code: commit b9f174c811e3 ("x86/unwind/orc: Add ELF section with ORC version iden= tifier") Suggested-by: Louis Chauvet # _ALIGNED variant= s. Link: https://lore.kernel.org/lkml/177402491426.6181.12855763650074831089.b= 4-review@b4/ Signed-off-by: Jim Cromie --- v3: sashiko picked up 2 cases, added to the explicit list above https://sashiko.dev/#/patchset/20260515-asm-generic-1-v3-0-680b273666d4%40g= mail.com --- include/asm-generic/bounded_sections.lds.h | 17 ++++++++++++++--- include/asm-generic/vmlinux.lds.h | 15 ++++++++------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/include/asm-generic/bounded_sections.lds.h b/include/asm-gener= ic/bounded_sections.lds.h index 268cdc34389b..8ff3e3420f60 100644 --- a/include/asm-generic/bounded_sections.lds.h +++ b/include/asm-generic/bounded_sections.lds.h @@ -3,19 +3,30 @@ #ifndef _ASM_GENERIC_BOUNDED_SECTIONS_H #define _ASM_GENERIC_BOUNDED_SECTIONS_H =20 -#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) \ +#define BOUNDED_SECTION_PRE_LABEL_ALIGNED(_sec_, _label_, _BEGIN_, _END_, = _ALIGNED_) \ + . =3D ALIGN(_ALIGNED_); \ _BEGIN_##_label_ =3D .; \ KEEP(*(_sec_)) \ _END_##_label_ =3D .; =20 -#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) \ +#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) \ + BOUNDED_SECTION_PRE_LABEL_ALIGNED(_sec_, _label_, _BEGIN_, _END_, 8) + +#define BOUNDED_SECTION_POST_LABEL_ALIGNED(_sec_, _label_, _BEGIN_, _END_,= _ALIGNED_) \ + . =3D ALIGN(_ALIGNED_); \ _label_##_BEGIN_ =3D .; \ KEEP(*(_sec_)) \ _label_##_END_ =3D .; =20 +#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) \ + BOUNDED_SECTION_POST_LABEL_ALIGNED(_sec_, _label_, _BEGIN_, _END_, 8) + #define BOUNDED_SECTION_BY(_sec_, _label_) \ BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) =20 -#define BOUNDED_SECTION(_sec) BOUNDED_SECTION_BY(_sec, _sec) +#define BOUNDED_SECTION_BY_ALIGNED(_sec_, _label_, _ALIGNED_) \ + BOUNDED_SECTION_PRE_LABEL_ALIGNED(_sec_, _label_, __start, __stop, _ALIGN= ED_) + +#define BOUNDED_SECTION(_sec) BOUNDED_SECTION_BY(_sec, _sec) =20 #endif /* _ASM_GENERIC_BOUNDED_SECTIONS_H */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index 9c61dd083f26..477333bdf3d3 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -640,7 +640,7 @@ #define EXCEPTION_TABLE(align) \ . =3D ALIGN(align); \ __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(__ex_table, ___ex_table) \ + BOUNDED_SECTION_BY_ALIGNED(__ex_table, ___ex_table, align) \ } =20 /* @@ -650,7 +650,7 @@ #define BTF \ . =3D ALIGN(PAGE_SIZE); \ .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(.BTF, _BTF) \ + BOUNDED_SECTION_BY_ALIGNED(.BTF, _BTF, PAGE_SIZE) \ } \ . =3D ALIGN(PAGE_SIZE); \ .BTF_ids : AT(ADDR(.BTF_ids) - LOAD_OFFSET) { \ @@ -832,16 +832,17 @@ =20 #ifdef CONFIG_UNWINDER_ORC #define ORC_UNWIND_TABLE \ + . =3D ALIGN(4); \ .orc_header : AT(ADDR(.orc_header) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(.orc_header, _orc_header) \ + BOUNDED_SECTION_BY_ALIGNED(.orc_header, _orc_header, 4) \ } \ . =3D ALIGN(4); \ .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(.orc_unwind_ip, _orc_unwind_ip) \ + BOUNDED_SECTION_BY_ALIGNED(.orc_unwind_ip, _orc_unwind_ip, 4)\ } \ . =3D ALIGN(2); \ .orc_unwind : AT(ADDR(.orc_unwind) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(.orc_unwind, _orc_unwind) \ + BOUNDED_SECTION_BY_ALIGNED(.orc_unwind, _orc_unwind, 2) \ } \ text_size =3D _etext - _stext; \ . =3D ALIGN(4); \ @@ -869,7 +870,7 @@ #define TRACEDATA \ . =3D ALIGN(4); \ .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \ - BOUNDED_SECTION_POST_LABEL(.tracedata, __tracedata, _start, _end) \ + BOUNDED_SECTION_POST_LABEL_ALIGNED(.tracedata, __tracedata, _start, _end= , 4) \ } #else #define TRACEDATA @@ -904,7 +905,7 @@ =20 #define INIT_SETUP(initsetup_align) \ . =3D ALIGN(initsetup_align); \ - BOUNDED_SECTION_POST_LABEL(.init.setup, __setup, _start, _end) + BOUNDED_SECTION_POST_LABEL_ALIGNED(.init.setup, __setup, _start, _end, i= nitsetup_align) =20 #define INIT_CALLS_LEVEL(level) \ __initcall##level##_start =3D .; \ --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 AF06033F36D for ; Sat, 23 May 2026 07:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520503; cv=none; b=E8H4VWp1Jpm+IJ7DZCoSOOKSkvY8I9uoLLR+MgnbYCyW/mHUmsSxxn1u+aX/1GB5zHjUn2TB/tECuOLXxuhsosPOFAute6etQttkttkqQaVZeg9X/KeZyvb9oWCfGmHnq11dC2ajC+H2drbLFLsirwLMM2gbHvyCMVqEyh/leg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520503; c=relaxed/simple; bh=wCFqvr2/Nq+hwAEKum5xoeXfV9V823VfJhtwsvw3xV4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tkulyhFyV8dCKJ5Szut/78DGl1xoavdx+faAdKXdAyGY4hggxrZJTgaLDu/CW48GssKbjq8P9NFXlTcY5c1s5orFzdcm1MsviR4pz+ltZZ9dZsB5v+0NCSofBMFYO9aTQZxpecm7YIMGlFxLhjWbpOyuK6MyODr41zE1rIT5iW0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HqzdZt+3; arc=none smtp.client-ip=209.85.128.52 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) header.d=gmail.com header.i=@gmail.com header.b="HqzdZt+3" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4903974854dso22779195e9.3 for ; Sat, 23 May 2026 00:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520500; x=1780125300; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=9ydDUhhJnV3YW5dvq7T8CAXgzEOqK2B2L08PLbDSdkc=; b=HqzdZt+3bkOKnpK6hokiM9eMZPpM61ucNP3Q97+/eCFiWJlzPiAYtJw+jgQCpQGY3o XZ+G3MMeAUCTVLjd/NEKgNqPCz8D0LKN5f3JG9XMpALF2wc5VgcjKPluWy/Mu4+lssVp 4g7Hh4zK2Acx0gT3/fPb/26AigyZLrFEIpmSPec2y4VxYKRuX8CLc/gj4SHF8VL80GFF 7aw6nMR8qBLj5Cm/UV/g4nXFHi8n+gUg3V2SF7yQ3ePJr7JNMBTmuIxzxC6BPSCII6KJ AUIpA1GA1eZE1V9uj2UmhIa7EZv36wpZxEEghm0rRqWrC5qcRC72VRskNPr6oXDDO+7k MivA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520500; x=1780125300; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=9ydDUhhJnV3YW5dvq7T8CAXgzEOqK2B2L08PLbDSdkc=; b=c1ja6oWA0kJ41NPwh6t9eIVIdU5GtGIoPqt6dZ299fkmf0sCozJHOy3TUMBiHL6ytB enWQ5ibYPn1C0Y1dt4a2a6azxU0ZdL9un7ahCrSGlFD0yXIstXaQAd8mzmE0Itfzq3UJ 8NKSpMABQLP6bS/Uz56h3UYD9xSzN+XEASao/TjmGXszXnvrlimSjIfnlLoB49YqLPtE 6BJlhmrCmFPOGEk2kAQdl5oBpRxk+HHRfzcZpWfeVSe58lz4Qwk1ZE9R7JaC2oXMm78o Eo5Ks0OG73isAJeJepu50o7jDvtlHMYDNx9jQ2J6ihOGv4Be9dVE3MCFzQ4c+itzmwjk jLkA== X-Forwarded-Encrypted: i=1; AFNElJ9Xli9G0Ln1S3hy5i9Kq/zn9+Mruvv9Wf1onJ/hwIxIOh2HAHqOqVNfBdKc06ZgAKp3wFzuiYZikxRXF/s=@vger.kernel.org X-Gm-Message-State: AOJu0YxKuY+K2Aaizf6yfHNnsyFB7ciH3bDOdbQCKWQgYkNTPfog4njU Bh7hBiFfaGXgRLIc75X+2jfGtC5/VkC7J1naWqQXGpfiEUB/QrozVzgW X-Gm-Gg: Acq92OGghkus/4gChbQytLYc3Bl+QyNSdF1SwnWMKxYPxBzW3souQhqndJ3SD1zxAvY T1V8Ue0fMI1K1TetKxpKNax/lDXky99SZQZPKjCUqKYmo9g5D0Zl64j49LOQRykS0YGavjenaMv rBELuTzbQlaNSNEE5Dj12G4GlqYXCVrBsDdf368sjr0kcMeA58Pntnra2Ss/rfiNjM9hP64wKra mbt2l9aFkiG2it/vpL6dHi1Ir8nU24vs8Whaxq7Kyx1jkCrcCJR+FeIHZLbacUV9lHkt4iJCuAN J9sSezSJxp+wrqSjEQV6aAc7DM8Z7ep0dcyj4DTkoWXymmuF8VoIRfacbdY7r7m522+/W4TZMlS AODLYRZd519ejQ5c+l+3LxwpRtfQFpPDu+fjBH21cd0le3H/NsMcAcs4Ci06/naI1HhO3xr7LnV 3JQY9zHlN+esdgWevewf1+lyO9JeDP X-Received: by 2002:a05:600c:b99:b0:490:4ebc:b80a with SMTP id 5b1f17b1804b1-4904ebcbac7mr44759465e9.11.1779520500131; Sat, 23 May 2026 00:15:00 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:14:59 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:39 -0600 Subject: [PATCH v2 06/24] vmlinux.lds.h: remove redundant ALIGN(8) directives 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-6-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=3579; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=wCFqvr2/Nq+hwAEKum5xoeXfV9V823VfJhtwsvw3xV4=; b=zoGZ5xFmx1pK9ySsKJrw3WCln9FRKHKrPIqcDQnSodIO8PiOl6oJ5J2QJqSz0trflcvmyv+1t EJUu/0EO0/hDtdNs2sQ254GFznaUfHgsbMfwGhMSB279GGneidCWrnm X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= The BOUNDED_SECTION_PRE_LABEL and BOUNDED_SECTION_POST_LABEL macros were recently updated to inherently enforce an 8-byte alignment. This makes the explicit '. =3D ALIGN(8);' statements preceding 'naked' macro calls in vmlinux.lds.h redundant. Remove these redundant alignment directives to clean up the file and clarify that the macros handle their own alignment padding. Signed-off-by: Jim Cromie --- include/asm-generic/vmlinux.lds.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index 477333bdf3d3..0e4677b71d16 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -228,7 +228,6 @@ =20 #ifdef CONFIG_KPROBES #define KPROBE_BLACKLIST() \ - . =3D ALIGN(8); \ BOUNDED_SECTION(_kprobe_blacklist) #else #define KPROBE_BLACKLIST() @@ -244,7 +243,6 @@ =20 #ifdef CONFIG_EVENT_TRACING #define FTRACE_EVENTS() \ - . =3D ALIGN(8); \ BOUNDED_SECTION(_ftrace_events) \ BOUNDED_SECTION_BY(_ftrace_eval_map, _ftrace_eval_maps) #else @@ -261,7 +259,6 @@ =20 #ifdef CONFIG_FTRACE_SYSCALLS #define TRACE_SYSCALLS() \ - . =3D ALIGN(8); \ BOUNDED_SECTION_BY(__syscalls_metadata, _syscalls_metadata) #else #define TRACE_SYSCALLS() @@ -276,7 +273,6 @@ =20 #ifdef CONFIG_SERIAL_EARLYCON #define EARLYCON_TABLE() \ - . =3D ALIGN(8); \ BOUNDED_SECTION_POST_LABEL(__earlycon_table, __earlycon_table, , _end) #else #define EARLYCON_TABLE() @@ -284,11 +280,9 @@ =20 #ifdef CONFIG_SECURITY #define LSM_TABLE() \ - . =3D ALIGN(8); \ BOUNDED_SECTION_PRE_LABEL(.lsm_info.init, _lsm_info, __start, __end) =20 #define EARLY_LSM_TABLE() \ - . =3D ALIGN(8); \ BOUNDED_SECTION_PRE_LABEL(.early_lsm_info.init, _early_lsm_info, __start,= __end) #else #define LSM_TABLE() @@ -314,7 +308,6 @@ =20 #ifdef CONFIG_ACPI #define ACPI_PROBE_TABLE(name) \ - . =3D ALIGN(8); \ BOUNDED_SECTION_POST_LABEL(__##name##_acpi_probe_table, \ __##name##_acpi_probe_table,, _end) #else @@ -323,7 +316,6 @@ =20 #ifdef CONFIG_THERMAL #define THERMAL_TABLE(name) \ - . =3D ALIGN(8); \ BOUNDED_SECTION_POST_LABEL(__##name##_thermal_table, \ __##name##_thermal_table,, _end) #else @@ -403,12 +395,10 @@ __end_init_stack =3D .; =20 #define JUMP_TABLE_DATA \ - . =3D ALIGN(8); \ BOUNDED_SECTION_BY(__jump_table, ___jump_table) =20 #ifdef CONFIG_HAVE_STATIC_CALL_INLINE #define STATIC_CALL_DATA \ - . =3D ALIGN(8); \ BOUNDED_SECTION_BY(.static_call_sites, _static_call_sites) \ BOUNDED_SECTION_BY(.static_call_tramp_key, _static_call_tramp_key) #else @@ -453,7 +443,6 @@ *(.rodata) *(.rodata.*) *(.data.rel.ro*) \ SCHED_DATA \ RO_AFTER_INIT_DATA /* Read only after init */ \ - . =3D ALIGN(8); \ BOUNDED_SECTION_BY(__tracepoints_ptrs, ___tracepoints_ptrs) \ *(__tracepoints_strings)/* Tracepoints: strings */ \ } \ @@ -946,12 +935,10 @@ =20 /* Alignment must be consistent with (kunit_suite *) in include/kunit/test= .h */ #define KUNIT_TABLE() \ - . =3D ALIGN(8); \ BOUNDED_SECTION_POST_LABEL(.kunit_test_suites, __kunit_suites, _start, _= end) =20 /* Alignment must be consistent with (kunit_suite *) in include/kunit/test= .h */ #define KUNIT_INIT_TABLE() \ - . =3D ALIGN(8); \ BOUNDED_SECTION_POST_LABEL(.kunit_init_test_suites, \ __kunit_init_suites, _start, _end) =20 --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.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 2E3273451C6 for ; Sat, 23 May 2026 07:15:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520513; cv=none; b=S5oRlkHXrIozlC2bW1Oipyr2uJHnb7eGSlIF9Yv+R9GxAQKcqtFsI2OtJ43DngWz1iDS7a8Gqh9sjT1BJeVPtKKSOUoC/xaCUff2Yn1P4MJTA5znRMb4d78IeW/InPNd94CAs1xlBb5vXyhjV92rKDuDjioBjrqzjAX7k2WLofk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520513; c=relaxed/simple; bh=hHbUbuvMq67kK92AX9bALnGMbnsaNAMLaVZBi9x7aP8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UGx+xQqLgjlXMIVwNYFdWNA6X/fBYwkrLOjFEUnGW/grUbRl3zkX7iBTwm2aCWKq2Do+xsKmg4uqACT+dhMBa6ax/YWs1lUt7yuKuYpKpLJxfR39FcQYf0DCKWriBlcMt/xemh8bXZ2/RKjBR8RcGiqocdCBJPIR76JtfJhbj0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Kp/FpIu+; arc=none smtp.client-ip=209.85.128.47 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) header.d=gmail.com header.i=@gmail.com header.b="Kp/FpIu+" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-49050ff7cbdso3194735e9.2 for ; Sat, 23 May 2026 00:15:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520502; x=1780125302; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IqFCuVgcu75FRpSrJUke7IG04IUYAp0EBZ0uoXXXPv4=; b=Kp/FpIu+JAHdDvxgWdnucmak6TkclLWGfWO/H16/85ZowDKcN2fTKmZClTk1/r7dJW RUeRHT+S1vXJWleeHj/lq9D1Lx1oeuGzkbhYLx5e7csyo6IpUGitglrXc78b6UWwqsbL Qt0HbKJtrOt/13xLp0G9pkDtBdPTugo5UmaxEdQuf7jEd4sGXj7tZGQ3zRx66LaCTEdh pFYev8te/Ed690UNbWT1e/Gcav8DK5d0Voyut1DMW+J7AmRZOOLb3Id9CbvAtpcdq9wn +voUEvkDOZGcI1vt9AF+jbfxJzvxRgU8AdH2Hto3lH6uw6cbNFfmvgOm8lU87dOLXpso JSwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520502; x=1780125302; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=IqFCuVgcu75FRpSrJUke7IG04IUYAp0EBZ0uoXXXPv4=; b=YKk5Sf1+9FnyeFmz6VHxg8jTg8kNAr8/cgWSyfCSHhC1xQq//VdrwLvs67VR5mbJTB ZCnjdm80jfwUTWpGfVGesIoy1LYbZyZzTn06CMHqGq0rFmid+Pr+yqtwDNLSey0eME0k jHniCZWnWm4o4ZHgeNtjwY1wH2pevAaPbuv2tfCld0Vs9jdWXdHSorea142dVSldTqsa 6P2kyaCDmaW0OU6T1yD5jX5q0xDYiUvbv8aqU0NxWbB8hdCmPO5wUPEmF+fo6NtEVxej rfJXX098GlHbVMvKqTsUizvAigmpqlaNwaTDqCVoMBqXBptDaEDb1XYOiM/4u/KcHNpx 36kA== X-Forwarded-Encrypted: i=1; AFNElJ+goygL3brhhuaMvs7wN4PZTwnM+4sCA3YORSvs4RdATofY/WghHi0nIjBBPym1Hn9hTpjc1Zk6jw3cpRQ=@vger.kernel.org X-Gm-Message-State: AOJu0Ywg1/K/tgJ75zVGx/XoZDoCDMVCqMVzuM07l/4m4E7Hvh12nC8E aGlGAhRnte7qVHe5NsI03SpunveKWn0MqqNhJ+KKDiOwY1b0VkDQNFos X-Gm-Gg: Acq92OEUEPQSIi/4hGhtZkhRMamXMCOaUHxhs0vyy5civhD9SybLdiCqIC4/Z3ubApI BoHD7Mk2LUg7EYATionSGmNq+cXosh1/ilZk+z7u5oGxkJ8hDfWVuXZuSBlAYshcfdSbPcsjV53 ayq4zmG08nmheZoqeUHA+qv6MH1PayoA4BV/Czvfvw1uxJjvOkHnXNveSMuGrqQq3P1h3gAnX+Q zGBBoMU/G5hU6o8iKLNVhJxyh0TJaA8V4M5cHphPJoleJX3gdLzVBQ2YkXvLmcm9+27g+esPWaT hL2cRGbeJQ6HOAwEvc5n9JWb8SdbysitQMju5P11L2hjKBlNTRJyTRV8ckDycL+0rXsDNJdAfcc VaLRS2aHdjKaXMcmEXjgRtcHUTxzDyk+nhIVv/cwJuaXrQEtT1ocMNj2tT/ofP/p3tjR4Y8dTrB Q+v0OcTFomNdKLceqXmUITWyehd9s6 X-Received: by 2002:a05:600c:154d:b0:490:44eb:c1e4 with SMTP id 5b1f17b1804b1-49044ebc273mr92866025e9.26.1779520501613; Sat, 23 May 2026 00:15:01 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:01 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:40 -0600 Subject: [PATCH v2 07/24] dyndbg.lds.S: fix lost dyndbg sections in modules 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-7-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=5103; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=hHbUbuvMq67kK92AX9bALnGMbnsaNAMLaVZBi9x7aP8=; b=qNGOyDxAj678uYPPSb3AMv+D39xUv181s2qeCaRNn8MAS2/vJ951M1OnGqV9FrNQYKjM0c4e3 udMiRqeIIYUCrA8M36uQ1otlhDsqiqVZChLkGkRzKDAM2Rg1gLLaJ7F X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= With CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy, several build configs had problems with __dyndbg* sections getting lost in drm drivers. Fix this by following the model demonstrated in codetag.lds.h. Introduce include/asm-generic/dyndbg.lds.h, to bundle dynamic-debug's multiple sections together, into 2 macros: vmlinux.lds.h DATA_DATA: move the 2 BOUNDED_SECTION_BY(__dyndbg*) calls into dyndbg.lds.h DYNDBG_SECTIONS(). vmlinux.lds.h now includes the new file and calls the new macro. MOD_DYNDBG_SECTIONS keeps the 2 sections by name, aligns them and sets the output address to 0 when the sections are empty. dyndbg.lds.h includes (reuses) bounded-section.lds.h scripts/module.lds.S: now calls MOD_DYNDBG_SECTIONS right before the CODETAG macro (consistent with their placements in vmlinux.lds.h), and also includes dyndbg.lds.h This isolates vmlinux.lds.h from further __dyndbg section additions. CC: Arnd Bergmann Signed-off-by: Jim Cromie Reviewed-by: Petr Pavlu --- v3: move #includes to top, drop extra ALIGN(8) in DYNDBG_SECTIONS, add RvBy v2: Address linker script review feedback for relocatable modules. MOD_DYNDBG_SECTIONS() used the BOUNDED_SECTION_BY() macro, which proved problematic for kernel modules for two reasons: 1. Unwanted Empty Sections: BOUNDED_SECTION_BY() automatically generates `__start` and `__stop` symbols. When applied to `MOD_DYNDBG_SECTIONS()`, the linker assumes the sections are populated due to the symbol definitions, forcing an empty `__dyndbg` and `__dyndbg_classes` output section in every compiled module, even those without dynamic debug configuration. Since the module loader uses `section_objs()` to locate data via ELF headers instead of relying on `__start`/`__stop` symbols, these assignments are completely unnecessary. 2. Non-zero Output Addresses: During relocatable linking (e.g., `ld.bfd -r`), omitting an explicit base address causes the section to inherit the current location counter. This results in non-zero sh_addr values in `.ko` files, which is confusing, degrades compressibility, and can cause issues with external tools parsing the ELF. Fix both issues by dropping `BOUNDED_SECTION_BY()` in favor of a simple `KEEP(*(...))` constraint and explicitly defining the sections with a `0` base address: `__dyndbg 0 : ALIGN(8) { ... }`. fixup-inc-vml --- MAINTAINERS | 1 + include/asm-generic/dyndbg.lds.h | 18 ++++++++++++++++++ include/asm-generic/vmlinux.lds.h | 6 ++---- scripts/module.lds.S | 2 ++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index c2c6d79275c6..e87bfe2e9e62 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9079,6 +9079,7 @@ DYNAMIC DEBUG M: Jason Baron M: Jim Cromie S: Maintained +F: include/asm-generic/dyndbg.lds.h F: include/linux/dynamic_debug.h F: lib/dynamic_debug.c F: lib/test_dynamic_debug.c diff --git a/include/asm-generic/dyndbg.lds.h b/include/asm-generic/dyndbg.= lds.h new file mode 100644 index 000000000000..9d8951bef688 --- /dev/null +++ b/include/asm-generic/dyndbg.lds.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef __ASM_GENERIC_DYNDBG_LDS_H +#define __ASM_GENERIC_DYNDBG_LDS_H + +#include +#define DYNDBG_SECTIONS() \ + BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ + BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes) + +#define MOD_DYNDBG_SECTIONS() \ + __dyndbg 0 : ALIGN(8) { \ + KEEP(*(__dyndbg)) \ + } \ + __dyndbg_classes 0 : ALIGN(8) { \ + KEEP(*(__dyndbg_classes)) \ + } + +#endif /* __ASM_GENERIC_DYNDBG_LDS_H */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index 0e4677b71d16..f2ec36a35809 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -52,6 +52,7 @@ =20 #include #include +#include =20 #ifndef LOAD_OFFSET #define LOAD_OFFSET 0 @@ -344,10 +345,7 @@ *(.data..do_once) \ STRUCT_ALIGN(); \ *(__tracepoints) \ - /* implement dynamic printk debug */ \ - . =3D ALIGN(8); \ - BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes) \ - BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ + DYNDBG_SECTIONS() \ CODETAG_SECTIONS() \ LIKELY_PROFILE() \ BRANCH_PROFILE() \ diff --git a/scripts/module.lds.S b/scripts/module.lds.S index b62683061d79..2e62dc5bd5d4 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -10,6 +10,7 @@ #endif =20 #include +#include =20 SECTIONS { /DISCARD/ : { @@ -61,6 +62,7 @@ SECTIONS { *(.rodata..L*) } =20 + MOD_DYNDBG_SECTIONS() MOD_SEPARATE_CODETAG_SECTIONS() } =20 --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 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 3065B946A for ; Sat, 23 May 2026 07:15:06 +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=1779520512; cv=none; b=pYFAJuRTKLlNQk7+c2TF4sx/lo6cTUiBWPdBueK8qir0z5eoIa0g0Iez33UWZH45ttVIKJsIUAlz/uZWs+euaTeluR6vEd3zXScQph+yC2BhS1hazV+ZT0hnxMhAOBBsQIqcC8qWmgzQavu0S2SWnemWOkpmYkxt+t9QQZ3+dng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520512; c=relaxed/simple; bh=ytc0P/UZw6i8hpySK2Au28vrT+KoK4/4tvvmOq28NjE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pSfAdDZW4uO3l+1J1teM+Jo+mZAsmXhpUQE6KUlys0RRueBnNd3EDPjixfExLEL8dr++iEyivzlGMOng/VA1YgCx9HeNpEzsz4ls8eZoiTenmQTGi5/0maxHLXes2pVTYLG5W8/orIqgfP6DGVXEcK+y2xBMVUBhHfQSo3aiZF4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KOHk0v/Y; arc=none smtp.client-ip=209.85.221.47 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) header.d=gmail.com header.i=@gmail.com header.b="KOHk0v/Y" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-45d96d21e82so4539988f8f.0 for ; Sat, 23 May 2026 00:15:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520505; x=1780125305; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BdDKIkZQT8kN6q6EUNEFoTcvXlPCpXkuxCaw1ETC1j0=; b=KOHk0v/Y4BkDZjDkXwM5TOzSZqZvmt0+9xV2btspHIs4du5ytuXuYMsD9nVpRMd/Qz c3oydRjROCKmlz3tJmR4okd0XcQ4h/lICfDAzDy0GXUMkHL40u9J+8T02Mt4DSTn8im2 ZUQAmqXO2u0qzC0AZ7iEyxXUAqMtqdyhT9okDiVZoUFYnCwtv8hPOZsTNSreNp1E973c Y08eNIvVX1UZejXQUIOMNL9exAWtBVZJ0V7oArty5/yZ/MVcPG2QE9jnx+UCP/lIRVMO pzez8YShVoFIQbvNSBQxj+jBvc2LqKeQ2zzPvcV0YtZ4+lXN2kR/cEpDy83mPCoBVq1x Zzag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520505; x=1780125305; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=BdDKIkZQT8kN6q6EUNEFoTcvXlPCpXkuxCaw1ETC1j0=; b=N7gnDujq93F7aOlxqbzSHJrOnfZ5yhtQbRG91cLVbLwwFLKI7TRQMM40bfLNMrMsaj qoa8Y5xwCcEDqqF1ihlmu/QXtuUBCJvHHLS5aFgu25MxtjlSQ+iZsGRlZG5bryKCrVK9 eW54BQARVOCKh8fgcxKzhVvkZIBF6JLi7XqS4MgXX8ZZOlJwirVpk7d8uxralWRwurtj enZchzybRutTL9n6QUDatIVkN7vuK6eXgb0ODNSdOd8h53nRKhzJN7oIW4C5o598k0YL vYqD0Qpj2Th5qyKBkF0/4kqJa+yJFHJBLOi4GYxIPB/ez+8PFgvx89sX4Bd6HfgGWkkY nraw== X-Forwarded-Encrypted: i=1; AFNElJ/hnfm7jXh9EtyeLgjox3Nnu6TDqzQ58qijWu4/zSTVtep3lEI8eqLjKYelHmascOwP6RsGzHach6nO3GA=@vger.kernel.org X-Gm-Message-State: AOJu0YwveXXyU+/gFnuGJ3YRy5RITg9K9JJumBLIYzEVNtmODGs6GXb/ 54XW4BRjg8U1ZBqQZUcN9jiO2BibMx9CNpnw+ha7CNALTyA59FS4s6k4 X-Gm-Gg: Acq92OFjxeoJGUDZ8ea5KDXOY1YqLGn2NtitLTL3RW7kkILgQ8XJ4NyzJGffZaujdBd xii7AR9zLchIOIqtLMzdFmeiGN8YkaDwV/k5s9pS5jPSGNNNuFMh0BB6qVdnn2sHSeTrGRGYKQL +1DeAMXcoXrhY1jhMLV+1APO8/vJI0EZWlDHzttZXRTi5g636wLAFrnN0VhAfp6nKrvcvviy71w pZvtpT430YhRr8hyiAWAt3gmAT60+6My/lZ51Vj4Pf0XtKuXZ9fYS0RHtOxIo6fYSRwiIeVVBlH LUYi1zbygS8DizRMbD9IdFMG079YBSkRW2hJHfm3KeAmSBA9rh2Ls5M8136xiFFe1PsvtKr5O8L Cr287Ucz7hc5/mUvjuru4otHEUqmG2isKiE/gArBON8aTPsKlzm9xBn73uOsY2O5tfJkpikjHbJ mkEJvowGi1z0c63bw+1wzeqN/ScRd/ X-Received: by 2002:a05:6000:41ee:b0:43f:e94a:e773 with SMTP id ffacd0b85a97d-45eb36b0818mr10298365f8f.27.1779520503105; Sat, 23 May 2026 00:15:03 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:02 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:41 -0600 Subject: [PATCH v2 08/24] dyndbg: factor ddebug_match_desc out from ddebug_change 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-8-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=4346; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=ytc0P/UZw6i8hpySK2Au28vrT+KoK4/4tvvmOq28NjE=; b=0FjUNJKqj7zcKpWVRK2n6ovvyNH2+oda32OW1WLwtDuWRnsuT5scN/UPpoLhYifa4yWRrthJy aTwPMijUnb1DvrrA+go89tdgBJwSTv77BQa50TUt4C4cH9JveciLEG8 X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= ddebug_change() is a big (~100 lines) function with a nested for loop. The outer loop walks the per-module ddebug_tables list, and does module stuff: it filters on a query's "module FOO*" and "class BAR", failures here skip the entire inner loop. The inner loop (60 lines) scans a module's descriptors. It starts with a long block of filters on function, line, format, and the validated "BAR" class (or the legacy/_DPRINTK_CLASS_DFLT). These filters "continue" past pr_debugs that don't match the query criteria, before it falls through the code below that counts matches, then adjusts the flags and static-keys. This is unnecessarily hard to think about. So move the per-descriptor filter-block into a boolean function: ddebug_match_desc(desc), and change each "continue" to "return false". This puts a clear interface in place, so any future changes are either inside, outside, or across this interface. also fix checkpatch complaints about spaces and braces. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- lib/dynamic_debug.c | 83 ++++++++++++++++++++++++++++++-------------------= ---- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 18a71a9108d3..6b1e983cfedc 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -172,6 +172,52 @@ static struct ddebug_class_map *ddebug_find_valid_clas= s(struct ddebug_table cons * callsites, normally the same as number of changes. If verbose, * logs the changes. Takes ddebug_lock. */ +static bool ddebug_match_desc(const struct ddebug_query *query, + struct _ddebug *dp, + int valid_class) +{ + /* match site against query-class */ + if (dp->class_id !=3D valid_class) + return false; + + /* match against the source filename */ + if (query->filename && + !match_wildcard(query->filename, dp->filename) && + !match_wildcard(query->filename, + kbasename(dp->filename)) && + !match_wildcard(query->filename, + trim_prefix(dp->filename))) + return false; + + /* match against the function */ + if (query->function && + !match_wildcard(query->function, dp->function)) + return false; + + /* match against the format */ + if (query->format) { + if (*query->format =3D=3D '^') { + char *p; + /* anchored search. match must be at beginning */ + p =3D strstr(dp->format, query->format + 1); + if (p !=3D dp->format) + return false; + } else if (!strstr(dp->format, query->format)) { + return false; + } + } + + /* match against the line number range */ + if (query->first_lineno && + dp->lineno < query->first_lineno) + return false; + if (query->last_lineno && + dp->lineno > query->last_lineno) + return false; + + return true; +} + static int ddebug_change(const struct ddebug_query *query, struct flag_settings *modifiers) { @@ -204,42 +250,7 @@ static int ddebug_change(const struct ddebug_query *qu= ery, for (i =3D 0; i < dt->num_ddebugs; i++) { struct _ddebug *dp =3D &dt->ddebugs[i]; =20 - /* match site against query-class */ - if (dp->class_id !=3D valid_class) - continue; - - /* match against the source filename */ - if (query->filename && - !match_wildcard(query->filename, dp->filename) && - !match_wildcard(query->filename, - kbasename(dp->filename)) && - !match_wildcard(query->filename, - trim_prefix(dp->filename))) - continue; - - /* match against the function */ - if (query->function && - !match_wildcard(query->function, dp->function)) - continue; - - /* match against the format */ - if (query->format) { - if (*query->format =3D=3D '^') { - char *p; - /* anchored search. match must be at beginning */ - p =3D strstr(dp->format, query->format+1); - if (p !=3D dp->format) - continue; - } else if (!strstr(dp->format, query->format)) - continue; - } - - /* match against the line number range */ - if (query->first_lineno && - dp->lineno < query->first_lineno) - continue; - if (query->last_lineno && - dp->lineno > query->last_lineno) + if (!ddebug_match_desc(query, dp, valid_class)) continue; =20 nfound++; --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 9E7F8344044 for ; Sat, 23 May 2026 07:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520513; cv=none; b=N/qXC2CWhRKTmfZ4AutxEUdZJTKSq65ZL5Rk2VM+RtqPoVemhBzPh5Il4XMVjPAjveqt0VKKPaz4lFM5hmaH6pmRpfpr7gjgr0iI/W6iIv+WNpW9l1CwSukbQHNTrYB3TrH6twVG3HBA29mWBOkSxgQlV3dYY3lCqq/vsyWJ6HE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520513; c=relaxed/simple; bh=ifMjdOv9s5iBVhpB9m4hzA/NaIvmwyfWNqe78zgQbz8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dntkeKN/iyaVbciP1MPSe3IHS0IZEI7/NejKU/Kny2TSOI9EYfi+ZHTvs5aZGEvKyamX3VJgzjqv7FOHu4ghzJqysaOrHPzzEZZI7RNV+AiJxSCflh6hQIhg+Q1A7n5ePOb6cMA08q741ARoMv50VX8jOFwgku6e5U0Q1nTe7qQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qZUgjL3i; arc=none smtp.client-ip=209.85.128.42 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) header.d=gmail.com header.i=@gmail.com header.b="qZUgjL3i" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-48909558b3aso80523075e9.0 for ; Sat, 23 May 2026 00:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520507; x=1780125307; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=x+DQN3gI8cDIPCl5342KuGjmmS7ZUCk1xMik8PQu+to=; b=qZUgjL3iv//xwuJlIrY389JLxW3S6fZBEJgpnFbI35vm+BN4NMXNWVQk1zap98s4F8 E0Mh9Vm2ddKzFl4ZtWTjaYVWJ2y4kNXgZSXks7VznjJoRAbHux5b5yMkLZ5JXn12gLL7 AvzWg02SKE/AUZZPn+AepYaTPIBDjVGibYJQRpDXJvIUHXcA5rrS6z7ipP4/nCv8vgWJ a6gPgvH+CM1Q4nPqFwnvQCEQBGrRIaH1znz3DX8zC0hbXy2obrFr7pstshsDhnA3ebiu aYXiKsNFpWqpHAcKFMtyz603HObbilaLSm4hyVOYadJx6atfSVkon8XI8bt1n5FYqR5s PTMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520507; x=1780125307; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=x+DQN3gI8cDIPCl5342KuGjmmS7ZUCk1xMik8PQu+to=; b=BGA3uZ9WW1eQ/U0MdQMuBV16oYF3XsFV4HZ80CiLVZL0WyP6M4UGGNpW/7fG8FMjNG 7Z5vrzRr/1bLHEwgXJQA5pvEH7Ty8PXswPJ8djjjtyxZTA3FhwgW/nvSMoC12g6/B7rd VHuz8GO6MLHttc0D0eRTvBxtdbsl2gWt7J05+YzW/aPtwjzK8HtR8B3NQ5ezaRWqTdS/ izhQKG2HpNWuVpUJbJz2UKNquA5rRDXBR21UWBadCrNujvXIF5LHA+gYl9YCtBvxxY6/ 3LZTRehNRSQWmeJxmEuGApBzpxh/l6jQQP4dM/bjHcyVxUHC4aY5FyXFkiR5ibW5sYA7 roVA== X-Forwarded-Encrypted: i=1; AFNElJ8Yv/iROCQPTd2UfPwagud3ON7ax7uQDpsKTG7WUKLo+SNgBqWKT4WMnZtNbI9mfyDLgHUz1eAkpayZ++U=@vger.kernel.org X-Gm-Message-State: AOJu0YwIiije1bB9blfkPH4+/li2VICeg9UBuxixvWWMzf5AA6FC+p4K J17R0CMhs0okZbEKevjzcoRjbR6ppR67ebxoRXucyMv6cjCwldROoVprLfayVRB9hV4= X-Gm-Gg: Acq92OH/NT5WlCaktKqzO/BEJ4QclgYuxMzDkDs31a8CaZA52c9/iYvemfw7ta30+8M t9Os2v/AXJzv+fRTqzITvbG0QBY4XBoOUtzE1lU+mxFeHdNA954uSjqM6Q6BcXok9VFg/currtF nGzSQX/pGmzijJFg8OakgDvWLKldrDgFqlRi7UwYDWoVcdfT/k3mFRT4Jpc0Osyuza5ZsvtiN5w PQi/9MLZ+XBfz0NGLeq/t06Ur1qtk+0CYISO6JOMlF0oFdxIuIUJ6j5TEI5U3WZ0NnoLEFcYyjA tox2eEPcWr5k7ERY16SRHTNBSo99/bWM6+VwWA7KbDCYbm5EziudjZsWOVL/2aCmK2o8XyK13ED BJGuduZYjkl1bbND2I2dNk62IQ6qVp5sQxSZQgCcNvLJ7o97e35MDbuN11RNawFD2hnyPEzSP/q dJ1Ky9JXbASffTWg1+uMpouj3LdPdq X-Received: by 2002:a05:600c:a402:b0:488:a882:c7 with SMTP id 5b1f17b1804b1-490426ddc0fmr71710015e9.25.1779520506947; Sat, 23 May 2026 00:15:06 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:05 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:42 -0600 Subject: [PATCH v2 09/24] dyndbg: add stub macro for DECLARE_DYNDBG_CLASSMAP 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-9-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=3163; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=ifMjdOv9s5iBVhpB9m4hzA/NaIvmwyfWNqe78zgQbz8=; b=LeMzd2IbaJ/MfJTQ8bBott6YzzK/865ef38iQIRe1CPdRfS1+ivfNf7LDpy3XOiDG+YorXBjg f4f4T/LpU6FCIfIwOpBiTzv+K7o8iQSsvt2GsNwVVpUWk1TbcwvciNF X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= Add the stub macro for !DYNAMIC_DEBUG builds, after moving the original macro-defn down under the big ifdef. Do it now so future changes have a cleaner starting point. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 43 ++++++++++++++++++++++-----------------= ---- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 05743900a116..a10adac8e8f0 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -93,27 +93,6 @@ struct ddebug_class_map { enum class_map_type map_type; }; =20 -/** - * DECLARE_DYNDBG_CLASSMAP - declare classnames known by a module - * @_var: a struct ddebug_class_map, passed to module_param_cb - * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic - * @_base: offset of 1st class-name. splits .class_id space - * @classes: class-names used to control class'd prdbgs - */ -#define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ - static const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ - static struct ddebug_class_map __aligned(8) __used \ - __section("__dyndbg_classes") _var =3D { \ - .mod =3D THIS_MODULE, \ - .mod_name =3D KBUILD_MODNAME, \ - .base =3D _base, \ - .map_type =3D _maptype, \ - .length =3D NUM_TYPE_ARGS(char*, __VA_ARGS__), \ - .class_names =3D _var##_classnames, \ - } -#define NUM_TYPE_ARGS(eltype, ...) \ - (sizeof((eltype[]){__VA_ARGS__}) / sizeof(eltype)) - /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { struct _ddebug *descs; @@ -138,6 +117,27 @@ struct ddebug_class_param { #if defined(CONFIG_DYNAMIC_DEBUG) || \ (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE)) =20 +/** + * DECLARE_DYNDBG_CLASSMAP - declare classnames known by a module + * @_var: a struct ddebug_class_map, passed to module_param_cb + * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic + * @_base: offset of 1st class-name. splits .class_id space + * @classes: class-names used to control class'd prdbgs + */ +#define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ + static const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ + static struct ddebug_class_map __aligned(8) __used \ + __section("__dyndbg_classes") _var =3D { \ + .mod =3D THIS_MODULE, \ + .mod_name =3D KBUILD_MODNAME, \ + .base =3D _base, \ + .map_type =3D _maptype, \ + .length =3D NUM_TYPE_ARGS(char*, __VA_ARGS__), \ + .class_names =3D _var##_classnames, \ + } +#define NUM_TYPE_ARGS(eltype, ...) \ + (sizeof((eltype[]) {__VA_ARGS__}) / sizeof(eltype)) + extern __printf(2, 3) void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); =20 @@ -314,6 +314,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, =20 #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) #define DYNAMIC_DEBUG_BRANCH(descriptor) false +#define DECLARE_DYNDBG_CLASSMAP(...) =20 #define dynamic_pr_debug(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 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 44C77345753 for ; Sat, 23 May 2026 07:15:10 +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=1779520515; cv=none; b=EfYsIYiubCH+qePkXdn8c5wjBdVA69yQ4tEkj3zZeYa+ASqhG57I94AaPo9yYx7ieonoSCnN3eX1GvTa0kM1GmCfa//3yAC1NGXkzmzl+l+vJ7CCx/HgUfYNVTIWRBjtW6JACCfr41ODxN/bzjgJ31XijpPjknoaw9VVRAG/6t0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520515; c=relaxed/simple; bh=Ah9OubhC/0J+O5fnf6mytQN8u50S2Bl4xoeKfk7IEd0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U9JVCdPTD0OADtf/3gdhebVbpVfDdi3eFwJYEIZhyCa834eA3mdm8beXauWf1Pn83+t2F2pdC6eJB9nWuAnZfdZPfmJ2GY5CILV61Gz7wReBKDhuwA+JVFr/FIr6z5dFBGS23aehFrB22UUHsinc3MlRrHX8rmuJKR9AQGuzHo4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mnYOsHTS; arc=none smtp.client-ip=209.85.221.47 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) header.d=gmail.com header.i=@gmail.com header.b="mnYOsHTS" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-45e9f4a3510so1752683f8f.1 for ; Sat, 23 May 2026 00:15:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520509; x=1780125309; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=1/UoMyrbDRBJtnX/0jQKUAOsd+dEJyLvzD20lPdR4ww=; b=mnYOsHTS6C1ZmiYricCFU1qon5J5Bj8Xdremgr8bCNl4r64JKw21B9n4+GI+9UMVUE rxqxT/Y8MlMmd3wIz8fBkglKB7s36J7uLl5Tn07TQ6gXCXd8HvBAT3FM6GBiLUkgF4dj PP0peeYIse3Lm0luFtDc59NmwrrcUxipa0AZ+cT8NoJPImBmNuzpLKJ8WmkVlzb0Lzxq VwPjDo+mFRQBXnry84pL6Ejy/r4/xC8qD9u5VcRlWM+IGwBn6WRq2AZjXD3rmWedp7xW HqPqDYXhATvvlD5z1I3ByHiZf03FLEuMy4UJraccOONYwW090dYE4mQu65iwT7yUIx4Y 3ONw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520509; x=1780125309; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=1/UoMyrbDRBJtnX/0jQKUAOsd+dEJyLvzD20lPdR4ww=; b=fQ8JQ5RQMOzIWrSjCL/OjMRV9SO3GqqWlkaSUvau3iW0dwGPq3lXxrhcp0genJMvMi EbUwi64pAPslgZzgUcz1pK2d6F0dkgEEEXZYUa28Yp2qdvLLadsjxfEZ9lCHqILssz/O dseE8Yk4VzYTWItMLm/hVfBbdtfsfV6SuCc6k8wdoxShtIioaGKbVW0WaLYjb4lWOmal WUw2SgAxU9F55t4WTnDjyB1UxUlNbL5keQXDSBDPQZ8sfYoBsTHGrjiWMpi/kj7okxkj 13vieLQm4PMA+k0DY7OU54UcOhrOlh+8JJLQcofpHlARtFaGGh8DRHXiC5HuLZCTHwBj y76w== X-Forwarded-Encrypted: i=1; AFNElJ+jFfYbOHJSDrgdNKu0Ss1jfAdo2pLbs/aUNDW5zrPY7gZqUb+pzdPk7p34DGEDzMWZx+kQCfwbbytzgGo=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1ZKWrYWFyA4deXsy6sxdfk2ekV/elLxwu0ubIQPfpG3STIGGM 0eJ6g6npjYR9ewMhB6NqKf2ndQJvexw25yhxJPN94XOjC1TrlhQYgvHw X-Gm-Gg: Acq92OHibJIvbOIcwciQyBUkI23hjwBRqDdZcxD8Us5DoEN6rz1Aw2lhfaOpReB287S XaMVZbaK0JdUIAobvhmn5VcJYSoXpqIwzaQ2s3A7J8BTZGkufdfI0bjwISaP8f8no7xfUjiKCeW JGdG2BP0RhIC7jHfzG0Ki7sDXsc+7QsLYLMyRxOqi6Ou+zfzZ/7L7tCsc7rDlP6OGHNKxkK9rXQ KflubW4C+r59IwOch9aVao/MgZLsVIwUrpWgmUImg93RvgRXc+fChhYLpg3Ak46Nq/A8lrBoFBh 2CssnuVj+nv8LWz09uwo+dsrQTeSxqkCDbqH5ZoS8O5p8RypT6G0/wsw7v9ee4lp/4TuihnSFi/ 4wHx0jLKC3vLqesDJOCb5JwFZeakUeyKwV7TTzPQgJ3sClmsF7HZdPwoNsq2pP82TmpyHL1P1Vl XWANNqpa9WZB3h4Wdy8uEt4l58VZpr5iUqpswIgbk= X-Received: by 2002:a05:6000:41c7:b0:451:66e6:501b with SMTP id ffacd0b85a97d-45eb3324e34mr9651283f8f.0.1779520508486; Sat, 23 May 2026 00:15:08 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:07 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:43 -0600 Subject: [PATCH v2 10/24] dyndbg: reword "class unknown," to "class:_UNKNOWN_" 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-10-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=1309; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=Ah9OubhC/0J+O5fnf6mytQN8u50S2Bl4xoeKfk7IEd0=; b=pwcA+Pegzk3CXbQXnl4Bmr24EnZTQsoVG0QcFjlTa+oIhKNkKDOhgNtlhtZ0DeoUT+EatexUY g3lqjPBN5QDCaSTmisG4ORkEm7FKIG+zXYtZSOwHcVuXgKVw0paJe2V X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= When a dyndbg classname is unknown to a kernel module, the callsite is un-addressable via >control queries. The control-file displays this condition as "class unknown," currently. That spelling is sub-optimal/too-generic, so change it to "class:_UNKNOWN_" to loudly announce the erroneous situation, and to make it uniquely greppable. NB: while this might be seen as a user-visible change, this shouldn't disqualify the change: a- it reports classmap coding error condition, which should be detected before review. b- SHOUTING the error makes it uniquely greppable. c- the classmap feature is marked BROKEN for its only current user. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- lib/dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 6b1e983cfedc..a9caf84ddb22 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1166,7 +1166,7 @@ static int ddebug_proc_show(struct seq_file *m, void = *p) if (class) seq_printf(m, " class:%s", class); else - seq_printf(m, " class unknown, _id:%d", dp->class_id); + seq_printf(m, " class:_UNKNOWN_ _id:%d", dp->class_id); } seq_putc(m, '\n'); =20 --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 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 0B7053491E1 for ; Sat, 23 May 2026 07:15:14 +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=1779520517; cv=none; b=s2JiIIpLEoFlmZZIusDj6qvBxqNW45K7eftoNipQxKn++QAMgypJGcGMIy+GBBAglupB2O9aiDo2mGlbLTkPOcpu6xlhqYugXrE8UOJaeGMdmJkjQDN4UgnduXuLRx15rMstvvf8DKRFLtkP7KnWDofDygL4SxzD44eN3qjo0Hg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520517; c=relaxed/simple; bh=gQZ88gBfz79ESKcPkTx8I8zUQh8zyexO3lJ8TNMZRbE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GSj2iNcFkPkHeXr+s6kt3kVwQ2mO9UYXUdc7Y78x+yoiLQu16d4fuFTzAaaeYrxyBxY6OmSF+EqPzyeu7oNCZatXrjTVAIayssvWoD9JN7ae++nZ5XWopCAUYyXlwgg735zV6m/ieO7uRXYrAlS+AoBQFFwExQv0zPQ3sJblFvg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=g3L2IHHj; arc=none smtp.client-ip=209.85.221.47 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) header.d=gmail.com header.i=@gmail.com header.b="g3L2IHHj" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-45d96d21e82so4540031f8f.0 for ; Sat, 23 May 2026 00:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520513; x=1780125313; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Mi262PGX/DdxCI7Tfx7Z5HvSlx4T7DOtXurGXyeHKEo=; b=g3L2IHHjYlNPTpem/1St92SHBAQ40oMoXxZvyfIgmfegr70Ld6w6VG0BctF0dG5Rbf FwVrhFCe7QaJEzbTKmvrYr8PFAcfj1u2ZI8pIzwBbVxHY+SqoA/gAdZi+8kxReWEnksk rxjEdWvBh2dc6r5V2Dk/iXe9kUqN3CY4rz3CHkda3iC7ad6uxT0OLJ/Gz5nr4G1Zk0/u VO1IJDAMTbTB0lUhdmm7UozgxKnIdW8DMdph0eXNSsDWxNX0TcrZ30W/oHFAKRZr5o9k GxHMVXL505slrD6oA1EZgms8bKbgbIDMUcOiV6TgoZ2di1BuiLOu7Tq/dfLNF3kLevnC 5rRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520513; x=1780125313; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Mi262PGX/DdxCI7Tfx7Z5HvSlx4T7DOtXurGXyeHKEo=; b=mjkFHNojFsNAw0ML0z0b7j2Ixaks1KOafTXhqvST8UhPStX9dsHENWhZvV6YIigmiM 13XOkrD96wNH7qVlqf/woBBrRvICuYm6/0xEWeBFHcDq5FqDCOE3PqViSuqIrOMDg+eV NuPj1a3zux1ULZRjjqXYuy6z4NcCGmF19nFRFDTxxS1RytWE/pqO2YqL4BadMnSrMTHT y+/L7qIW6NgHsqMUQ7mQLYFhCe7ArcMJWLGQ+XuVZQSbaScyuxdAwurPnIHtoT5jVsCe /s5EpEFvi0Zu5MoVgKstmHrLq4wJBg9AUy8rnfMXwMWMqiKHYtdpAtPlOI8CV9bnn0jZ pYwQ== X-Forwarded-Encrypted: i=1; AFNElJ/numPMbumN5ua7Dmvd12Ew2PSOnf54YF8J0VLil81c9oQ5M1ZC/UPdgIYd2zZwnBwxh1PQiJEgFwy0DXM=@vger.kernel.org X-Gm-Message-State: AOJu0YyXiofugupD3kRX8kj+Citz1FuzKXDOcN0UweAJpSLpEufw+Qnm 4/xgbUp+zQCsVrPfT+Kjr+asMfo50MLC0/NLT7bBQKcmwAJokOWGzJRz X-Gm-Gg: Acq92OEO3lfOgfXfc9FFIvrVGyH3JbTTo1ZzzWLaNhBF44K+yQBoQ7EIFsiwBEFVJjM 2fQIe6sAIPCVlVxf5gI9Sz9WFBk0A9XPO5qbscADdIvSb/209TCp6BPKdj3KSXFO/6r5dgBWSNo X2d7xttcVJcJaOjb8KKNKj7yyNbUwbzcUK+7Az65z6P09ulMW6/5WY82hEJAiJGBhIAnJ3ZtfYD b8sbKG4Px/7uCFtqlmoPBuxnBzhLvTQQf0vtXyfwpN2ynKO8i1dWR7pyCA5brn/b3ljnQaO1FvT NbZGsb7nB/KdPTRb7/P7iQPheVI3Wxt8FBqQOG96c0LdaTKEuEnIUbCG0U1fgZ7RsJsknDfJ2gB UiJLGwaWytAPTNm4e0iqRX7oUMqndxEPXhGOChVI3NblVdmQw6W/8t1/lJDj2FJ474ELyxwkkUc 9cH2jeLxD/VsurB6HecrICH0/SGjPk X-Received: by 2002:a05:6000:4901:b0:455:fbb:28bb with SMTP id ffacd0b85a97d-45eb38af9abmr10516199f8f.35.1779520513292; Sat, 23 May 2026 00:15:13 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:09 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:44 -0600 Subject: [PATCH v2 11/24] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-11-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=8828; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=gQZ88gBfz79ESKcPkTx8I8zUQh8zyexO3lJ8TNMZRbE=; b=4FEUbbf77XrK3sQMboxzqsW5eRGGLoftq58Ya8XU4/wQQo7cLzeH0LP23ba8DIlO2Ss5/xuYY zVwIeCF9ILiBoxy66jtJwifLUXN0ZBV4zRvHpnfm6V92SCZ/MzTd0/0 X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= Remove the DD_CLASS_TYPE_*_NAMES classmap types and code. These 2 classmap types accept class names at the PARAM interface, for example: echo +DRM_UT_CORE,-DRM_UT_KMS > /sys/module/drm/parameters/debug_names The code works, but its only used by test-dynamic-debug, and wasn't asked for by anyone else, so reduce LOC & test-surface; simplify things. Also rename enum class_map_type to enum ddebug_class_map_type. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: move RvB after SoB respect const instr in param_set_dyndbg_module_classes, return -EINVAL on c= lasstype err. --- include/linux/dynamic_debug.h | 23 +++------- lib/dynamic_debug.c | 99 +++------------------------------------= ---- lib/test_dynamic_debug.c | 26 ------------ 3 files changed, 12 insertions(+), 136 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index a10adac8e8f0..aa45dcf36a44 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -59,27 +59,16 @@ struct _ddebug { #endif } __attribute__((aligned(8))); =20 -enum class_map_type { +enum ddebug_class_map_type { DD_CLASS_TYPE_DISJOINT_BITS, /** - * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, one per bit. - * expecting hex input. Built for drm.debug, basis for other types. + * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, mapped to bits[0= ..N]. + * Expects hex input. Built for drm.debug, basis for other types. */ DD_CLASS_TYPE_LEVEL_NUM, /** - * DD_CLASS_TYPE_LEVEL_NUM: input is numeric level, 0-N. - * N turns on just bits N-1 .. 0, so N=3D0 turns all bits off. - */ - DD_CLASS_TYPE_DISJOINT_NAMES, - /** - * DD_CLASS_TYPE_DISJOINT_NAMES: input is a CSV of [+-]CLASS_NAMES, - * classes are independent, like _DISJOINT_BITS. - */ - DD_CLASS_TYPE_LEVEL_NAMES, - /** - * DD_CLASS_TYPE_LEVEL_NAMES: input is a CSV of [+-]CLASS_NAMES, - * intended for names like: INFO,DEBUG,TRACE, with a module prefix - * avoid EMERG,ALERT,CRIT,ERR,WARNING: they're not debug + * DD_CLASS_TYPE_LEVEL_NUM: input is numeric level, 0..N. + * Input N turns on bits 0..N-1 */ }; =20 @@ -90,7 +79,7 @@ struct ddebug_class_map { const char **class_names; const int length; const int base; /* index of 1st .class_id, allows split/shared space */ - enum class_map_type map_type; + enum ddebug_class_map_type map_type; }; =20 /* encapsulate linker provided built-in (or module) dyndbg data */ diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index a9caf84ddb22..0377d9f8dcd1 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -646,76 +646,6 @@ static int ddebug_apply_class_bitmap(const struct ddeb= ug_class_param *dcp, =20 #define CLASSMAP_BITMASK(width) ((1UL << (width)) - 1) =20 -/* accept comma-separated-list of [+-] classnames */ -static int param_set_dyndbg_classnames(const char *instr, const struct ker= nel_param *kp) -{ - const struct ddebug_class_param *dcp =3D kp->arg; - const struct ddebug_class_map *map =3D dcp->map; - unsigned long curr_bits, old_bits; - char *cl_str, *p, *tmp; - int cls_id, totct =3D 0; - bool wanted; - - cl_str =3D tmp =3D kstrdup_and_replace(instr, '\n', '\0', GFP_KERNEL); - if (!tmp) - return -ENOMEM; - - /* start with previously set state-bits, then modify */ - curr_bits =3D old_bits =3D *dcp->bits; - vpr_info("\"%s\" > %s:0x%lx\n", cl_str, KP_NAME(kp), curr_bits); - - for (; cl_str; cl_str =3D p) { - p =3D strchr(cl_str, ','); - if (p) - *p++ =3D '\0'; - - if (*cl_str =3D=3D '-') { - wanted =3D false; - cl_str++; - } else { - wanted =3D true; - if (*cl_str =3D=3D '+') - cl_str++; - } - cls_id =3D match_string(map->class_names, map->length, cl_str); - if (cls_id < 0) { - pr_err("%s unknown to %s\n", cl_str, KP_NAME(kp)); - continue; - } - - /* have one or more valid class_ids of one *_NAMES type */ - switch (map->map_type) { - case DD_CLASS_TYPE_DISJOINT_NAMES: - /* the +/- pertains to a single bit */ - if (test_bit(cls_id, &curr_bits) =3D=3D wanted) { - v3pr_info("no change on %s\n", cl_str); - continue; - } - curr_bits ^=3D BIT(cls_id); - totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits); - *dcp->bits =3D curr_bits; - v2pr_info("%s: changed bit %d:%s\n", KP_NAME(kp), cls_id, - map->class_names[cls_id]); - break; - case DD_CLASS_TYPE_LEVEL_NAMES: - /* cls_id =3D N in 0..max. wanted +/- determines N or N-1 */ - old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); - curr_bits =3D CLASSMAP_BITMASK(cls_id + (wanted ? 1 : 0 )); - - totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits); - *dcp->lvl =3D (cls_id + (wanted ? 1 : 0)); - v2pr_info("%s: changed bit-%d: \"%s\" %lx->%lx\n", KP_NAME(kp), cls_id, - map->class_names[cls_id], old_bits, curr_bits); - break; - default: - pr_err("illegal map-type value %d\n", map->map_type); - } - } - kfree(tmp); - vpr_info("total matches: %d\n", totct); - return 0; -} - /** * param_set_dyndbg_classes - class FOO >control * @instr: string echo>d to sysfs, input depends on map_type @@ -734,28 +664,14 @@ int param_set_dyndbg_classes(const char *instr, const= struct kernel_param *kp) unsigned long inrep, new_bits, old_bits; int rc, totct =3D 0; =20 - switch (map->map_type) { - - case DD_CLASS_TYPE_DISJOINT_NAMES: - case DD_CLASS_TYPE_LEVEL_NAMES: - /* handle [+-]classnames list separately, we are done here */ - return param_set_dyndbg_classnames(instr, kp); - - case DD_CLASS_TYPE_DISJOINT_BITS: - case DD_CLASS_TYPE_LEVEL_NUM: - /* numeric input, accept and fall-thru */ - rc =3D kstrtoul(instr, 0, &inrep); - if (rc) { - pr_err("expecting numeric input: %s > %s\n", instr, KP_NAME(kp)); - return -EINVAL; - } - break; - default: - pr_err("%s: bad map type: %d\n", KP_NAME(kp), map->map_type); + rc =3D kstrtoul(instr, 0, &inrep); + if (rc) { + int len =3D strcspn(instr, "\n"); + pr_err("expecting numeric input, not: %.*s > %s\n", + len, instr, KP_NAME(kp)); return -EINVAL; } =20 - /* only _BITS,_NUM (numeric) map-types get here */ switch (map->map_type) { case DD_CLASS_TYPE_DISJOINT_BITS: /* expect bits. mask and warn if too many */ @@ -783,6 +699,7 @@ int param_set_dyndbg_classes(const char *instr, const s= truct kernel_param *kp) break; default: pr_warn("%s: bad map type: %d\n", KP_NAME(kp), map->map_type); + return -EINVAL; } vpr_info("%s: total matches: %d\n", KP_NAME(kp), totct); return 0; @@ -804,12 +721,8 @@ int param_get_dyndbg_classes(char *buffer, const struc= t kernel_param *kp) const struct ddebug_class_map *map =3D dcp->map; =20 switch (map->map_type) { - - case DD_CLASS_TYPE_DISJOINT_NAMES: case DD_CLASS_TYPE_DISJOINT_BITS: return scnprintf(buffer, PAGE_SIZE, "0x%lx\n", *dcp->bits); - - case DD_CLASS_TYPE_LEVEL_NAMES: case DD_CLASS_TYPE_LEVEL_NUM: return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl); default: diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 77c2a669b6af..74d183ebf3e0 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -74,13 +74,6 @@ DECLARE_DYNDBG_CLASSMAP(map_disjoint_bits, DD_CLASS_TYPE= _DISJOINT_BITS, 0, DD_SYS_WRAP(disjoint_bits, p); DD_SYS_WRAP(disjoint_bits, T); =20 -/* symbolic input, independent bits */ -enum cat_disjoint_names { LOW =3D 11, MID, HI }; -DECLARE_DYNDBG_CLASSMAP(map_disjoint_names, DD_CLASS_TYPE_DISJOINT_NAMES, = 10, - "LOW", "MID", "HI"); -DD_SYS_WRAP(disjoint_names, p); -DD_SYS_WRAP(disjoint_names, T); - /* numeric verbosity, V2 > V1 related */ enum cat_level_num { V0 =3D 14, V1, V2, V3, V4, V5, V6, V7 }; DECLARE_DYNDBG_CLASSMAP(map_level_num, DD_CLASS_TYPE_LEVEL_NUM, 14, @@ -88,13 +81,6 @@ DECLARE_DYNDBG_CLASSMAP(map_level_num, DD_CLASS_TYPE_LEV= EL_NUM, 14, DD_SYS_WRAP(level_num, p); DD_SYS_WRAP(level_num, T); =20 -/* symbolic verbosity */ -enum cat_level_names { L0 =3D 22, L1, L2, L3, L4, L5, L6, L7 }; -DECLARE_DYNDBG_CLASSMAP(map_level_names, DD_CLASS_TYPE_LEVEL_NAMES, 22, - "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7"); -DD_SYS_WRAP(level_names, p); -DD_SYS_WRAP(level_names, T); - /* stand-in for all pr_debug etc */ #define prdbg(SYM) __pr_debug_cls(SYM, #SYM " msg\n") =20 @@ -102,10 +88,6 @@ static void do_cats(void) { pr_debug("doing categories\n"); =20 - prdbg(LOW); - prdbg(MID); - prdbg(HI); - prdbg(D2_CORE); prdbg(D2_DRIVER); prdbg(D2_KMS); @@ -129,14 +111,6 @@ static void do_levels(void) prdbg(V5); prdbg(V6); prdbg(V7); - - prdbg(L1); - prdbg(L2); - prdbg(L3); - prdbg(L4); - prdbg(L5); - prdbg(L6); - prdbg(L7); } =20 static void do_prints(void) --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 DCB12348865 for ; Sat, 23 May 2026 07:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520522; cv=none; b=V34FUfWDY9k1/xMOYL2tRyL9pMvuW4RUAIJa6xKRj1HC2PnNFFDEt9GIHVkzcM0qbCPBmdHfNdrZUWCnv+bH/S+lyoVXrVOAGxzw1fBHAiC0ooqYqbBeOvEABSQJqVOY6tEbL+pKizVrNlivDqCuWrHFNKynFIckFbebl0MVOF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520522; c=relaxed/simple; bh=rOksOAhaWphEcgDsCZEZduEgXwfTtl68VUCgxNPY7/c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A4HJxyQp3Ip124H5s94hWfn4TN7m8D3Db3if4sgS503a4wWlZ9dnyISuSmJqTfcPoxaeq0iztA3jbMKemdh9QEfkR7s+pDuGTH9RlRW5hSqGsBHufY446wqcHt2lhZ9Xjt0EPKmy4bksQ0cY+cfuA7FrCatNqCojBA3l7c+eGsg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QLotZ37J; arc=none smtp.client-ip=209.85.221.51 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) header.d=gmail.com header.i=@gmail.com header.b="QLotZ37J" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-43d7e23defbso4510618f8f.0 for ; Sat, 23 May 2026 00:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520516; x=1780125316; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=kcnaLfaQGctlS33zvErx78bjZPUMxYDde02HXus0bGY=; b=QLotZ37J11STgwaAiHh56BoyvTARohcxUqM37DfmdE35eUkT2sjjQZtzfh0CxDZK62 CY3xksaw8x+q26nNcnhvkU/Cag5f3IzXTr1DX3N4v7v9vLf+ju1O6KB8O4U7QCH82ENF 1XT/nBKP3MxlqXV/lWgsXM9MEyN64KFS/lEhv353u0pC3AgCGJgVDhYqfCfmm6OWPAfK BZ29hK33glyV4VvQIq28/sMidYS43gFQzVymq59LycYey/G110wCxCmVYL5X8So61J8P TpJTb52HLtL+P8kOnTDP33xEnJgZzMtZlQG4HCPPBRbOCi3Oo+zuZYX/k6Xay30dlFnI WJWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520516; x=1780125316; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=kcnaLfaQGctlS33zvErx78bjZPUMxYDde02HXus0bGY=; b=OyklroqFAEnLA1yg/m3Rb62dlfJ9iHK645Kbmt4lLpkVU/eudXg86cddK4UX/I5qHJ K1xRhLg5339HZWwQ8zfQc/c5nfvpdNC11is/FErm8c8qT7XU93Rv6q6G5jDimTOasVCz ZuvnEkhaGq+kQTQyKQGB5LLhtQoAHfprwB5zxggB4h24/Hx8ybobgxAoqmE3kkbays9T FbVMZAlSYcmhptQN/PpbpY/v21TC0712PIyJGZ+pmyQZDzfKGJlTC/oAagkIg+eiigGS QcY9gR9/Ou0atdO+zDP8Vdrs4sbpPy1sOv7h40P9yvEMtGdCVjsFoi9U6khr68fTw9Eo P/sA== X-Forwarded-Encrypted: i=1; AFNElJ+3QUdhIfgfjdpx6zzeTmRvQLtJsEstA/yybgz+AsyhCSZYjrS92Js0tJhGgacB/YRixQJpWu95pzR8flE=@vger.kernel.org X-Gm-Message-State: AOJu0YyzIWDoQvtl+kmPbBksAemHOliJHSq2iVjFttPt3P8GE4MxikrC oP9mgUjU9Id27vDf3VQjKH/jvhPm2FcatVCgVOFldbcAkvB/Dn3PooQw X-Gm-Gg: Acq92OFNGRKoOMxCIF5WjlauL3ipC4s7w0/d7P6dHEbibLlpuhgOFWdxT1zaNJ9vkYw 01g6BilFlJtIztkZFRxcBhp1aWpUqd4lWCKmdNgOYhZvfhKTQlYstHqmsZW8odSwL3jIg3EsCGS 8LAHxw4BRTvjcxUntXUA/Bp36lnVmqC9mbb9WVK9C8VvR2LPbwpmp6P+UZGIakEnD6knoEsgNwK ic0b0Y9wi/6g5E8HEwKeztPWDLWxUl6JRXXbLyOpt9cHiRLGmnElkIeTIguQZZBr8yiLlC7radf TMwRsiK/E8gyOM7tVCqJt0/ry4JWZD00uooif689NkYBfAxDBwbeDwwJbbdyZZ5X3ljOitcwE6m ijBpkfUAAYqSMIaqLUpn2vghwVEj2io8m52iToNgoxE9igwCrcywg+qn8ZfcYHEYWwGS0a4ukBN 7RBzf1MReMMMIKyRGalTSSVUjeLVqI X-Received: by 2002:a05:6000:1ace:b0:45e:9417:556f with SMTP id ffacd0b85a97d-45eb38c679fmr10298303f8f.39.1779520516325; Sat, 23 May 2026 00:15:16 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:15 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:45 -0600 Subject: [PATCH v2 12/24] dyndbg: drop NUM_TYPE_ARGS 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-12-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=1439; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=rOksOAhaWphEcgDsCZEZduEgXwfTtl68VUCgxNPY7/c=; b=IMkDxWEEMSyVXwT4wwtQxotcBdIkVon/BYyg9V3iMJcUkveV+jlKy9k+DfRHSnUkHdLpkLm0O gslJgQJjRPlCsYxqB/1ZQBFCoQdKro1LQI2q09sXEIk8n+4Le5VrzBd X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= ARRAY_SIZE works here, since array decl is complete. no functional change Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: include linux/array_size.h, correct commit subject review after sob --- include/linux/dynamic_debug.h | 4 +--- lib/dynamic_debug.c | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index aa45dcf36a44..e724f6b93663 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -121,11 +121,9 @@ struct ddebug_class_param { .mod_name =3D KBUILD_MODNAME, \ .base =3D _base, \ .map_type =3D _maptype, \ - .length =3D NUM_TYPE_ARGS(char*, __VA_ARGS__), \ + .length =3D ARRAY_SIZE(_var##_classnames), \ .class_names =3D _var##_classnames, \ } -#define NUM_TYPE_ARGS(eltype, ...) \ - (sizeof((eltype[]) {__VA_ARGS__}) / sizeof(eltype)) =20 extern __printf(2, 3) void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 0377d9f8dcd1..6d9dbeb68ae8 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -13,6 +13,7 @@ =20 #define pr_fmt(fmt) "dyndbg: " fmt =20 +#include #include #include #include --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 4573634C9AC for ; Sat, 23 May 2026 07:15:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520523; cv=none; b=b+VrOeVCECa7r9XeLW5C//U3YIa4lNpDF09hgn5U1zRIJG9+FD0dZIJcI9pYQoFdZF2wVwL8Pb7MgSJ6tqb2xwHhKbL8sStql95GUoy88sF57fcQ7veBUXRyvRMjI3gx2eJsfSx3LhPxbZe3A5Wk5VJlMw084Dl5KJ4Mw8lisyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520523; c=relaxed/simple; bh=zY26AoTDT5sXs+cwH/35lsu5KHT7UoaJFyISX4/PEiA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PaAmKe2H0z1j9S2h7qAaHgEtcSkqbBsmmPyE/kH8cfDRIo/MTpZbPGCSi9AcA3aYrSDSsLQM4B6qm11jOy5bXJOc5cinVHUOMIehsJ0DY8gWKPMgkzKyrMoXGJbOM6Dt4OoRRb0kKvUoZ+1bLh7gTOKH9S4Q608ILF2GEC88tDA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=q1/6ALyK; arc=none smtp.client-ip=209.85.221.41 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) header.d=gmail.com header.i=@gmail.com header.b="q1/6ALyK" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-4526a8170ceso4024419f8f.2 for ; Sat, 23 May 2026 00:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520520; x=1780125320; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UrPKdNKgj6LivKrqLr8CgMfwExcBZv4b+V8NB+o2xak=; b=q1/6ALyKibzj3o6aDV1YE50rTA6024QvKw3ZMDxGxL4M8KD4ulePXnYjLcYZV6Dm82 D0/JSnDgtpuyRGAA3X773ftyiBUFTqFmNzYWNY/kEhXRabRuJTbtMKdqB+ZQayX3o8li tYwV4bq0mCoFzsJfaWB7E2y4kwgGuOvDw8oBJDsA8872pW1uPo00o3M6PTg11vt0pH/2 qLjiqBKEo/nJUh2Ctjc7Pd/vE2MnjOKqwTZz35lBkxdnaNZ7JZySICIStiqMQEhbo/Sj w2hSkv7Rf6Y31QWsi7rHTIul8z90/l8t8UQebTv91J06loPE4m3c0uGIDJyots/FHK5o T1ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520520; x=1780125320; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=UrPKdNKgj6LivKrqLr8CgMfwExcBZv4b+V8NB+o2xak=; b=J5j28O4KcsX8uw7BQbaJ3x6QxCD8kPpcLg+Bq8WgZpyWumzz8W06pO3KNw8bzBW+mH De9BWl95ONOakhk/b7A3Son9fyo0jIDc/HG1R7n0XK+silHnpn5H6a8DTmlLdjVdM370 62e0UZUH3cFMd9LIpe/wvk6tGGE7xxKVMdG5VOZZG6Ph3g9LefvSjosz3C0vhN5L7etq MSB15yeL1ghKSlQ4jSZ1nPDz9xOfiXuNW7cjxdjRhwxK2h2eEGtFB4O0AnTr8H+B49kP fWyPRzHINqC6rqQ4w0LFLzHJ/kQS2nVeUp3xDN+QlUM+EJ/Pe8gdqfSoviTicwEqMs6f SyBA== X-Forwarded-Encrypted: i=1; AFNElJ+on0w4H4CY3XUNdqP3b8/LqKPU/b+B8aDhSty0SZQKeMfox6NNR8SyMzM4COm7IXe5KlqA8wojwBcL9nw=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+aBtFygKqjHGKRevmBOePzsdXO5qqw5AFa9j2Xb0Cg3hWCVDj Fzsjd67oYW5CB8nO+jNxr0rRcLPmTsyO3dPiI70lGBx/yN1CA93mcpwD X-Gm-Gg: Acq92OEsAoz+IqUvHw1YukR7+q3UeHMcx2BKQkjP6FFcgJEJlHaGp5ifO6nE7chtQ0l aN4jdzs0cAvbjW+uEnW/C+ix6gnFNBF+zXeM+1CAaC6FpRJYgMrLEtyrFwr4aWAnsQYyflq3OI0 k1blDDsGUZeRjueIPxoVRYlhq0H3UWTymEvCpdjm6Ttsf60Qy3rofZ2MzMvSNtVus2DAuPz7b8s h0a+WYygkXf1IvfXUrd/q+1WhxlszovApw/tOjEuZqzR5LyGIq2PLUNE4CJbtZLfjJO7Vs3t2EA 0LkZfSIT2k6eRyBXURRkub4kK2Wb7CsXhPiPglPCCQdEJocL8aC0u3GFgy+6GWH/Ze4Xjz+PKtA 6ws6cuyjYhHSRvpuKU5y5boTKud9jvBKYP/cl+juEE1wwI/dvFZlbtPMUO9tXfvhQYTpi8Prix+ 6eAcI1PhykAJ2Jjmd6rStKZEjF/4Ae X-Received: by 2002:a05:6000:2889:b0:45e:5b92:1e45 with SMTP id ffacd0b85a97d-45eb38c7d20mr10565597f8f.40.1779520519421; Sat, 23 May 2026 00:15:19 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:18 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:46 -0600 Subject: [PATCH v2 13/24] dyndbg: reduce verbose/debug clutter 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-13-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=4656; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=zY26AoTDT5sXs+cwH/35lsu5KHT7UoaJFyISX4/PEiA=; b=L2RL4t6UeiHcEGIX7kfDlIJ3EmHkqwuLl8YVbLdl0/jhDPOyxEy1b8gUT+0am8u8QIKmPveZD uy88jHV84ClDGG73VhFpecIhC0yryh1axgP4R06jKvH8P0W/nSkUzUT X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= currently, for verbose=3D3, these are logged (blank lines for clarity): dyndbg: query 0: "class DRM_UT_CORE +p" mod:* dyndbg: split into words: "class" "DRM_UT_CORE" "+p" dyndbg: op=3D'+' dyndbg: flags=3D0x1 dyndbg: *flagsp=3D0x1 *maskp=3D0xffffffff dyndbg: parsed: func=3D"" file=3D"" module=3D"" format=3D"" lineno=3D0-0 c= lass=3D... dyndbg: no matches for query dyndbg: no-match: func=3D"" file=3D"" module=3D"" format=3D"" lineno=3D0-0= class=3D... dyndbg: processed 1 queries, with 0 matches, 0 errs That is excessive, so this patch: - shrinks 3 lines of 2nd stanza to single line - drops 1st 2 lines of 3rd stanza 3rd line is like 1st, with result, not procedure. 2nd line is just status, retold in 4th, with more info. New output: dyndbg: query 0: "class DRM_UT_CORE +p" dyndbg: split into words: "class" "DRM_UT_CORE" "+p" dyndbg: op=3D'+' flags=3D0x1 maskp=3D0xffffffff dyndbg: processed 1 queries, with 0 matches, 0 errs Also drop several verbose=3D3 messages in ddebug_add_module When modprobing a module, dyndbg currently logs/says "add-module", and then "skipping" if the module has no prdbgs. Instead just check 1st and return quietly. no functional change Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: RvB after SoB trivial change to verbose-debug output line to output the actual "module" keyword rather than "mod:", and do so only when the module is constrained by the callchain (ie as part of a modprobe). was: query X: "(keyword value)* [+-=3D]flags" mod:* now: query X: "(keyword value)* [+-=3D]flags" or query X: module FOO "keyword value)* [+-=3D]flags" IOW, adjust output to reflect the input grammar more closely. --- lib/dynamic_debug.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 6d9dbeb68ae8..dfed3725aa44 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -277,9 +277,6 @@ static int ddebug_change(const struct ddebug_query *que= ry, } mutex_unlock(&ddebug_lock); =20 - if (!nfound && verbose) - pr_info("no matches for query\n"); - return nfound; } =20 @@ -512,7 +509,6 @@ static int ddebug_parse_flags(const char *str, struct f= lag_settings *modifiers) pr_err("bad flag-op %c, at start of %s\n", *str, str); return -EINVAL; } - v3pr_info("op=3D'%c'\n", op); =20 for (; *str ; ++str) { for (i =3D ARRAY_SIZE(opt_array) - 1; i >=3D 0; i--) { @@ -526,7 +522,6 @@ static int ddebug_parse_flags(const char *str, struct f= lag_settings *modifiers) return -EINVAL; } } - v3pr_info("flags=3D0x%x\n", modifiers->flags); =20 /* calculate final flags, mask based upon op */ switch (op) { @@ -542,7 +537,7 @@ static int ddebug_parse_flags(const char *str, struct f= lag_settings *modifiers) modifiers->flags =3D 0; break; } - v3pr_info("*flagsp=3D0x%x *maskp=3D0x%x\n", modifiers->flags, modifiers->= mask); + v3pr_info("op=3D'%c' flags=3D0x%x maskp=3D0x%x\n", op, modifiers->flags, = modifiers->mask); =20 return 0; } @@ -552,7 +547,7 @@ static int ddebug_exec_query(char *query_string, const = char *modname) struct flag_settings modifiers =3D {}; struct ddebug_query query =3D {}; #define MAXWORDS 9 - int nwords, nfound; + int nwords; char *words[MAXWORDS]; =20 nwords =3D ddebug_tokenize(query_string, words, MAXWORDS); @@ -570,10 +565,7 @@ static int ddebug_exec_query(char *query_string, const= char *modname) return -EINVAL; } /* actually go and implement the change */ - nfound =3D ddebug_change(&query, &modifiers); - vpr_info_dq(&query, nfound ? "applied" : "no-match"); - - return nfound; + return ddebug_change(&query, &modifiers); } =20 /* handle multiple queries in query string, continue on error, return @@ -594,7 +586,8 @@ static int ddebug_exec_queries(char *query, const char = *modname) if (!query || !*query || *query =3D=3D '#') continue; =20 - vpr_info("query %d: \"%s\" mod:%s\n", i, query, modname ?: "*"); + vpr_info("query %d: %s%s \"%s\"\n", i, + modname ? "module " : "", modname ?: "", query); =20 rc =3D ddebug_exec_query(query, modname); if (rc < 0) { @@ -1160,11 +1153,10 @@ static int ddebug_add_module(struct _ddebug_info *d= i, const char *modname) { struct ddebug_table *dt; =20 - v3pr_info("add-module: %s.%d sites\n", modname, di->num_descs); - if (!di->num_descs) { - v3pr_info(" skip %s\n", modname); + if (!di->num_descs) return 0; - } + + v3pr_info("add-module: %s %d sites\n", modname, di->num_descs); =20 dt =3D kzalloc_obj(*dt); if (dt =3D=3D NULL) { --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 3FFED3537DE for ; Sat, 23 May 2026 07:15:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520526; cv=none; b=XrVriC34bVDPoUryQrlz4oG+2LQLMObueY6MuOH2nppc6iteycr82I9mg9O5cwNpZ5auEsdpJeUiKuBnBx5+NXkiunj8yC0Fjz+GHs2bWvQeFglST9nJL8xpLRe4aKE+dR61AD4/Q08H477cyCfPfwWPRfKkb/nW1i2zVjzTIdg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520526; c=relaxed/simple; bh=ygsmS8nDEMGOXvT5j/lBji0LpEvx5xSLv8ALq0O4lqE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mh4FKqLGg/DqL903oh3iFEovPSXcySK4lcikhFFM1c+oDBmOgMGQAMImed2GCFOWbSLgMpY65OW9UJXNjVRv3yBbTh04F/3FvBxzGNZYvkOGCL6oXjyLD5/ouoITgZHAg9E19/rInyNkwx+bf1Z1jF70zk/FgFvTxt5Sl2sBKYE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aHMtdxUn; arc=none smtp.client-ip=209.85.128.41 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) header.d=gmail.com header.i=@gmail.com header.b="aHMtdxUn" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-48fe26a177cso60374155e9.1 for ; Sat, 23 May 2026 00:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520523; x=1780125323; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=obhyzCtxE4cJp5irEWyYUuiOZnV3I91tI0nfkiFOkUg=; b=aHMtdxUnQYJiPc0r55xbVKytNn5huzHxGYzcBzr6fz5SKVZ9HPpKGCmasdhWoSEQAZ H97XCtOEoO8E8zvoEeW52dAuEOwJjWhebN2rsO8ik4sQ3DG32mI+TCSnXEytH7Kk8cOW cDJ4lFXSj/3WBjTSCBfvRraZNcmCSTunoSHAB1w5ltP8oLeQHrQdt7Q2RzJ3xFw4d3qK A0md3xe6DP3IVsqCT8qjoOVvDiBhuzr+SVi37SiUq7q6Mc72KGImwGeTzpbk57N4HFDT GfDzMkhcGvvFdZxWFnnzHhDmWxznBQYERX63vgHTxgG5+MgMR5BIqTNGgARyAD2o1ZXv RI7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520523; x=1780125323; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=obhyzCtxE4cJp5irEWyYUuiOZnV3I91tI0nfkiFOkUg=; b=UAYr5u9DfkhIZE6ntWgrAQ7HL2u/kgvQSam4KRMEibQ1N56e9/eWylVYJmSKMiIUt3 /OzDn50xCkWdoizP/FCHzRYNTd8vG+pVSJvNsVpmDoWjuxyxhwr5Xxrog7CAaDZscb6A BzzpKkDCuTlyf7V4Zo+n4TShI+/bK7AhtOxyIs5MicCIzjkuILzUXpBYk0mom9Qehx89 8y1qxqct3M8BFmuULPMrl1dDGeL3GqE1PP81avBgSRS4V662VdcSmyeUm5g8DlxLwMhm yJ9V00M+dYRsVJSgh2X6aOKFNngBJ+r0nmKa56b00UdHgM0D8txwyTNR68JjklLHAz55 b2QA== X-Forwarded-Encrypted: i=1; AFNElJ+yNp2QjkbY4jq04oWjTVhfwgUSLxoiJn+9FtsKfXcnkP196toMZ8Fx1OKtWnTAD+eBvWLdELJXQs8+SLk=@vger.kernel.org X-Gm-Message-State: AOJu0YyIV6xv8m4KZTw3r35YJq9IobByQYEq8EfrNafvMAcixB94jCJU h622NuHDL5GNviauNiFKHUOwATS7geO1rpngQgbQM2TZxrekeWQ5Euuu X-Gm-Gg: Acq92OGJnXT2urfYTjlgpjBy4m8+rlL28UhK5E8Z9A1kf+H4yBZgSexCjOYVgCNKa5n rBl24JGx9TXPeXwHAMzruFudmJI+RVhMtavyIQThgTMjRB59F7iga/dszg5tvALwC5ufRwQXS2V lYi0GNPiD9Jpm6X32EMlztVabO8rMedSX3VIVwNLDiSA7BCcsCGmyHHoifTsFcpRtPdMH+8vfL9 mkSk+fV3Op36yZRuBM0KwwkcIx9+Aj199Y1kWkceU0QvtepyPACkOHf5a8w9snzMEEiubqZwBvf ytlhSu7tXCrTlpCDdK9uCURIGX0JAbiyGuWxzdFZFyIGcAxI2p2tBLZw+O7mCiYoV1VNlIHu6eh 0W45o57W5irSMWnjC2zZkADgOsOhKLU3DleeZ662fVnNyH+wk7UTqRToKRN5PEU2dsD2HLydPbM M+6uvGZrG7vWsZ3ohnFskyA+e4HEovnh79qmflXcA= X-Received: by 2002:a05:600c:46cb:b0:48d:366:b962 with SMTP id 5b1f17b1804b1-4904248776fmr96093385e9.6.1779520522358; Sat, 23 May 2026 00:15:22 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:21 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:47 -0600 Subject: [PATCH v2 14/24] dyndbg: refactor param_set_dyndbg_classes and below 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-14-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=6146; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=ygsmS8nDEMGOXvT5j/lBji0LpEvx5xSLv8ALq0O4lqE=; b=CvkI+eIsz4Q/Tyr1eAzx+2ubgxfi41aBUty7f+wZa830b5xgUya8Fm1cwgnOP6Mrmut/4/Xdq bC16E7poX1QCAxKE/c46VCHpR+H6DiF9wUcZBqAAqcaXYsKRZD+ql0m X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= Refactor callchain below param_set_dyndbg_classes(1) to allow mod-name specific settings. Split (1) into upper/lower fns, adding modname param to lower, and passing NULL in from upper. Below that, add the same param to ddebug_apply_class_bitmap(), and pass it thru to _ddebug_queries(), replacing NULL with the param. This allows the callchain to update the classmap in just one module, vs just all as currently done. While the sysfs param is unlikely to ever update just one module, the callchain will be used for modprobe handling, which should update only that just-probed module. In ddebug_apply_class_bitmap(), also check for actual changes to the bits before announcing them, to declutter logs. No functional change. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: move RvB after SoB --- lib/dynamic_debug.c | 51 +++++++++++++++++++++++++++++++++++++++----------= -- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index dfed3725aa44..ce069459aafc 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -607,9 +607,10 @@ static int ddebug_exec_queries(char *query, const char= *modname) return nfound; } =20 -/* apply a new bitmap to the sys-knob's current bit-state */ +/* apply a new class-param setting */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits) + unsigned long *new_bits, unsigned long *old_bits, + const char *query_modname) { #define QUERY_SIZE 128 char query[QUERY_SIZE]; @@ -617,7 +618,9 @@ static int ddebug_apply_class_bitmap(const struct ddebu= g_class_param *dcp, int matches =3D 0; int bi, ct; =20 - v2pr_info("apply: 0x%lx to: 0x%lx\n", *new_bits, *old_bits); + if (*new_bits !=3D *old_bits) + v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); =20 for (bi =3D 0; bi < map->length; bi++) { if (test_bit(bi, new_bits) =3D=3D test_bit(bi, old_bits)) @@ -626,12 +629,16 @@ static int ddebug_apply_class_bitmap(const struct dde= bug_class_param *dcp, snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], test_bit(bi, new_bits) ? '+' : '-', dcp->flags); =20 - ct =3D ddebug_exec_queries(query, NULL); + ct =3D ddebug_exec_queries(query, query_modname); matches +=3D ct; =20 v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, ct, map->class_names[bi], *new_bits); } + if (*new_bits !=3D *old_bits) + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); + return matches; } =20 @@ -644,6 +651,7 @@ static int ddebug_apply_class_bitmap(const struct ddebu= g_class_param *dcp, * param_set_dyndbg_classes - class FOO >control * @instr: string echo>d to sysfs, input depends on map_type * @kp: kp->arg has state: bits/lvl, map, map_type + * @mod_name: module name or null for all modules with the classes * * Enable/disable prdbgs by their class, as given in the arguments to * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative @@ -651,7 +659,9 @@ static int ddebug_apply_class_bitmap(const struct ddebu= g_class_param *dcp, * * Returns: 0 or <0 if error. */ -int param_set_dyndbg_classes(const char *instr, const struct kernel_param = *kp) +static int param_set_dyndbg_module_classes(const char *instr, + const struct kernel_param *kp, + const char *mod_name) { const struct ddebug_class_param *dcp =3D kp->arg; const struct ddebug_class_map *map =3D dcp->map; @@ -674,8 +684,8 @@ int param_set_dyndbg_classes(const char *instr, const s= truct kernel_param *kp) KP_NAME(kp), inrep, CLASSMAP_BITMASK(map->length)); inrep &=3D CLASSMAP_BITMASK(map->length); } - v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits); + v2pr_info("bits:0x%lx > %s.%s\n", inrep, mod_name ?: "*", KP_NAME(kp)); + totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, mod_name); *dcp->bits =3D inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -688,7 +698,7 @@ int param_set_dyndbg_classes(const char *instr, const s= truct kernel_param *kp) old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); new_bits =3D CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); - totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits); + totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, mod_name= ); *dcp->lvl =3D inrep; break; default: @@ -698,16 +708,33 @@ int param_set_dyndbg_classes(const char *instr, const= struct kernel_param *kp) vpr_info("%s: total matches: %d\n", KP_NAME(kp), totct); return 0; } + +/** + * param_set_dyndbg_classes - classmap kparam setter + * @instr: string echo>d to sysfs, input depends on map_type + * @kp: kp->arg has state: bits/lvl, map, map_type + * + * enable/disable all class'd pr_debugs in the classmap. For LEVEL + * map-types, enforce * relative levels by bitpos. + * + * Returns: 0 or <0 if error. + */ +int param_set_dyndbg_classes(const char *instr, const struct kernel_param = *kp) +{ + return param_set_dyndbg_module_classes(instr, kp, NULL); +} EXPORT_SYMBOL(param_set_dyndbg_classes); =20 /** - * param_get_dyndbg_classes - classes reader + * param_get_dyndbg_classes - classmap kparam getter * @buffer: string description of controlled bits -> classes * @kp: kp->arg has state: bits, map * - * Reads last written state, underlying prdbg state may have been - * altered by direct >control. Displays 0x for DISJOINT, 0-N for - * LEVEL Returns: #chars written or <0 on error + * Reads last written state, underlying pr_debug states may have been + * altered by direct >control. Displays 0x for DISJOINT classmap + * types, 0-N for LEVEL types. + * + * Returns: ct of chars written or <0 on error */ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp) { --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 DC5D7356758 for ; Sat, 23 May 2026 07:15:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520528; cv=none; b=B+ExqZp0NYwUiahlyXQBO8LjG5TFyFbCS+S6tHX2NR7GeIVWRl3ccR5HagDQVYiLRpZAHll2MsLNAVqbH/RyIMWtm/XDZRliv0hqONcXs6SiGd9KxM9XrVnvoNwEogD8piLK4+9LGk02S8jiRWAnWAC/zR5E9tVSaXNoo5Y+uC0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520528; c=relaxed/simple; bh=oDf+kcaqTHCY4oZq0wlCToRk1g2OukIAotS4exRWKPg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hCh7YMYn5MOFvGh8FRSMkHiMjqZJZPld8qjt9H8QgXX+xl6CebU4fVmKTRwiaOugyThx6mCBbdmKnfWsma0LYu7WIUSRZzsMhZZ35k1bwoFJn0NFSMvhEJMTGAPgoUd8F3dGLOPCD1QFJuhS1nM8nA+EGUeHQnlB3eMXLr3VTMo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CgStQzme; arc=none smtp.client-ip=209.85.128.41 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) header.d=gmail.com header.i=@gmail.com header.b="CgStQzme" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4891c00e7aeso57405105e9.2 for ; Sat, 23 May 2026 00:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520524; x=1780125324; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=9fSocxUrFxgAtDOXA0qj43u5TiXCLHTMOERYZLviDbw=; b=CgStQzmeggTBaA+GWM2J0nZsgEYp03aQZ0k2caQ2mzugIbOFmXnvDunOwYnk+mVRlq hLw9Ni6nk4YWOP6mlyuLw/ahmenK5zd1d7H4PJnHGK7SkXQmR1okr7T9cz3CGfX53fPP hpNwPVhaf7+jIbEarsF6J3xPzSXnP6pD4IjV3EZ5/uAfEggW6zKlxc6otuHuLU+lI7Md 3DqTR4QYb7T64u80TmuLkh92wJ8TagFH0yD9/OL6el9QkYexJUFtnPkmHbTtHwrEN8HM DQjqPYuiTB20/OwEepXbCjbRFsdPXsf5qh4ixK4gRtPonTa013xQ0th+/fWWhCDJUq+U 3owQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520524; x=1780125324; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=9fSocxUrFxgAtDOXA0qj43u5TiXCLHTMOERYZLviDbw=; b=DbjoY5SwAZASXym4rA5i4cnxiGqvnhc6aBWr9S7D7pnCIOAiOyDfXs5vhR/I+Bfq5I Vi3xbE0H6IevMHaxOJz+Lkw+hMCs1D8QXDrRFP85rCW3yAGitN7mlpzPSbRlty19GmtA v55DiQIQxIGptyG+rkN7BeHh5Gh7T/aGy+fsCKrdXb3azWk7H7AxUNdLwyd+UJ1B/6oc jpCRu2j0DdqaWUz3DUqsKgCrPF0UxPW7xxH7+JwhskEp97SYhkwpCyGVK54rAnyYOLvu x28KXCzlgMs2tX4oCiLbExlDW/fQmOmk0EtJ/d9u9jeX+OZGTc4RKhC06EdNp+mOaNZI t3yg== X-Forwarded-Encrypted: i=1; AFNElJ9Zn+0CYK4NS7RrMe2CwP2UkrW9c4Q4jXdZ4YEBnBtNx2cRw5E4nOA1NmYpcFdpSndEyiFmzdVYxDThHZY=@vger.kernel.org X-Gm-Message-State: AOJu0YxLOl7fAaCUOEe2YmqrQR8Nz35VaIymYb3OiV5OjIpC/PjdES6Q PeBm0blRACNKUQHnGCBPrYQRJa+0+6/9Qkrb8w0pkqogmWhS5EB0kA0i X-Gm-Gg: Acq92OG5K4rKbrdxcNRZNvfs+sfIuE2df9/Sdd+1ROTzTg13axjcm9rpGbkVvgULmWp AID7x7otHEMgQf4xyEqXFjLkbZ05egpywYpcMFBLdBETVj4cITnxDaST7Mpqbi+b3MzN6i9iRgG LIEutnQhwJ9/JSMtviBpUYSVWdMCGIQyi/X52resmRNZlSdslrY7Gpxj69eH9BsWsuKGF+7A/ET hlcclhCnsyC0pfB+FLQhiP7eyC8pmvXVCL1kFVQoK4WZPZxbOSpPp6y45bJd0JAlmi1jl8hl7BY 8JlwK3bLcrqc+NZDFvOtF0fPKy+lEwitrcKbp4CDFCtCdP6tS0gJpmwEZ/ku/4iYPOnbfQ7v5XJ zPwXUNzhNs+gRPKBSGsSC/p81M6esFVKhy5GndttK184jDFFMhh4Gj7N/Cr551Is7RkaLIvIo5A SeP1D1WOzI3qp9bUmE2LH5lFOczonk9NsEtaw6SMM= X-Received: by 2002:a05:600c:3b02:b0:489:201c:dc46 with SMTP id 5b1f17b1804b1-490424b2cf1mr100521625e9.12.1779520524386; Sat, 23 May 2026 00:15:24 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:23 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:48 -0600 Subject: [PATCH v2 15/24] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-15-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=2913; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=oDf+kcaqTHCY4oZq0wlCToRk1g2OukIAotS4exRWKPg=; b=HCNi//0D3/IXeC0ZirdAUlF8jXyXmVdu2JTJojhs2ocfT/641MBPamdbF6PbEXk5od5NoIqPk YdzUgjtOj5ABTvpfAP4WIHTqV3stIf54/YaYKL0n6FTRuGiv71OrVW5 X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= old_bits arg is currently a pointer to the input bits, but this could allow inadvertent changes to the input by the fn. Disallow this. And constify new_bits while here. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: move RvB after SoB --- lib/dynamic_debug.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index ce069459aafc..d4cce0f4f197 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -609,7 +609,8 @@ static int ddebug_exec_queries(char *query, const char = *modname) =20 /* apply a new class-param setting */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits, + const unsigned long *new_bits, + const unsigned long old_bits, const char *query_modname) { #define QUERY_SIZE 128 @@ -618,12 +619,12 @@ static int ddebug_apply_class_bitmap(const struct dde= bug_class_param *dcp, int matches =3D 0; int bi, ct; =20 - if (*new_bits !=3D *old_bits) + if (*new_bits !=3D old_bits) v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, - *old_bits, query_modname ?: "'*'"); + old_bits, query_modname ?: "'*'"); =20 for (bi =3D 0; bi < map->length; bi++) { - if (test_bit(bi, new_bits) =3D=3D test_bit(bi, old_bits)) + if (test_bit(bi, new_bits) =3D=3D test_bit(bi, &old_bits)) continue; =20 snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], @@ -635,9 +636,9 @@ static int ddebug_apply_class_bitmap(const struct ddebu= g_class_param *dcp, v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, ct, map->class_names[bi], *new_bits); } - if (*new_bits !=3D *old_bits) + if (*new_bits !=3D old_bits) v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, - *old_bits, query_modname ?: "'*'"); + old_bits, query_modname ?: "'*'"); =20 return matches; } @@ -685,7 +686,7 @@ static int param_set_dyndbg_module_classes(const char *= instr, inrep &=3D CLASSMAP_BITMASK(map->length); } v2pr_info("bits:0x%lx > %s.%s\n", inrep, mod_name ?: "*", KP_NAME(kp)); - totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, mod_name); + totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, *dcp->bits, mod_name); *dcp->bits =3D inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -698,7 +699,7 @@ static int param_set_dyndbg_module_classes(const char *= instr, old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); new_bits =3D CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); - totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, mod_name= ); + totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, old_bits, mod_name); *dcp->lvl =3D inrep; break; default: --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 9F171346A11 for ; Sat, 23 May 2026 07:15:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520532; cv=none; b=N0i+QH9KkYO42CTOn5G8s7U4j2vf12rMgICYXKhnJ2Hf18j+kvR88U4fa/O/QS93qAE1Ywe85Wx8fObdgKkzsDHj7HGU8KPuqABdl7sL8CZCnRQPZQjr5KtVxUaOROBSSzHf2HMUOXqGWv5z6Iwm+YsSmFamGLAglCWdKM2B0eE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520532; c=relaxed/simple; bh=acmpE5f+cy4H0euAd/sWLVbXBhuyRVdVfvkTY1QfTl8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y5e0cVVCiklvbX4qY+wWc1Mh3o0iYoG9KtQToxtLEJ6HFcnRUROwzw/t999tdNjfQONmunoslL+U5QMCttnBJ/j71DJuzOXoXzXMGhhzTkAjI+s4MOiMohz7Vod+3iZcystXb+NuDXg063JzgOEdIcH0KbnQMFS8ZrddwAiwUvs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mxxfzpKF; arc=none smtp.client-ip=209.85.221.53 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) header.d=gmail.com header.i=@gmail.com header.b="mxxfzpKF" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-43d73422431so5711995f8f.2 for ; Sat, 23 May 2026 00:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520529; x=1780125329; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Inkv515K3CDOqGmxKUbJA66Ndin1wkzy98GUXdhIoyc=; b=mxxfzpKFQLv/7ag+vvXGxDsuILctm7/pEpYZRMdTe5mKxLbRf0qYZ/gSm6r+PxjJy5 a+z2C0MXJcysZu3SMpV8t4X7A3zhccRscwiVXl4Fih2A7VuqVw5lFSmpJOMHxqhpLgPe PV9G4lECnPeeUX7LGSHPwcOX395GARUl1qibhbgmu+agawoQ+yObUByTs7URUSkd8uXB H5p0EqYIYa8A+YV9Y9YxjfPGNyzDdGTAZAzH8qLq5bE6qaow/aP0fC4pIU9lZa8bV3WZ Id68iJQAlgkbBcOvDqM2C2RUvMK+aXaIRpG7GY+lsRAQ3pWtFSsdgN53wTSn36UVJT5y yemg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520529; x=1780125329; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Inkv515K3CDOqGmxKUbJA66Ndin1wkzy98GUXdhIoyc=; b=Pn80A4eEDNEMWdthtN1sAglo+5B/KlZJIuTfuj8eg4iQU2MM+gqP1DY1sFNt53l8x4 SEewx3QwKwdiE9DXcWPdEEy2V0EKHwLMCAn6Arf/YLUqlKidTUgQ863Bhw+yjRpM031l AvyqM9wTgDQjVlan6sMJs4YuETVSLl0DFrlVFdQwsy69CyCAvfnTlurxLTKnIaXLvvJO pUYwEJ8XKNtMmLD6CBzwzizOV/T3uVil+thqgNF83YDipBBklJQfrxUhsYe2HiKfZM+Q tUF68J8RonvpfBje99kgE9vgQQOocvM6fxEGBc8qtlrJ0iASewWFVjntJOHHD2QHiw33 JZKg== X-Forwarded-Encrypted: i=1; AFNElJ+nBKtSgeUk9lT7KeWnPNzPNyz1VZot2demWF3D65MB6CfDvfcf1l9ubR3dloUrHwYFSJKVGvgM7ogbUNE=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+2E/vixc+il6INXogtWKawtFpzUrRpBc8unKVlr4KEOk03ZcA vTLLM0uou83gEBNVtCQAxg7kWyfh0+bXGFKSrgoHerVPKRWYwy5YJU1I X-Gm-Gg: Acq92OGVsEvOElZ8EM5u2EXUl0rNgOxF0Fal8z2Z2PgNy5SqD8ITzwkQ2sIHFZ1Vgx4 5TQ8fucSbuX67iNLupLKvbu8bWNUBkHMwJ/2NnKpVSt6pA3tWITRG/1FV79OxpIg+9OMu4CtvZh /8kyv4dOgzvJhqSBqJA46FKcte5eP2G1F0EcX3KqRbwhhEowtzMD1pmRAlPa5upTxU6x+A7CQJU NpvueG/8hS4CEpl2DBFhsJJNxWCwWpDtIiW63j6sY6RN+EQ/37b44C12PoJowtEUMY06A2VShcC MChRL6L+zMxp+ItkuGUfIRHnOymanjWC/60Inz7a6y9a+luMe3O/lGAa1gaQNwyb6P/a5ba3hN/ RmQIuYEcUQsk3d06E/0hLoONXwp3y8OGDmQGMcEwz4XFBvNryw9UIbNRZpXXDJrgdwbrX5HpGlX WZX0EZde/rGRJPmLqfM7AcRqmCfRJ/0QljobdRQmk= X-Received: by 2002:a05:6000:610:b0:45e:742c:f195 with SMTP id ffacd0b85a97d-45eb3690ba8mr10344352f8f.12.1779520526578; Sat, 23 May 2026 00:15:26 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:26 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:49 -0600 Subject: [PATCH v2 16/24] dyndbg: replace classmap list with an array-slice 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-16-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=6627; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=acmpE5f+cy4H0euAd/sWLVbXBhuyRVdVfvkTY1QfTl8=; b=+LlT89h5Zas1rnf6o1vCdzF04GdcJrVVBC0DVNyp/lojUnxHBDsi3KbK2sf4iEP6Z6JU0GAQD gRp8te91A/gDPQKNAolv23w1WGUsRCb95To3FYv6z7PAbLpnCZHB4aQ X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= Classmaps are stored in an elf section/array, but currently are individually list-linked onto dyndbg's per-module ddebug_table for operation. This is unnecessary. Just like dyndbg's descriptors, classes are packed in compile order; so even with many builtin modules employing multiple classmaps, each modules' maps are packed contiguously, and can be treated as a array-start-address & array-length. So this drops the whole list building operation done in ddebug_attach_module_classes(), and removes the list-head members of the classmap structs. The "select-by-modname" condition is reused to find the start,end of the subrange of classmaps belonging to the module. NOTES: There are multiple modules named "main" but thats an artifact of how KBUILD_MODNAME gets its value, and none of those repeats are contiguous. The legacy code segmenting the builtin descriptors depends upon this, we are "reusing" that dependency. The "filter-by-modname" on classmaps should really be done in ddebug_add_module(1); ie closer to dynamic_debug_init(2), which already splits up pr-debug descriptors into subranges by modname, then calls (1) on each. (2) knows nothing of classmaps currently, and doesn't need to. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: RvB after SoB --- include/linux/dynamic_debug.h | 1 - lib/dynamic_debug.c | 65 +++++++++++++++++++++++----------------= ---- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index e724f6b93663..0a137a586510 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -73,7 +73,6 @@ enum ddebug_class_map_type { }; =20 struct ddebug_class_map { - struct list_head link; struct module *mod; const char *mod_name; /* needed for builtins */ const char **class_names; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index d4cce0f4f197..7f03b331d185 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -46,10 +46,11 @@ extern struct ddebug_class_map __start___dyndbg_classes= []; extern struct ddebug_class_map __stop___dyndbg_classes[]; =20 struct ddebug_table { - struct list_head link, maps; + struct list_head link; const char *mod_name; - unsigned int num_ddebugs; struct _ddebug *ddebugs; + struct ddebug_class_map *classes; + unsigned int num_ddebugs, num_classes; }; =20 struct ddebug_query { @@ -150,12 +151,13 @@ static void vpr_info_dq(const struct ddebug_query *qu= ery, const char *msg) } =20 static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_tabl= e const *dt, - const char *class_string, int *class_id) + const char *class_string, + int *class_id) { struct ddebug_class_map *map; - int idx; + int i, idx; =20 - list_for_each_entry(map, &dt->maps, link) { + for (map =3D dt->classes, i =3D 0; i < dt->num_classes; i++, map++) { idx =3D match_string(map->class_names, map->length, class_string); if (idx >=3D 0) { *class_id =3D idx + map->base; @@ -166,7 +168,6 @@ static struct ddebug_class_map *ddebug_find_valid_class= (struct ddebug_table cons return NULL; } =20 -#define __outvar /* filled by callee */ /* * Search the tables for _ddebug's which match the given `query' and * apply the `flags' and `mask' to them. Returns number of matching @@ -228,7 +229,7 @@ static int ddebug_change(const struct ddebug_query *que= ry, unsigned int nfound =3D 0; struct flagsbuf fbuf, nbuf; struct ddebug_class_map *map =3D NULL; - int __outvar valid_class; + int valid_class; =20 /* search for matching ddebugs */ mutex_lock(&ddebug_lock); @@ -1061,9 +1062,10 @@ static void *ddebug_proc_next(struct seq_file *m, vo= id *p, loff_t *pos) =20 static const char *ddebug_class_name(struct ddebug_iter *iter, struct _dde= bug *dp) { - struct ddebug_class_map *map; + struct ddebug_class_map *map =3D iter->table->classes; + int i, nc =3D iter->table->num_classes; =20 - list_for_each_entry(map, &iter->table->maps, link) + for (i =3D 0; i < nc; i++, map++) if (class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; =20 @@ -1147,30 +1149,34 @@ static const struct proc_ops proc_fops =3D { .proc_write =3D ddebug_proc_write }; =20 -static void ddebug_attach_module_classes(struct ddebug_table *dt, - struct ddebug_class_map *classes, - int num_classes) +static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _= ddebug_info *di) { struct ddebug_class_map *cm; - int i, j, ct =3D 0; + int i, nc =3D 0; =20 - for (cm =3D classes, i =3D 0; i < num_classes; i++, cm++) { + /* + * Find this module's classmaps in a subrange/wholerange of + * the builtin/modular classmap vector/section. Save the start + * and length of the subrange at its edges. + */ + for (cm =3D di->classes, i =3D 0; i < di->num_classes; i++, cm++) { =20 if (!strcmp(cm->mod_name, dt->mod_name)) { - - v2pr_info("class[%d]: module:%s base:%d len:%d ty:%d\n", i, - cm->mod_name, cm->base, cm->length, cm->map_type); - - for (j =3D 0; j < cm->length; j++) - v3pr_info(" %d: %d %s\n", j + cm->base, j, - cm->class_names[j]); - - list_add(&cm->link, &dt->maps); - ct++; + if (!nc) { + v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n= ", + i, cm->mod_name, cm->base, cm->length, cm->map_type); + dt->classes =3D cm; + } + nc++; + } else if (nc) { + /* end of matching classmaps */ + break; } } - if (ct) - vpr_info("module:%s attached %d classes\n", dt->mod_name, ct); + if (nc) { + dt->num_classes =3D nc; + vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + } } =20 /* @@ -1202,10 +1208,9 @@ static int ddebug_add_module(struct _ddebug_info *di= , const char *modname) dt->num_ddebugs =3D di->num_descs; =20 INIT_LIST_HEAD(&dt->link); - INIT_LIST_HEAD(&dt->maps); =20 if (di->classes && di->num_classes) - ddebug_attach_module_classes(dt, di->classes, di->num_classes); + ddebug_attach_module_classes(dt, di); =20 mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); @@ -1318,8 +1323,8 @@ static void ddebug_remove_all_tables(void) mutex_lock(&ddebug_lock); while (!list_empty(&ddebug_tables)) { struct ddebug_table *dt =3D list_entry(ddebug_tables.next, - struct ddebug_table, - link); + struct ddebug_table, + link); ddebug_table_free(dt); } mutex_unlock(&ddebug_lock); --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 400D835F5F3 for ; Sat, 23 May 2026 07:15:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520534; cv=none; b=mWPisnl70fq6K2VXPBreub5G3PtPPjkXhpMZGIV7KaYpF8lwB65nOfYUAX6jsGz9CI90SM4NBbvkESmwXmvPMfx7FtiZJQ2SQyNQIC5CK7ya5bXVeP96g0JwC2wXN/G8KHyGyhGOotjT3f8l/6js9YpdsIWdjUvDFh8DNh1zVVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520534; c=relaxed/simple; bh=IcYsAkjYk+uuIclQHpJnOMdkt8o2M7E29sb0avD+z5Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rjmqXNOb5TXyz6XTLpjGrD32rL1v5xGXc/lX3BcqxWFlAbRy9GPKQeSQoTUHJxU0VugZOuDIODDnuMmfWjuTN8N39JI7L2S5/RVnze+HzcMTuk4+tOVTCd9u+Rp9UBmWbjNydow/EPKgY3F2IXDcxoWuOr52yw5BmNKa/ZiVDCg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=D8JSr5C9; arc=none smtp.client-ip=209.85.221.49 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) header.d=gmail.com header.i=@gmail.com header.b="D8JSr5C9" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-44a5174670eso4708052f8f.1 for ; Sat, 23 May 2026 00:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520530; x=1780125330; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pDOYX2d+BKhaTTyw2PdfR5N/FD2dwrYDYgB1Q3ey6Ms=; b=D8JSr5C9WoHEXJvYIjqi4bTBRBV/9xNIiIveJ1TgRSTyt/EX8N/h+XUH1KwCBTTp/E BzFfjNt/1GZ9Mp9yQevC39464z9K3lmW1KZxbOtgA9H0Jp76uDjXqXvTzeCdzXNTR7+V i/Hx4kIZy5v8h/ZoDo/5u+21xEbRkSzcxKj3wVaWhHH4taC5eDI+SHzgQA6gqJSqCwmI CkHtmCaS5bQaOplrrcL2xS8WJRLWBCH2GuLKeGtOjD/PB8m4pyikVHEzcx70IfT7sY2z 8xXCgAvO4LhBg+qpnQfNBYAN2In1hYWwtoWid/MBHGqr4jLYn/YKYaZIwL+GiMuS0Shc J4fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520530; x=1780125330; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=pDOYX2d+BKhaTTyw2PdfR5N/FD2dwrYDYgB1Q3ey6Ms=; b=Wm363JHkMhKMgwuSNLKkJoATCnSs/Z8dGZTc7qpp2UkaVOFPxqjU4trQxqnndkPJms mKo0EKrRl6AB78UUQqMzfJt8Pt6nd3wpX8iE039pQozZ519TG3j0SwTtHbYuRYVEk8Lo TNkMVE4Je4OMU+R1y6zSO1HtLUKZwAVLvqLKG1u/fPj+2gmyzwHZWN1cL01/z72Om1Bc 6tNR+60EWb3TjF0QaG9Nutu1fBG6LEzkMOkVAVFS5c6+NjYN6cm1naY+Tozqtt4ghAnY NbIRHgSt6lBL42HF1Xw9xLxOCFzR+urPqXgi0jT6ctotj23xOM3uG55BtxIZ51xOPaQO BhZg== X-Forwarded-Encrypted: i=1; AFNElJ8Eme5AG52cjlpZB09eh/XXEXsukIwXGStnwMF1C5jx8W6RYqtIqzxsV4qN6X4dq0nJySoEIqu7eBycZtE=@vger.kernel.org X-Gm-Message-State: AOJu0YzWTEWxKxInX3MbDLcMJaznLIyYY/nlWTWRSsoFTpycJQIrxtCV niVdcxaQHaaXlFi6lg35xA+ZqlrUou71lFfebfH6sxZN67OjjSG16WPA X-Gm-Gg: Acq92OFTCL5cCmUDA4T7eucmcm6qSs3WD8EWJEgPaLmLP/0Sux1YWELNsP/Y6scDE6e DsoEIh/rjdLTNTMh5132vW+Acb0gMUn6ppYWUCggZtegmv4aG+jiT8nM0lZ5xd8/+hqLtFP8cDw mrEgsbpPlUu9LJTW16+jCo2mLLz7T2y/qOCfhNuRfOkwCo40Xs/Vz2vBHolypBAGoEXfzZIEMGb KYAPwBs+7Ha0T0YK+C7+hIbmqAqhtXFg4sWtQaINfpqEEnpQKupZESuxtZroxY+KJjeFzj8lFcO UEsx8xjl4JVFBzF/OSZOuJjpzvOiXCHCVyhsvtlFXZ+V16I6YyCHJkW0qW/ldPLa4IVQa4KfFgl 5O+J3E9dtDy1cfz9gS+fHBb5TsDAdjoAeYnN7gaqQS2t9PVqMY0INpIMb9Rl9s8m3zQpTDg+5Ho o/8cjkBBSwIwYE5DEeScrD53bfEsx8 X-Received: by 2002:a5d:5f8d:0:b0:43d:71f4:7ed4 with SMTP id ffacd0b85a97d-45eb368206cmr11355026f8f.15.1779520530539; Sat, 23 May 2026 00:15:30 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:29 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:50 -0600 Subject: [PATCH v2 17/24] dyndbg: macrofy a 2-index for-loop pattern 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-17-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=2772; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=IcYsAkjYk+uuIclQHpJnOMdkt8o2M7E29sb0avD+z5Q=; b=DSaOdL6/jQ5YJqm3Wtd/v9vl7sBYDaCKynhQOcWgxX0DOYt6uiNlbXyVZEYxlh8Mx6/zJ2QHU 3ndgCMMLJ68CdKl3OWiPBufHpGCMCOGE5M+QvMfjnN8/xUiv+axEwat X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= dynamic-debug currently has 2 __sections (__dyndbg, __dyndb_classes), struct _ddebug_info keeps track of them both, with 2 members each: _vec and _vec#_len. We need to loop over these sections, with index and record pointer, making ref to both _vec and _vec_len. This is already fiddly and error-prone, and will get worse as we add a 3rd section. Lets instead embed/abstract the fiddly-ness in the `for_subvec()` macro, and avoid repeating it going forward. This is a for-loop macro expander, so it syntactically expects to precede either a single statement or a { block } of them, and the usual typeof or do-while-0 tricks are unavailable to fix the multiple-expansion warning. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: move RvB after SoB --- lib/dynamic_debug.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 7f03b331d185..e9481ef21825 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -130,6 +130,20 @@ do { \ #define v3pr_info(fmt, ...) vnpr_info(3, fmt, ##__VA_ARGS__) #define v4pr_info(fmt, ...) vnpr_info(4, fmt, ##__VA_ARGS__) =20 +/* + * simplify a repeated for-loop pattern walking N steps in a T _vec + * member inside a struct _box. It expects int i and T *_sp to be + * declared in the caller. + * @_i: caller provided counter. + * @_sp: cursor into _vec, to examine each item. + * @_box: ptr to a struct containing @_vec member + * @_vec: name of a member in @_box + */ +#define for_subvec(_i, _sp, _box, _vec) \ + for ((_i) =3D 0, (_sp) =3D (_box)->_vec; \ + (_i) < (_box)->num_##_vec; \ + (_i)++, (_sp)++) /* { block } */ + static void vpr_info_dq(const struct ddebug_query *query, const char *msg) { /* trim any trailing newlines */ @@ -157,7 +171,7 @@ static struct ddebug_class_map *ddebug_find_valid_class= (struct ddebug_table cons struct ddebug_class_map *map; int i, idx; =20 - for (map =3D dt->classes, i =3D 0; i < dt->num_classes; i++, map++) { + for_subvec(i, map, dt, classes) { idx =3D match_string(map->class_names, map->length, class_string); if (idx >=3D 0) { *class_id =3D idx + map->base; @@ -1159,8 +1173,7 @@ static void ddebug_attach_module_classes(struct ddebu= g_table *dt, struct _ddebug * the builtin/modular classmap vector/section. Save the start * and length of the subrange at its edges. */ - for (cm =3D di->classes, i =3D 0; i < di->num_classes; i++, cm++) { - + for_subvec(i, cm, di, classes) { if (!strcmp(cm->mod_name, dt->mod_name)) { if (!nc) { v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n= ", --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 C1EF0360722 for ; Sat, 23 May 2026 07:15:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520536; cv=none; b=jk+WuR+y/Poxf4ZRptfxgo5HYYAOITuvS5lfVdRwIINhifT4iguUnr+9xIg8p3P9uROEvPZTPV3JSyVHiY4fGYXXlXvaxUd1eghSSusW6PvzMuvbXuQUENJW0noosjCHFlxVCQraH8x8aiwFvAyO7UxGRkHvBCSssXFojAFTGFM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520536; c=relaxed/simple; bh=OzV7Wj7oJumeYJuXzDM4oh65TQwzCkr22zEagik33WM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g3uKOKM5fXTV/IyNJAT3CEl587Z253A8q6S6qecaKFbTOxS4h9goyiZDspsoLFzyiR3bnD18xBT5KOeyo4nI2O/vpHXIlRGVV3HFAsyW4vSaZIUcgxrR0eB9NKaOvdePCaulvNnaXZukqyk5cHrNOTwUuX7tJK/8aHo8vXYCsl4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FFLLWlXt; arc=none smtp.client-ip=209.85.221.48 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) header.d=gmail.com header.i=@gmail.com header.b="FFLLWlXt" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-45e6a4d0be0so3571101f8f.1 for ; Sat, 23 May 2026 00:15:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520532; x=1780125332; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=eCuMXDkXIzjpCTc97wh1wqHbLxz3MXCZGl5F5Zzn1NY=; b=FFLLWlXt4KtaWdZc/ib2+yFfxPsnFCmx5w22RpX3KWrGCVZa4dmuk4oahNTVoHvy2q GMOGPdSm9QqjQ9DqfLTK6sZKYR0JVEk3re8MTMWIvBsm/8so0mYzJkRtyztO6M3kLDX+ 1ezugcIsr9ifUKOGlz31WLnJg+R1Dyro+lMnciFGdjHBo8spx7ZZcl9LqYGjdOJYAYxg yP7l8tPF92U1wE2uRdfkJ5WNVA5+zm+tQZT7ldqMT1xGseI1NLfEC5tne1UiXhuKhMd2 IhdTSvvIT69uAJ+NqJgO2VekBDNnC+iBOGO1UQy0icC1YyrlNmcPAuHuSooWPCoQo0v8 wWqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520532; x=1780125332; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=eCuMXDkXIzjpCTc97wh1wqHbLxz3MXCZGl5F5Zzn1NY=; b=CtWEgyprlhn7jIpRR3+aMoI/Bz7Jc7WmxQLVafXCMW4xEnvV+lJ7EHrCbGUCxg5Ptt SzzrfKqqhbqq7yRoznTdwmylvUE3dZnwI8DRYT7nKZPquwA/evcc1YLGyzhQ5sy8v+Kz KChMDqG8OUEzWabBjOk9UtLYvyeNu+d6N2AN4AHZHMaiqTxTeMnqgazSadTgAEPIBjlG 8S37b/NHMq/O1A6wAa7f9d9EfU3WzajgbCkRYHIWs5J4DPil+Yp94/yCqkX4gKjY1u1h BIui21DW64rTsa9otXNBQEzOh2JBL+UGlQ4FMf1mOJirCkjgqYTF3ws6f689WasHXWWB ZLYQ== X-Forwarded-Encrypted: i=1; AFNElJ+C+/wFj9BfLZztkXRRtSk+152i9Vho4DGU3BK+KIyBZzSfMP906hSqAlqs6JnLR6W/A9WnR12iQrgZG1k=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8kVwk/VRFmopnB4vMoCCPmjDwhJtDGlZPVc80cYXp9WGCFFUD 9Rs0YDOjdK3F+H1Q4cbtV53u2SRBIa+MTS69wuMP9wZUPdpdFLKpT5Ev X-Gm-Gg: Acq92OHDKq3w+HNigz5+CpW2CRP72+vxsMD9e3SP1UmJBMLxY8ZCChls98PluW8/Kzo ClyGqABrZj7qtoPltozI/9JnK7ehPjcQGrWzxvlvVhPPzSwQNdIS5EYHJcSnSu0HN/MlUio94sd LCGxkqPpMZVl/Cqmy8u8ps3YgZJeookcFcPB/hY6Xga1KS9CTK/PW5eiNmFTfcmP5+jxW7n8LIU frfvolcwbgvjibJSIF2s7O00C9hU1BCdhJJOvGnrxu4EYScv6e6OIAxIUb4gB6+5DfkPAETGzKJ HRfH8VAgFBijm4ZSATQnt68Z5d9WAaJq4oXHppn60/aSfE4W4lm6qDpx9xBP203+KyNkUsVyMYH 4ArQG5dqtswGM4jOoB7EPOEW1usT9+mhfCBShK44BZ4I+NRDpyXgFHMdf19SbtBPfxWRjnjGjZV 3AY5iEKdtZ4wrcDEKFvWXSBBInDueG X-Received: by 2002:a05:6000:178c:b0:43d:6f0f:32fe with SMTP id ffacd0b85a97d-45eb38b86demr11280922f8f.31.1779520532028; Sat, 23 May 2026 00:15:32 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:31 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:51 -0600 Subject: [PATCH v2 18/24] dyndbg: Upgrade class param storage to u64 for 64-bit classmaps 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-18-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=6869; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=OzV7Wj7oJumeYJuXzDM4oh65TQwzCkr22zEagik33WM=; b=LP638XLB1aeVh+3q5CiEQF4ZWen0Za4VMp4vR/HZBfsuqp+oK1zODgDypmx5msqiuyp7M1VR0 JuqTuQmRBqdCxw9TqUHEf0ZZ9ewWHyNw2Br32oXFXFQhbAsYB9tFNF+ X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= Currently, `struct ddebug_class_param` uses `unsigned long` pointers to store the state of `bits` and `lvl`. On 32-bit architectures, this limits the bit-vector to 32 bits, which truncates 64-bit classmaps (such as the one needed by `__drm_debug`). To guarantee support for 64-bit debug categories across all architectures, upgrade the internal storage types in `struct _ddebug_class_param` to `u64`. This inherently makes both union members the same size while safely avoiding truncation. This includes: - Changing union members `bits` and `lvl` to `u64 *`. - Using `kstrtou64()` for sysfs input parsing. - Replacing array-based `test_bit()` operations with safe `u64` scalar bitwise logic (`!!(val & (1ULL << bi))`). - adjusting lib/test_dynamic_debug.c too Not yet done: - Updating `drm_print`'s `__drm_debug` to `u64` and configuring the associated module parameter as `ullong`. - Fixing an unused variable warning in `__drm_printfn_dbg`. Signed-off-by: Jim Cromie --- v2: patch was "make bits & lvl same size" but that size was unsigned long, only 32 bits on i386 etc use u64 for all bits, and %llu %llx --- include/linux/dynamic_debug.h | 4 ++-- lib/dynamic_debug.c | 34 ++++++++++++++++++---------------- lib/test_dynamic_debug.c | 2 +- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 0a137a586510..a84dcc127e5a 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -91,8 +91,8 @@ struct _ddebug_info { =20 struct ddebug_class_param { union { - unsigned long *bits; - unsigned int *lvl; + u64 *bits; + u64 *lvl; }; char flags[8]; const struct ddebug_class_map *map; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index e9481ef21825..580aa258f902 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -624,8 +624,7 @@ static int ddebug_exec_queries(char *query, const char = *modname) =20 /* apply a new class-param setting */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - const unsigned long *new_bits, - const unsigned long old_bits, + const u64 *new_bits, const u64 old_bits, const char *query_modname) { #define QUERY_SIZE 128 @@ -635,24 +634,27 @@ static int ddebug_apply_class_bitmap(const struct dde= bug_class_param *dcp, int bi, ct; =20 if (*new_bits !=3D old_bits) - v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + v2pr_info("apply bitmap: 0x%llx to: 0x%llx for %s\n", *new_bits, old_bits, query_modname ?: "'*'"); =20 for (bi =3D 0; bi < map->length; bi++) { - if (test_bit(bi, new_bits) =3D=3D test_bit(bi, &old_bits)) + bool new_b =3D !!(*new_bits & (1ULL << bi)); + bool old_b =3D !!(old_bits & (1ULL << bi)); + + if (new_b =3D=3D old_b) continue; =20 snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], - test_bit(bi, new_bits) ? '+' : '-', dcp->flags); + new_b ? '+' : '-', dcp->flags); =20 ct =3D ddebug_exec_queries(query, query_modname); matches +=3D ct; =20 - v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, + v2pr_info("bit_%d: %d matches on class: %s -> 0x%llx\n", bi, ct, map->class_names[bi], *new_bits); } if (*new_bits !=3D old_bits) - v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + v2pr_info("applied bitmap: 0x%llx to: 0x%llx for %s\n", *new_bits, old_bits, query_modname ?: "'*'"); =20 return matches; @@ -661,7 +663,7 @@ static int ddebug_apply_class_bitmap(const struct ddebu= g_class_param *dcp, /* stub to later conditionally add "$module." prefix where not already don= e */ #define KP_NAME(kp) kp->name =20 -#define CLASSMAP_BITMASK(width) ((1UL << (width)) - 1) +#define CLASSMAP_BITMASK(width) ((1ULL << (width)) - 1) =20 /** * param_set_dyndbg_classes - class FOO >control @@ -681,10 +683,10 @@ static int param_set_dyndbg_module_classes(const char= *instr, { const struct ddebug_class_param *dcp =3D kp->arg; const struct ddebug_class_map *map =3D dcp->map; - unsigned long inrep, new_bits, old_bits; + u64 inrep, new_bits, old_bits; int rc, totct =3D 0; =20 - rc =3D kstrtoul(instr, 0, &inrep); + rc =3D kstrtou64(instr, 0, &inrep); if (rc) { int len =3D strcspn(instr, "\n"); pr_err("expecting numeric input, not: %.*s > %s\n", @@ -696,24 +698,24 @@ static int param_set_dyndbg_module_classes(const char= *instr, case DD_CLASS_TYPE_DISJOINT_BITS: /* expect bits. mask and warn if too many */ if (inrep & ~CLASSMAP_BITMASK(map->length)) { - pr_warn("%s: input: 0x%lx exceeds mask: 0x%lx, masking\n", + pr_warn("%s: input: 0x%llx exceeds mask: 0x%llx, masking\n", KP_NAME(kp), inrep, CLASSMAP_BITMASK(map->length)); inrep &=3D CLASSMAP_BITMASK(map->length); } - v2pr_info("bits:0x%lx > %s.%s\n", inrep, mod_name ?: "*", KP_NAME(kp)); + v2pr_info("bits:0x%llx > %s.%s\n", inrep, mod_name ?: "*", KP_NAME(kp)); totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, *dcp->bits, mod_name); *dcp->bits =3D inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: /* input is bitpos, of highest verbosity to be enabled */ if (inrep > map->length) { - pr_warn("%s: level:%ld exceeds max:%d, clamping\n", + pr_warn("%s: level:%llu exceeds max:%d, clamping\n", KP_NAME(kp), inrep, map->length); inrep =3D map->length; } old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); new_bits =3D CLASSMAP_BITMASK(inrep); - v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); + v2pr_info("lvl:%llu bits:0x%llx > %s\n", inrep, new_bits, KP_NAME(kp)); totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, old_bits, mod_name); *dcp->lvl =3D inrep; break; @@ -759,9 +761,9 @@ int param_get_dyndbg_classes(char *buffer, const struct= kernel_param *kp) =20 switch (map->map_type) { case DD_CLASS_TYPE_DISJOINT_BITS: - return scnprintf(buffer, PAGE_SIZE, "0x%lx\n", *dcp->bits); + return scnprintf(buffer, PAGE_SIZE, "0x%llx\n", *dcp->bits); case DD_CLASS_TYPE_LEVEL_NUM: - return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl); + return scnprintf(buffer, PAGE_SIZE, "%llu\n", *dcp->lvl); default: return -1; } diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index 74d183ebf3e0..c049580d2152 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -40,7 +40,7 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 06= 00); * - tie together sysname, mapname, bitsname, flagsname */ #define DD_SYS_WRAP(_model, _flags) \ - static unsigned long bits_##_model; \ + static u64 bits_##_model; \ static struct ddebug_class_param _flags##_model =3D { \ .bits =3D &bits_##_model, \ .flags =3D #_flags, \ --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 67A87361DCB for ; Sat, 23 May 2026 07:15:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520539; cv=none; b=FEgsAz74zv0BuArYMBlmEnPmy11EyIG4MneFInU50yOC8ThxdbuxQ5Iyzlg8N6P9oXp0UNHM7pucP/TedA2UtyFsJukpFhIJFCPzjtBzq9ChOwknEJN2Bg7N//ENDHWEkS/rJKSdWi/h2ulkNVaVUaLz8/cKERv+OB0NqRPPEmE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520539; c=relaxed/simple; bh=3xCQ7ARY8EG6D0xJZef7o3dIrR1jAvXpEWEFuP8QcaM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oNHfHqiwdfcjuku5k15+UL8KGW8JpwOOOm1+M7oPleaSeBUsydg25SF+RSlWjhYSbluHi0dv/rHpFswRTOXR6mDADfZpm83TAK1JGljkREVsbznPRUUBaBGZ+93C5xvunS8yUDEDsSK2zvtBdRlh8OeTDBJANML5Z9QRoSmOorE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FZsIZ1OT; arc=none smtp.client-ip=209.85.221.43 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) header.d=gmail.com header.i=@gmail.com header.b="FZsIZ1OT" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-449d6c68ed8so4622750f8f.0 for ; Sat, 23 May 2026 00:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520534; x=1780125334; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Sy8gGAp3L7DwF7H8BtzsFB1MicHEAS/0kHGy6ARmZSE=; b=FZsIZ1OTRv8bwCUIHwARD9ql2PC2kKy48R+35JZENIBWC6VulklWo7Dp96nwv0sShp 7Lr+J9/SCJIq5rZl1EUP0HgVOD94s7rgU+7ADdoFRB88IPUVfAkqJmo3MkSjJDqMY5Xy dZYQr/w7MVB6Y/k9Jx4U0+Sx2kaoEGXUXaanGVPBCAB0/TxAAV5qLh4UqzBJfDTQNTFi ueoPGs6+99Z4wDahx8/HDEI7/0LdPve5WaEiRrNXZV41fcsgyCT6xwfaQ7Yo3Q3AmeHG qBPwKEYCkSg6VXQuoIwjGA3FkTLpMS16/MK1RpWDbmHdlj8YYG91OswI2EV+f7e6ojvE Ndcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520534; x=1780125334; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Sy8gGAp3L7DwF7H8BtzsFB1MicHEAS/0kHGy6ARmZSE=; b=NjBi9C4b0AVmrXYV/89Ksx/AVU8XnHBaJsIeQdAv4zaEcMO7kN5JWVXGIcAh9bsIet Kv0nfpw7xkb4Gs0/MPzL2NYGC/Q5LF8F3i9IgkK0S4/yo6qHOyGIQpGBX1ai1yQHIdNk 8TeiZaq6+4p0NDCkGstLi0p2Q5Xk1GtH8Nc82kwXRSL1KbC+OyZ7eIOOak11+5uVXLwh QBftpUgsGRtprhKbmix2PxcfTvOzPWWxCmpnVACbQdNeYt7dcjBdCgYR0r+Q3ABqUEh1 BUdwiF9K1ZDJLvZfvGcPx99FDo50YAlLAYZj6isR+nSjSk4O9npY4e+JCQ7htjiSkiqj 9/LA== X-Forwarded-Encrypted: i=1; AFNElJ9t/RJKXCjjCbRB/a8xAJmcWs2/JUTUYqWzjRq4EKeKKNOqH8Dq6myKK8TJWgPHx8SUEvPAESz0134jYps=@vger.kernel.org X-Gm-Message-State: AOJu0YxwgL5y9iza7laOGXRX5D9Qb05f6tbn9pWcOeibsA/QfDtN50OX pYzZHBPA+nFOG8wa5vJQS1LlBV/OJr7b9Qskh592jmitHkC1UazKhyzb X-Gm-Gg: Acq92OEf4jTkW+j0z9Isk3cK6WG3O+6In9MdXJAEwA+iL3gbITqYEnSmCMCgawUrC4C kdF2K7ZHVTP7YWTfwDu6bGq/2wae9WyNp4oDXScQwEOWiD4X6wXUwUFWwStBb00Uagt+YTA2KFk mVZ4QsyKd85gsAnve9H2b977EXcmG6GzZGdN33w0jB86HoE7hGo9u350uvCJrVZ7v8Uk48WvrXd 5cPurcOJa4CytoDPzUHvmsXm1fLFB1NIMRJDSUwBnAlu43PdvlwMMCZZqzcedEmeXDKW/CMYUi5 sFRzxKqtzYzSG9fHiFdkewQU9eIZmbpavfd84U076W0Kx1idFHeQ7IRSGttZ2u3xT/2d0XKxT2u TvUuIZsuoTI4HmbjKchVMT6E5FfrALKukC9n880j/oLwCFYGXaSkTuk9Bad1L+GIEA7lXJooKb2 tOvapjlIkQYlYo1VCz9jBdkQe94IBk X-Received: by 2002:adf:e00c:0:20b0:45e:8526:7dd7 with SMTP id ffacd0b85a97d-45eb38b38e0mr8015591f8f.27.1779520533629; Sat, 23 May 2026 00:15:33 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:33 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:52 -0600 Subject: [PATCH v2 19/24] dyndbg,module: make proper substructs in _ddebug_info 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-19-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=16030; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=3xCQ7ARY8EG6D0xJZef7o3dIrR1jAvXpEWEFuP8QcaM=; b=Xa+8hf7Yp5GD7uXlEQstLVfZSrrgH5OU8wOsdCYqNJBs9GqR2vi1nuicSMZn2iwmzMv3jRzEQ j3VHUtffObkDWti0aSgBjKmdDDwqUwA1h2zMezpmTmlxwnZQZkBYI4d X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= recompose struct _ddebug_info, inserting proper sub-structs. The struct _ddebug_info has 2 pairs of _vec, num_##_vec fields, for descs and classes respectively. for_subvec() makes walking these vectors less cumbersome, now lets move those field pairs into their own "vec" structs: _ddebug_descs & _ddebug_class_maps, and re-compose struct _ddebug_info to contain them cleanly. This also lets us get rid of for_subvec()'s num_##_vec paste-up. Also recompose struct ddebug_table to contain a _ddebug_info. This reinforces its use as a cursor into relevant data for a builtin module, and access to the full _ddebug state for modules. NOTES: Fixup names: Normalize all struct names to "struct _ddebug_*" eliminating the minor/stupid variations created in classmaps-v1. Invariant: These vectors ref a contiguous subrange of __section memory in builtin/DATA or in loadable modules via mod->dyndbg_info; with guaranteed life-time for us. struct module contains a _ddebug_info field and module/main.c sets it up, so that gets adjusted rather obviously. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: Move RvB after SoB In structs _ddebug_descs & _ddebug_class_maps, change int length to unsigne= d int No use of <0 vals is contemplated. --- include/linux/dynamic_debug.h | 36 ++++++++++----- kernel/module/main.c | 12 ++--- lib/dynamic_debug.c | 104 +++++++++++++++++++++-----------------= ---- lib/test_dynamic_debug.c | 2 +- 4 files changed, 83 insertions(+), 71 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index a84dcc127e5a..001bc84eadca 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -72,8 +72,8 @@ enum ddebug_class_map_type { */ }; =20 -struct ddebug_class_map { - struct module *mod; +struct _ddebug_class_map { + struct module *mod; /* NULL for builtins */ const char *mod_name; /* needed for builtins */ const char **class_names; const int length; @@ -81,21 +81,33 @@ struct ddebug_class_map { enum ddebug_class_map_type map_type; }; =20 -/* encapsulate linker provided built-in (or module) dyndbg data */ +/* + * @_ddebug_info: gathers module/builtin dyndbg_* __sections together. + * For builtins, it is used as a cursor, with the inner structs + * marking sub-vectors of the builtin __sections in DATA. + */ +struct _ddebug_descs { + struct _ddebug *start; + unsigned int len; +}; + +struct _ddebug_class_maps { + struct _ddebug_class_map *start; + unsigned int len; +}; + struct _ddebug_info { - struct _ddebug *descs; - struct ddebug_class_map *classes; - unsigned int num_descs; - unsigned int num_classes; + struct _ddebug_descs descs; + struct _ddebug_class_maps maps; }; =20 -struct ddebug_class_param { +struct _ddebug_class_param { union { u64 *bits; u64 *lvl; }; char flags[8]; - const struct ddebug_class_map *map; + const struct _ddebug_class_map *map; }; =20 /* @@ -114,7 +126,7 @@ struct ddebug_class_param { */ #define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ static const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ - static struct ddebug_class_map __aligned(8) __used \ + static struct _ddebug_class_map __aligned(8) __used \ __section("__dyndbg_classes") _var =3D { \ .mod =3D THIS_MODULE, \ .mod_name =3D KBUILD_MODNAME, \ @@ -242,7 +254,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, * macro. */ #define _dynamic_func_call_cls(cls, fmt, func, ...) \ - __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS_= _) + __dynamic_func_call_cls(__UNIQUE_ID(_ddebug), cls, fmt, func, ##__VA_ARGS= __) #define _dynamic_func_call(fmt, func, ...) \ _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__) =20 @@ -252,7 +264,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, * with precisely the macro's varargs. */ #define _dynamic_func_call_cls_no_desc(cls, fmt, func, ...) \ - __dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \ + __dynamic_func_call_cls_no_desc(__UNIQUE_ID(_ddebug), cls, fmt, \ func, ##__VA_ARGS__) #define _dynamic_func_call_no_desc(fmt, func, ...) \ _dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \ diff --git a/kernel/module/main.c b/kernel/module/main.c index 46dd8d25a605..c2b6e70f2e77 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2774,12 +2774,12 @@ static int find_module_sections(struct module *mod,= struct load_info *info) pr_warn("%s: Ignoring obsolete parameters\n", mod->name); =20 #ifdef CONFIG_DYNAMIC_DEBUG_CORE - mod->dyndbg_info.descs =3D section_objs(info, "__dyndbg", - sizeof(*mod->dyndbg_info.descs), - &mod->dyndbg_info.num_descs); - mod->dyndbg_info.classes =3D section_objs(info, "__dyndbg_classes", - sizeof(*mod->dyndbg_info.classes), - &mod->dyndbg_info.num_classes); + mod->dyndbg_info.descs.start =3D section_objs(info, "__dyndbg_descriptors= ", + sizeof(*mod->dyndbg_info.descs.start), + &mod->dyndbg_info.descs.len); + mod->dyndbg_info.maps.start =3D section_objs(info, "__dyndbg_class_maps", + sizeof(*mod->dyndbg_info.maps.start), + &mod->dyndbg_info.maps.len); #endif =20 return 0; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 580aa258f902..169b94ff6f8e 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -42,15 +42,13 @@ =20 extern struct _ddebug __start___dyndbg[]; extern struct _ddebug __stop___dyndbg[]; -extern struct ddebug_class_map __start___dyndbg_classes[]; -extern struct ddebug_class_map __stop___dyndbg_classes[]; +extern struct _ddebug_class_map __start___dyndbg_classes[]; +extern struct _ddebug_class_map __stop___dyndbg_classes[]; =20 struct ddebug_table { struct list_head link; const char *mod_name; - struct _ddebug *ddebugs; - struct ddebug_class_map *classes; - unsigned int num_ddebugs, num_classes; + struct _ddebug_info info; }; =20 struct ddebug_query { @@ -137,11 +135,11 @@ do { \ * @_i: caller provided counter. * @_sp: cursor into _vec, to examine each item. * @_box: ptr to a struct containing @_vec member - * @_vec: name of a member in @_box + * @_vec: name of a vector member in @_box */ #define for_subvec(_i, _sp, _box, _vec) \ - for ((_i) =3D 0, (_sp) =3D (_box)->_vec; \ - (_i) < (_box)->num_##_vec; \ + for ((_i) =3D 0, (_sp) =3D (_box)->_vec.start; \ + (_i) < (_box)->_vec.len; \ (_i)++, (_sp)++) /* { block } */ =20 static void vpr_info_dq(const struct ddebug_query *query, const char *msg) @@ -164,14 +162,14 @@ static void vpr_info_dq(const struct ddebug_query *qu= ery, const char *msg) query->first_lineno, query->last_lineno, query->class_string); } =20 -static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_tabl= e const *dt, +static struct _ddebug_class_map *ddebug_find_valid_class(struct ddebug_tab= le const *dt, const char *class_string, int *class_id) { - struct ddebug_class_map *map; + struct _ddebug_class_map *map; int i, idx; =20 - for_subvec(i, map, dt, classes) { + for_subvec(i, map, &dt->info, maps) { idx =3D match_string(map->class_names, map->length, class_string); if (idx >=3D 0) { *class_id =3D idx + map->base; @@ -242,7 +240,7 @@ static int ddebug_change(const struct ddebug_query *que= ry, unsigned int newflags; unsigned int nfound =3D 0; struct flagsbuf fbuf, nbuf; - struct ddebug_class_map *map =3D NULL; + struct _ddebug_class_map *map =3D NULL; int valid_class; =20 /* search for matching ddebugs */ @@ -263,8 +261,8 @@ static int ddebug_change(const struct ddebug_query *que= ry, valid_class =3D _DPRINTK_CLASS_DFLT; } =20 - for (i =3D 0; i < dt->num_ddebugs; i++) { - struct _ddebug *dp =3D &dt->ddebugs[i]; + for (i =3D 0; i < dt->info.descs.len; i++) { + struct _ddebug *dp =3D &dt->info.descs.start[i]; =20 if (!ddebug_match_desc(query, dp, valid_class)) continue; @@ -623,13 +621,13 @@ static int ddebug_exec_queries(char *query, const cha= r *modname) } =20 /* apply a new class-param setting */ -static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, +static int ddebug_apply_class_bitmap(const struct _ddebug_class_param *dcp, const u64 *new_bits, const u64 old_bits, const char *query_modname) { #define QUERY_SIZE 128 char query[QUERY_SIZE]; - const struct ddebug_class_map *map =3D dcp->map; + const struct _ddebug_class_map *map =3D dcp->map; int matches =3D 0; int bi, ct; =20 @@ -681,8 +679,8 @@ static int param_set_dyndbg_module_classes(const char *= instr, const struct kernel_param *kp, const char *mod_name) { - const struct ddebug_class_param *dcp =3D kp->arg; - const struct ddebug_class_map *map =3D dcp->map; + const struct _ddebug_class_param *dcp =3D kp->arg; + const struct _ddebug_class_map *map =3D dcp->map; u64 inrep, new_bits, old_bits; int rc, totct =3D 0; =20 @@ -756,8 +754,8 @@ EXPORT_SYMBOL(param_set_dyndbg_classes); */ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp) { - const struct ddebug_class_param *dcp =3D kp->arg; - const struct ddebug_class_map *map =3D dcp->map; + const struct _ddebug_class_param *dcp =3D kp->arg; + const struct _ddebug_class_map *map =3D dcp->map; =20 switch (map->map_type) { case DD_CLASS_TYPE_DISJOINT_BITS: @@ -1004,8 +1002,8 @@ static struct _ddebug *ddebug_iter_first(struct ddebu= g_iter *iter) } iter->table =3D list_entry(ddebug_tables.next, struct ddebug_table, link); - iter->idx =3D iter->table->num_ddebugs; - return &iter->table->ddebugs[--iter->idx]; + iter->idx =3D iter->table->info.descs.len; + return &iter->table->info.descs.start[--iter->idx]; } =20 /* @@ -1026,10 +1024,10 @@ static struct _ddebug *ddebug_iter_next(struct ddeb= ug_iter *iter) } iter->table =3D list_entry(iter->table->link.next, struct ddebug_table, link); - iter->idx =3D iter->table->num_ddebugs; + iter->idx =3D iter->table->info.descs.len; --iter->idx; } - return &iter->table->ddebugs[iter->idx]; + return &iter->table->info.descs.start[iter->idx]; } =20 /* @@ -1073,16 +1071,19 @@ static void *ddebug_proc_next(struct seq_file *m, v= oid *p, loff_t *pos) return dp; } =20 -#define class_in_range(class_id, map) \ - (class_id >=3D map->base && class_id < map->base + map->length) +static bool ddebug_class_in_range(const int class_id, const struct _ddebug= _class_map *map) +{ + return (class_id >=3D map->base && + class_id < map->base + map->length); +} =20 -static const char *ddebug_class_name(struct ddebug_iter *iter, struct _dde= bug *dp) +static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddeb= ug *dp) { - struct ddebug_class_map *map =3D iter->table->classes; - int i, nc =3D iter->table->num_classes; + struct _ddebug_class_map *map; + int i; =20 - for (i =3D 0; i < nc; i++, map++) - if (class_in_range(dp->class_id, map)) + for_subvec(i, map, &dt->info, maps) + if (ddebug_class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; =20 return NULL; @@ -1115,7 +1116,7 @@ static int ddebug_proc_show(struct seq_file *m, void = *p) seq_putc(m, '"'); =20 if (dp->class_id !=3D _DPRINTK_CLASS_DFLT) { - class =3D ddebug_class_name(iter, dp); + class =3D ddebug_class_name(iter->table, dp); if (class) seq_printf(m, " class:%s", class); else @@ -1167,7 +1168,7 @@ static const struct proc_ops proc_fops =3D { =20 static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _= ddebug_info *di) { - struct ddebug_class_map *cm; + struct _ddebug_class_map *cm; int i, nc =3D 0; =20 /* @@ -1175,12 +1176,12 @@ static void ddebug_attach_module_classes(struct dde= bug_table *dt, struct _ddebug * the builtin/modular classmap vector/section. Save the start * and length of the subrange at its edges. */ - for_subvec(i, cm, di, classes) { + for_subvec(i, cm, di, maps) { if (!strcmp(cm->mod_name, dt->mod_name)) { if (!nc) { v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n= ", i, cm->mod_name, cm->base, cm->length, cm->map_type); - dt->classes =3D cm; + dt->info.maps.start =3D cm; } nc++; } else if (nc) { @@ -1189,7 +1190,7 @@ static void ddebug_attach_module_classes(struct ddebu= g_table *dt, struct _ddebug } } if (nc) { - dt->num_classes =3D nc; + dt->info.maps.len =3D nc; vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); } } @@ -1202,10 +1203,10 @@ static int ddebug_add_module(struct _ddebug_info *d= i, const char *modname) { struct ddebug_table *dt; =20 - if (!di->num_descs) + if (!di->descs.len) return 0; =20 - v3pr_info("add-module: %s %d sites\n", modname, di->num_descs); + v3pr_info("add-module: %s %d sites\n", modname, di->descs.len); =20 dt =3D kzalloc_obj(*dt); if (dt =3D=3D NULL) { @@ -1219,19 +1220,18 @@ static int ddebug_add_module(struct _ddebug_info *d= i, const char *modname) * this struct ddebug_table. */ dt->mod_name =3D modname; - dt->ddebugs =3D di->descs; - dt->num_ddebugs =3D di->num_descs; + dt->info =3D *di; =20 INIT_LIST_HEAD(&dt->link); =20 - if (di->classes && di->num_classes) + if (di->maps.len) ddebug_attach_module_classes(dt, di); =20 mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); =20 - vpr_info("%3u debug prints in module %s\n", di->num_descs, modname); + vpr_info("%3u debug prints in module %s\n", di->descs.len, modname); return 0; } =20 @@ -1378,10 +1378,10 @@ static int __init dynamic_debug_init(void) char *cmdline; =20 struct _ddebug_info di =3D { - .descs =3D __start___dyndbg, - .classes =3D __start___dyndbg_classes, - .num_descs =3D __stop___dyndbg - __start___dyndbg, - .num_classes =3D __stop___dyndbg_classes - __start___dyndbg_classes, + .descs.start =3D __start___dyndbg, + .maps.start =3D __start___dyndbg_classes, + .descs.len =3D __stop___dyndbg - __start___dyndbg, + .maps.len =3D __stop___dyndbg_classes - __start___dyndbg_classes, }; =20 #ifdef CONFIG_MODULES @@ -1410,8 +1410,8 @@ static int __init dynamic_debug_init(void) =20 if (strcmp(modname, iter->modname)) { mod_ct++; - di.num_descs =3D mod_sites; - di.descs =3D iter_mod_start; + di.descs.len =3D mod_sites; + di.descs.start =3D iter_mod_start; ret =3D ddebug_add_module(&di, modname); if (ret) goto out_err; @@ -1421,8 +1421,8 @@ static int __init dynamic_debug_init(void) iter_mod_start =3D iter; } } - di.num_descs =3D mod_sites; - di.descs =3D iter_mod_start; + di.descs.len =3D mod_sites; + di.descs.start =3D iter_mod_start; ret =3D ddebug_add_module(&di, modname); if (ret) goto out_err; @@ -1432,8 +1432,8 @@ static int __init dynamic_debug_init(void) i, mod_ct, (int)((mod_ct * sizeof(struct ddebug_table)) >> 10), (int)((i * sizeof(struct _ddebug)) >> 10)); =20 - if (di.num_classes) - v2pr_info(" %d builtin ddebug class-maps\n", di.num_classes); + if (di.maps.len) + v2pr_info(" %d builtin ddebug class-maps\n", di.maps.len); =20 /* now that ddebug tables are loaded, process all boot args * again to find and activate queries given in dyndbg params. diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c index c049580d2152..e6b2422ca671 100644 --- a/lib/test_dynamic_debug.c +++ b/lib/test_dynamic_debug.c @@ -41,7 +41,7 @@ module_param_cb(do_prints, ¶m_ops_do_prints, NULL, 06= 00); */ #define DD_SYS_WRAP(_model, _flags) \ static u64 bits_##_model; \ - static struct ddebug_class_param _flags##_model =3D { \ + static struct _ddebug_class_param _flags##_model =3D { \ .bits =3D &bits_##_model, \ .flags =3D #_flags, \ .map =3D &map_##_model, \ --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 002E33630AC for ; Sat, 23 May 2026 07:15:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520539; cv=none; b=IRSKH38AGNMiPY2Bbt+8wpk7mbgw0acVBCag/coqMa3USRdHCLrhoCQPh6ZsTiNiZ3dyZvoRjIUOM4F5twzK3YfD9oR64YvSki1TfuWLNuo9lrRR3r4Ia1Tf0gB+z2ds/xJgVFIuqKYYF+VdFhojT5Wt4WQPU7TrYxJRVnQhCpk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520539; c=relaxed/simple; bh=fPmKvI6NbniJByc2FBVS00QxE4c6I3lmAwyQxA2t6uk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sJfs/9ITUzbmhfCzowOD+q5y85ZZEqa68y6DSvB1+qaH8yvptCVnnP/OrGXAh7aMTtu1hX969sOQ2njuOxVHFGDiaUOuTXABVLkXZAx6XFGZOXh2BbDKsexC3MZDvWkB1vl4C9xfmy8mXQy/wuLP38crXCMy/B8rIp6YX3UaS4s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZGw0uzzX; arc=none smtp.client-ip=209.85.221.52 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) header.d=gmail.com header.i=@gmail.com header.b="ZGw0uzzX" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-45297094718so6267690f8f.3 for ; Sat, 23 May 2026 00:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520535; x=1780125335; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ISSGZRpyMR72C6f36Ix88YVeWGG0f7DiWTu+/JHvX5k=; b=ZGw0uzzXJseW9jWyEdl14KCvMkKWOu0kHtBlYOd+OKUuriIHGpHJglNlnnul4n7Uu8 cIKZjxXtIUJwOkrYs3UrtqIkPCVG3gAMoHIR8nNAatpiEg4hIZf5YemJ9qwlHL65SzhF 9DYNOsRp0QLQTmP/bbKOD6FXRSnLAp7QrYn9uZbyyuqe4KyfV5BHQn+J2hISdeAz7mBd /2KoTm8yYhKkviMc5GyTNjWvRFSFhsvb6PKcBZy1AUWz7HUNrSwxR9PpSXszWqmpt5ib s2UAVftaerAk8vkMKOTABsT22CmGpO7B9JuoijtAlLygAnN9LVcKPO3Mkegt9xBwL3Lf 5Acw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520535; x=1780125335; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ISSGZRpyMR72C6f36Ix88YVeWGG0f7DiWTu+/JHvX5k=; b=f5f62Pn0tVat6eQwr+EfcsY+NiMNqxNruSDywXse/WlQL8p9nkBJ9Vkuro75ZtwcGD VUcEDoYSRe2xV3O2IsiRj2tQKNxu8iedf+BCDMGM3UJVQRnErTJfjXhV9iEl/2MGQ2cG CdgdKLjScXxCMeYDdvhtSjLfUacqeYpaw9PXBDkeLG0jtxz0s9+24ibE1V9qKqVKsqom MeDArPIGMprdD7AJaXgNT/NRgzQ/r9MSGUJx6p4M3TxWJKigAMXnwJMW+5x32uxXCf6z kDIVUd69hjeBelEmuxHrE5uPxton14JNRnAGVai2jnGFlxoAyjMTcWWhthzCQSt/UXrp yBCw== X-Forwarded-Encrypted: i=1; AFNElJ8s3NicQ65joVtp1qRWjNWzzMzXWBLQZNZWrg8qTXVT42zL71yBeysu0CzAu3DHQYT4Z4XA8xntBmKeQyc=@vger.kernel.org X-Gm-Message-State: AOJu0YyGQX24Quo755A9c3fgs+hcmH4g8G2DGOyHll9FRpnYNgKBesNZ RQ9ZEBZ66ge9/R1XUgVilEu8PE/S1o4itbdRSX4uc8Dzyr8Qc99zNRw+ X-Gm-Gg: Acq92OFNikSYPp3qyFIDVR3dPfQFrkKhPu931NVi8lpaTvw+kyXNTKd20Cu2qfEaeUg pyiMwr894SWL9a7Of8yOj8yBqL/eStzQj22zMqG/nVBEUpODvmoHvx7FHSox+yBJ3FTX2ju3SVe nkNuMzZVhp6qOoLJI/9VkHpANh4H4CkFWwge3jmeUn/ulONVGtbrEh7fo2w/GZ0Wq4ReBhGd+X6 hOOiGHT3UqELtIg8zGmlyT+VXYLuZz5yZ3G8Vrov3RtbsHuydmkON9ibQOF2Yl53r5grYDedYYK ROxVsgNUkbv0/konwX/9Fu2S9gQS75Sg8HX+i/j87rFIZpN52RBRNPzajc6BkJqbST+YSFqgohw C8fBVryYpnWMvKIs1LTtP5jyJz4dWMAFY8i9wOpXCXLjAPDT1uYlwjY9m8+6RSW1A4xnrRcgIpz C1fu/YzXIaiuAMgPJT8gG4pl7pZvFVt1NVHL8KdU4= X-Received: by 2002:a05:6000:4283:b0:43d:50c:6f33 with SMTP id ffacd0b85a97d-45eb38badbcmr11064502f8f.26.1779520535190; Sat, 23 May 2026 00:15:35 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:34 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:53 -0600 Subject: [PATCH v2 20/24] dyndbg: move mod_name down from struct ddebug_table to _ddebug_info 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-20-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=7729; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=fPmKvI6NbniJByc2FBVS00QxE4c6I3lmAwyQxA2t6uk=; b=dj2YmW0Mwtnd1FmOtaz+swCbQ/Q8ZmY76fe/dXtWBD89JfjZBoBXvxghPtRegu3RSBtOwIC2z t0veVV7lCIWBMNZ5cNlRyM6eU3fkGnR+w7Xm4wxdt79YXFpDQmLmUPW X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= struct _ddebug_info already has most of dyndbg's info for a module; push debug_table.mod_name down into it, finishing the encapsulation. This allows refactoring several callchains, passing &_ddebug_info instead of &ddebug_table, and hoisting the "&dt->info" deref up instead of repeating it thru the callchans ddebug_table contains a _ddebug_info member, so its users keep access to mod_name, just now with "->info." added in. In static ddebug_add_module(&di), reinforce the cursor-model by dropping the modname arg, and setting di->mod_name at each caller. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: move RvB after SoB old-v12 . moved up 1 position in series, ahead of hoist... --- include/linux/dynamic_debug.h | 1 + lib/dynamic_debug.c | 50 ++++++++++++++++++++++-----------------= ---- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 001bc84eadca..11ec40f488f3 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -97,6 +97,7 @@ struct _ddebug_class_maps { }; =20 struct _ddebug_info { + const char *mod_name; struct _ddebug_descs descs; struct _ddebug_class_maps maps; }; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 169b94ff6f8e..4a9b9bc9efc5 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -47,7 +47,6 @@ extern struct _ddebug_class_map __stop___dyndbg_classes[]; =20 struct ddebug_table { struct list_head link; - const char *mod_name; struct _ddebug_info info; }; =20 @@ -246,10 +245,11 @@ static int ddebug_change(const struct ddebug_query *q= uery, /* search for matching ddebugs */ mutex_lock(&ddebug_lock); list_for_each_entry(dt, &ddebug_tables, link) { + struct _ddebug_info *di =3D &dt->info; =20 /* match against the module name */ if (query->module && - !match_wildcard(query->module, dt->mod_name)) + !match_wildcard(query->module, di->mod_name)) continue; =20 if (query->class_string) { @@ -261,8 +261,8 @@ static int ddebug_change(const struct ddebug_query *que= ry, valid_class =3D _DPRINTK_CLASS_DFLT; } =20 - for (i =3D 0; i < dt->info.descs.len; i++) { - struct _ddebug *dp =3D &dt->info.descs.start[i]; + for (i =3D 0; i < di->descs.len; i++) { + struct _ddebug *dp =3D &di->descs.start[i]; =20 if (!ddebug_match_desc(query, dp, valid_class)) continue; @@ -282,7 +282,7 @@ static int ddebug_change(const struct ddebug_query *que= ry, #endif v4pr_info("changed %s:%d [%s]%s %s =3D> %s\n", trim_prefix(dp->filename), dp->lineno, - dt->mod_name, dp->function, + di->mod_name, dp->function, ddebug_describe_flags(dp->flags, &fbuf), ddebug_describe_flags(newflags, &nbuf)); dp->flags =3D newflags; @@ -1077,12 +1077,12 @@ static bool ddebug_class_in_range(const int class_i= d, const struct _ddebug_class class_id < map->base + map->length); } =20 -static const char *ddebug_class_name(struct ddebug_table *dt, struct _ddeb= ug *dp) +static const char *ddebug_class_name(struct _ddebug_info *di, struct _ddeb= ug *dp) { struct _ddebug_class_map *map; int i; =20 - for_subvec(i, map, &dt->info, maps) + for_subvec(i, map, di, maps) if (ddebug_class_in_range(dp->class_id, map)) return map->class_names[dp->class_id - map->base]; =20 @@ -1110,13 +1110,13 @@ static int ddebug_proc_show(struct seq_file *m, voi= d *p) =20 seq_printf(m, "%s:%u [%s]%s =3D%s \"", trim_prefix(dp->filename), dp->lineno, - iter->table->mod_name, dp->function, + iter->table->info.mod_name, dp->function, ddebug_describe_flags(dp->flags, &flags)); seq_escape_str(m, dp->format, ESCAPE_SPACE, "\t\r\n\""); seq_putc(m, '"'); =20 if (dp->class_id !=3D _DPRINTK_CLASS_DFLT) { - class =3D ddebug_class_name(iter->table, dp); + class =3D ddebug_class_name(&iter->table->info, dp); if (class) seq_printf(m, " class:%s", class); else @@ -1177,7 +1177,7 @@ static void ddebug_attach_module_classes(struct ddebu= g_table *dt, struct _ddebug * and length of the subrange at its edges. */ for_subvec(i, cm, di, maps) { - if (!strcmp(cm->mod_name, dt->mod_name)) { + if (!strcmp(cm->mod_name, dt->info.mod_name)) { if (!nc) { v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n= ", i, cm->mod_name, cm->base, cm->length, cm->map_type); @@ -1191,7 +1191,7 @@ static void ddebug_attach_module_classes(struct ddebu= g_table *dt, struct _ddebug } if (nc) { dt->info.maps.len =3D nc; - vpr_info("module:%s attached %d classes\n", dt->mod_name, nc); + vpr_info("module:%s attached %d classes\n", dt->info.mod_name, nc); } } =20 @@ -1199,27 +1199,26 @@ static void ddebug_attach_module_classes(struct dde= bug_table *dt, struct _ddebug * Allocate a new ddebug_table for the given module * and add it to the global list. */ -static int ddebug_add_module(struct _ddebug_info *di, const char *modname) +static int ddebug_add_module(struct _ddebug_info *di) { struct ddebug_table *dt; =20 if (!di->descs.len) return 0; =20 - v3pr_info("add-module: %s %d sites\n", modname, di->descs.len); + v3pr_info("add-module: %s %d sites\n", di->mod_name, di->descs.len); =20 dt =3D kzalloc_obj(*dt); if (dt =3D=3D NULL) { - pr_err("error adding module: %s\n", modname); + pr_err("error adding module: %s\n", di->mod_name); return -ENOMEM; } /* - * For built-in modules, name lives in .rodata and is - * immortal. For loaded modules, name points at the name[] - * member of struct module, which lives at least as long as - * this struct ddebug_table. + * For built-in modules, name (as supplied in di by its + * callers) lives in .rodata and is immortal. For loaded + * modules, name points at the name[] member of struct module, + * which lives at least as long as this struct ddebug_table. */ - dt->mod_name =3D modname; dt->info =3D *di; =20 INIT_LIST_HEAD(&dt->link); @@ -1231,7 +1230,7 @@ static int ddebug_add_module(struct _ddebug_info *di,= const char *modname) list_add_tail(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); =20 - vpr_info("%3u debug prints in module %s\n", di->descs.len, modname); + vpr_info("%3u debug prints in module %s\n", di->descs.len, di->mod_name); return 0; } =20 @@ -1294,7 +1293,7 @@ static int ddebug_remove_module(const char *mod_name) =20 mutex_lock(&ddebug_lock); list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { - if (dt->mod_name =3D=3D mod_name) { + if (dt->info.mod_name =3D=3D mod_name) { ddebug_table_free(dt); ret =3D 0; break; @@ -1314,7 +1313,8 @@ static int ddebug_module_notify(struct notifier_block= *self, unsigned long val, =20 switch (val) { case MODULE_STATE_COMING: - ret =3D ddebug_add_module(&mod->dyndbg_info, mod->name); + mod->dyndbg_info.mod_name =3D mod->name; + ret =3D ddebug_add_module(&mod->dyndbg_info); if (ret) WARN(1, "Failed to allocate memory: dyndbg may not work properly.\n"); break; @@ -1412,7 +1412,8 @@ static int __init dynamic_debug_init(void) mod_ct++; di.descs.len =3D mod_sites; di.descs.start =3D iter_mod_start; - ret =3D ddebug_add_module(&di, modname); + di.mod_name =3D modname; + ret =3D ddebug_add_module(&di); if (ret) goto out_err; =20 @@ -1423,7 +1424,8 @@ static int __init dynamic_debug_init(void) } di.descs.len =3D mod_sites; di.descs.start =3D iter_mod_start; - ret =3D ddebug_add_module(&di, modname); + di.mod_name =3D modname; + ret =3D ddebug_add_module(&di); if (ret) goto out_err; =20 --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.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 2942335DA5D for ; Sat, 23 May 2026 07:15:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520541; cv=none; b=ceara6wCjhNYU5tTKL1mFAjXWI92cM1SrOdIO8M3bh89bveiuHIkdJnIsGytAtB33y5XiQaaAnWAc0AwU+s262RR7dRTktdmxqio3QklaiWnAqCvMf10N+NS/B6sRPc+Z0cwcWZRx0zZ+bl7m7d0v6TMMFqZ9rLRfLL2EN+N5bk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520541; c=relaxed/simple; bh=qsFp9hftJ9wN9JZF0ravNVaiqVz0jzQMsbL38C8P+po=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pq3P/HFPmEwAz+DFH28RCwEeoO/aj8dc2PlX+JkDOUEsTJKx3Gz6s+x55zL3smv6YihnB7zE3+bNqsKiVKGPaPYGq4ZQgVLlSowHkV7V5aw5e94fc3z36o/8ClmAo4MZiDKPnYDivudwLvoGfT4yaAMPFvG65+FOfsmgA1KRmG0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YUYlzWXo; arc=none smtp.client-ip=209.85.128.47 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) header.d=gmail.com header.i=@gmail.com header.b="YUYlzWXo" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4903974854dso22781575e9.3 for ; Sat, 23 May 2026 00:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520538; x=1780125338; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tgi5Ox6ccqbntSHArLmS05DNR8JpFiItMv2Y5xhyH8w=; b=YUYlzWXoUh1Qkqgs4Mwq7Z4ruaZzarY1wa78IbvwLGwKOc47WW+yydiwW72UaKotN/ CcLX9UTe8638+L5gWrHZB/p2BHuqFrrUPJI0mpCE6/dEhYA8GTj0JzncezcwVqImH5xi M5Y8bifKiZfC389Dk1yYFtYiMNgO14PITazu6egnZegaaSkj0eR+6hb+natAxQIwe2is N8TXZrccNldixr/QVODNZWdp8nEuZ/N55A6kkdK/X2ntgEXVFQKEMhTNdsCtysxRgUFI NLx9Nynkc5fUVtmzCldT/FQe86FuCKiSKyrjOhWwAd+4AcyXda0YJoRCYdC1GyN2kjhh sLPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520538; x=1780125338; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=tgi5Ox6ccqbntSHArLmS05DNR8JpFiItMv2Y5xhyH8w=; b=oB8Bdv0mjXJUSpv77C1vVwprGf9SujB2p5Lz0QPSOrWGaoJ7PQPbjLtV7K37On/9oz CBrn1GXLCyMWvwPIZbLAaRpeTBG8uPiwQMR1+zIdp/UNcQTf4iktLyWq/WC95H7LqONZ xRXpNvSbgn/1Us+5zlHqLi9CHCF37Kr0rdN4HdWHG0vcWaqOTHb6jm7H+ls1M491diJO BM4yRZZ86je4xvH5A2baXNdtURx8i3YZ7KwbCrnXRC5dabuYhy3EtQCy6gNAbhgtXO0T 5C/U5XlbVo4t3lCfUW7oJx0tAYbeAdL63frUVWVw5h7B8yg+sXZNBy/B3UACccNCJbKG C1fg== X-Forwarded-Encrypted: i=1; AFNElJ+6wubTL+tyoZX1CpJIZlSpfyHWlL6hsO6ENyy4zznx77qTvRIbyRDsadNrtfETmmVHF2HCIrLnG/9LgQ4=@vger.kernel.org X-Gm-Message-State: AOJu0YxAkgt+14AIOFdeD4u85r8YRVehJosB4PSYC+5egYHv5L8Te6dj EK+uftPey3UNui37uUsYhBqDSFBsxkxgQLkVvm+do+oBHL/Nkua238OX X-Gm-Gg: Acq92OFGGHoQSfxq42NM7Rd7jPsWig1qHCo8rOox6d2d/YwC4SDgJQy8UNbnW4A4nfv zwmgcqI8XvQi1NgnxJKLTbr1UeNlnR1xlgIAKJ0F9IGlvq1If6id/Rr6Iy9dG8sB+DOoof3hq46 QOQc8rtC/NcWsmoXMg+lAZL1cXdkD1hWS/ff2dlOeWv+7IjGxpt09n5SuDMY1uuaAppubj5aNzT 2RqW8gAM2SS8ERrYCQbWCwwN7jFkUChIFqP/ZIbOhvFJH4YiEMggY1LUvSDf26/GPyQZNpbIFfV rVbjJdIqT4typNqHwPIm2XviYFGUUEaLoNZBvfIsGYxi1PdPXH2LWtNcwsWNTUAAoYHY3dfDDuW jl0DtycqMo45HQTDdcoGpTkgHE1vKLLBD5t+Fidym0stGXmu+G667nx97DY7jFa9JMJn2vF3Cg5 fX90Pu5G3k9PvgYg3AkOVJ//xKdeDX X-Received: by 2002:a05:600c:6217:b0:490:44d0:11b6 with SMTP id 5b1f17b1804b1-49044d01257mr98907975e9.12.1779520537521; Sat, 23 May 2026 00:15:37 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:36 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:54 -0600 Subject: [PATCH v2 21/24] dyndbg: hoist classmap-filter-by-modname up to ddebug_add_module 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-21-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=5267; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=qsFp9hftJ9wN9JZF0ravNVaiqVz0jzQMsbL38C8P+po=; b=+/Gl/98lDu7LKgYvdWOycYyomPyNfnP+mh+C2VNzuySQ9RcMRFbTeLbjLxOPUyD+wtUy8nq59 5a74xldU4XCBPnRM6g66sgE5yvDrQWsY9bB43s+GAuuEzz3CdsNZNqw X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= The body of ddebug_attach_module_classes() is just a code-block that finds the contiguous subrange of classmaps matching on modname, and saves it into the ddebug_table's info record. Implement this block in a macro to accommodate different component vectors in the "box" (as named in the for_subvec macro). We will reuse this macro shortly. And hoist its invocation out of ddebug_attach_module_classes() up into ddebug_add_module(). This moves the filtering step up closer to dynamic_debug_init(), which already segments the builtin pr_debug descriptors on their mod_name boundaries. Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: move RvB after SoB finish hoist - drop old fn - ddebug_attach_module_classes the v1 rev left the old ddebug_attach_module_classes in place, but it is completely redundant now, since it already lost the list-linking job it was doing. It was being cut out later in the patchset (in the unsent API adaptation phase), but for cleaner review, lets excise it now. OLD all-in-1-series (pre split into reviewable chunks) v10?- reordered params to match kdoc v12- refactor/rename: s/dd_mark_vector_subrange/dd_set_module_subrange/ 1. Renamed the macro from dd_mark_vector_subrange to dd_set_module_subrange to better reflect its purpose of narrowing a vector to a module-specific subrange. 2. Simplified the arguments by removing the redundant _dst, as the _di pointer already provides access to the target _ddebug_info struct. 3. Refactored for Clarity: Instead of overwriting the struct's start pointer while the for_subvec loop is using it to iterate, I introduced a temporary __start variable. This avoids the "subtle" side effect and makes the logic easier to follow. 4. Updated Documentation: Improved the comment block to explicitly state that the macro scans for the first match and counts contiguous elements. --- lib/dynamic_debug.c | 65 +++++++++++++++++++++++++++----------------------= ---- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 4a9b9bc9efc5..b877f4c6d778 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -162,8 +162,8 @@ static void vpr_info_dq(const struct ddebug_query *quer= y, const char *msg) } =20 static struct _ddebug_class_map *ddebug_find_valid_class(struct ddebug_tab= le const *dt, - const char *class_string, - int *class_id) + const char *class_string, + int *class_id) { struct _ddebug_class_map *map; int i, idx; @@ -1166,34 +1166,34 @@ static const struct proc_ops proc_fops =3D { .proc_write =3D ddebug_proc_write }; =20 -static void ddebug_attach_module_classes(struct ddebug_table *dt, struct _= ddebug_info *di) -{ - struct _ddebug_class_map *cm; - int i, nc =3D 0; - - /* - * Find this module's classmaps in a subrange/wholerange of - * the builtin/modular classmap vector/section. Save the start - * and length of the subrange at its edges. - */ - for_subvec(i, cm, di, maps) { - if (!strcmp(cm->mod_name, dt->info.mod_name)) { - if (!nc) { - v2pr_info("start subrange, class[%d]: module:%s base:%d len:%d ty:%d\n= ", - i, cm->mod_name, cm->base, cm->length, cm->map_type); - dt->info.maps.start =3D cm; - } - nc++; - } else if (nc) { - /* end of matching classmaps */ - break; - } - } - if (nc) { - dt->info.maps.len =3D nc; - vpr_info("module:%s attached %d classes\n", dt->info.mod_name, nc); - } -} +/* + * Narrow a _ddebug_info's vector (@_vec) to the contiguous subrange + * of elements where ->mod_name matches @__di->mod_name. + * + * This scans the @_di->_vec for the first element matching the module + * name, and counts contiguous matches to define the subrange. + * + * @_i: caller-provided index var + * @_sp: cursor into @_vec + * @_di: pointer to the struct _ddebug_info to be narrowed + * @_vec: name of the vector member (must have .start and .len) + */ +#define dd_set_module_subrange(_i, _sp, _di, _vec) ({ \ + struct _ddebug_info *__di =3D (_di); \ + typeof(__di->_vec.start) __start =3D NULL; \ + int __nc =3D 0; \ + for_subvec(_i, _sp, __di, _vec) { \ + if (!strcmp((_sp)->mod_name, __di->mod_name)) { \ + if (!__nc++) \ + __start =3D (_sp); \ + } else if (__nc) { \ + break; /* end of consecutive matches */ \ + } \ + } \ + if (__nc) \ + __di->_vec.start =3D __start; \ + __di->_vec.len =3D __nc; \ +}) =20 /* * Allocate a new ddebug_table for the given module @@ -1202,6 +1202,8 @@ static void ddebug_attach_module_classes(struct ddebu= g_table *dt, struct _ddebug static int ddebug_add_module(struct _ddebug_info *di) { struct ddebug_table *dt; + struct _ddebug_class_map *cm; + int i; =20 if (!di->descs.len) return 0; @@ -1223,8 +1225,7 @@ static int ddebug_add_module(struct _ddebug_info *di) =20 INIT_LIST_HEAD(&dt->link); =20 - if (di->maps.len) - ddebug_attach_module_classes(dt, di); + dd_set_module_subrange(i, cm, &dt->info, maps); =20 mutex_lock(&ddebug_lock); list_add_tail(&dt->link, &ddebug_tables); --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 B6C3B3603EC for ; Sat, 23 May 2026 07:15:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520544; cv=none; b=BlOh77XHHCzATfQ9knhzB5u/SUVBx5pOQtm128GFfSuBLoDHCgudA8w7vXSd0gqBb4TDrI6V4uoIdtQh3xPi0O/jG1nUcmEvCMbkpTEgtV+v6mXBI4MQCBZpo8sDT39bVJPr3MJY2qAbZxvuL1LYTGH4YGYBoYvAzoNKDI4tkbk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520544; c=relaxed/simple; bh=xgvEv0TA4T925vChN0E1XX97uyXOBDlMfeiIr+Fzp8U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UgP0ZqrUoIJRh13/5vmRZrbS/UXQASf7b++w1MSEVRdythsseCls3wsJtJ3z+zYUd9ukyViwRo0I8IuZsOVG66y8/ohcUdKfHJ4/5YqN4+8VCPWh/DPareern/0rQE9VhnthE1nrsTioq9+d7LU95y1AakBidu4al4ZHdBq3X+Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=f2Tg+8tI; arc=none smtp.client-ip=209.85.128.45 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) header.d=gmail.com header.i=@gmail.com header.b="f2Tg+8tI" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4891c0620bcso50627135e9.1 for ; Sat, 23 May 2026 00:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520539; x=1780125339; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XH02UeX+qH1Ubr3nK9VaVAyn9HbMTAM5lChYcFZxm+I=; b=f2Tg+8tIh3NAdKTaCAz/R3hfZVLYNZZ8cDFT5VLhZM+uIisNq/sLV2r4xURExVAuTg D9s9GKm/PrpCJGiepqA61wFNeDVhOOlgKHIpo1KoUUMVbo0k21Gc0zw7ctcIqIRW+vrV mZFYHe7YMvSRXQDHaU12dMVrNVRGUxuKEUsuxQt2KU0WZKfoR/zVv637d/NkoYv700f6 a3xRoHIk88EJciywU0kZ4ia53+0/BjFjoTn5Id7kB62yzP2yeD1CFUeEhVp3LggJWBG0 b3fbKDacz8W/uytnO7Tpj6VLmPITL7U8vRclDj2GDj3YAzt19oMSBD56SGwCIaYUq2qC S2IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520539; x=1780125339; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=XH02UeX+qH1Ubr3nK9VaVAyn9HbMTAM5lChYcFZxm+I=; b=ry06oJLywvDmh/+yXd2ZnnvRho7WX5/AyTJBnFL0/3tnCFVZl8rKv7cYzlsMbUsAp8 l+y6bNzIgDhxOQCtXu2i7qJLoWOwUnB+tsrQstEuTZGSqMglcvXjVmUGW+EWgp90znno 9vTGhdD72ONJTIzxK92cdvzbondvRVpbxfm64ElFzIJlahjMlLeyUTE+BRv8ZCyhbSl3 a0YcL64+I8Dz6+ui3Kl6j2h4BZsTtUCPElBD0g07Qbn8yQeTFJqMUZO0JxA+FcivDwGc 8HkrfkNJPSMSihdTguQKt8GuFxiFT7WS3d+VMS3Q/qrSorNSKYg6eQyUl1z2p87iUVAD NHyA== X-Forwarded-Encrypted: i=1; AFNElJ+wS0PEOLe6pXgp0GY4IBdRP+HhEAoqXeCDOwMN3sHSjmYRT0ODwl3+vgZUK5qhjiNZO6wUpLraURrPR4k=@vger.kernel.org X-Gm-Message-State: AOJu0YxYsLV8NLAXq2sWjtu/HeYvdy7n4oSgcNbyZr1JAy1+O44U/xHc edhPVRonDMAnUCjTFcIIBLwjMZ40R0uvJ6UMCd8QQYa41g0+vrx2lvbj X-Gm-Gg: Acq92OFsVia+lGQ6EHu0viDbtRfuW/gdt9TM8OA9W6pGQlw1XxX9w7kG5PbFj7RJNpY 6ilrEQCnze8KJBMZc5zGbkTb32/QBoeD+b6jzjlnf1aVQpybMdAqYuOulEprQSjR6EhyufWPnCg 37Te8MH205udioNaO5qbAC2/R5Uzb2t5k2jZSr062a8R64PdYus7sO8FqyEhZn0jJd1rvVfRCSF JF0uU+5svGFoScXw3fsqLk5k7UMTgReuknh34R8X7GbjkgV36eUtI7iHNZSyQttVqVwGcKY89uU UCnJr7ryDK9Ewyt7JdXbfMOkx49ou1Ui5Iq97UjRtYh3aufxdfPzJvgcXZgpGfucb29Y2fLkz8t oAPzKc1i6hROhkKgwlN76EN3SE/1hLCVAfAuqUr4QrbV3Im2eOGG5W0tvKiWkgszSo1pykERi+b /eQzUtD5gBIrn/W7BsDWtijCbefJP32xvWmCzDy8A= X-Received: by 2002:a05:600c:458b:b0:490:47e3:929a with SMTP id 5b1f17b1804b1-49047e394a6mr80917335e9.6.1779520539101; Sat, 23 May 2026 00:15:39 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:38 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:55 -0600 Subject: [PATCH v2 22/24] selftests-dyndbg: add a dynamic_debug run_tests target 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-22-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , =?utf-8?q?=C5=81ukasz_Bartosik?= , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=13075; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=xgvEv0TA4T925vChN0E1XX97uyXOBDlMfeiIr+Fzp8U=; b=6JumWzr7aPD4/OsafnoAyhiCGidsWrRAThh6J5u5v7oibliaN4ltidrwy5+RtffI75yUptjoQ zViFkZTBeiPDdQtfS1InU3LPfH1k3v715uD1f+weEj8oFU1vg9jkJ9/ X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= Add a selftest script for dynamic-debug. The config requires CONFIG_TEST_DYNAMIC_DEBUG=3Dm and CONFIG_TEST_DYNAMIC_DEBUG_SUBMOD=3Dm, which tacitly requires either CONFIG_DYNAMIC_DEBUG=3Dy or CONFIG_DYNAMIC_DEBUG_CORE=3Dy ATM this has just basic_tests(), which modify pr_debug() flags in the builtin params module. This means they're available to manipulate and observe the effects in "cat control". This is backported from another feature branch; the support-fns (thx Lukas) have unused features at the moment, they'll get used shortly. The script enables simple virtme-ng testing: [jimc@gandalf b0-ftrace]$ vrun_t virtme-ng 1.32+115.g07b109d doing: vng --name v6.14-rc4-60-gd5f48427de0c \ --user root -v -p 4 -a dynamic_debug.verbose=3D3 V=3D1 \ -- ../tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh virtme: waiting for virtiofsd to start .. And add dynamic_debug to TARGETS, so `make run_tests` sees it properly For the impatient, set TARGETS explicitly: [root@v6 selftests]# make TARGETS=3Ddynamic_debug run_tests make[1]: Nothing to be done for 'all'. TAP version 13 1..1 # timeout set to 45 # selftests: dynamic_debug: dyndbg_selftest.sh # # BASIC_TESTS 95.422122] dyndbg: query 0: 0"=3D_" mod:* ... NOTES check KCONFIG_CONFIG to avoid silly fails Several tests are dependent upon config choices. Lets avoid failing where that is noise. The KCONFIG_CONFIG var exists to convey the config-file around. If the var names a file, read it and extract the relevant CONFIG items, and use them to skip the dependent tests, thus avoiding the fails that would follow, and the disruption to whatever CI is running these selftests. If the envar doesn't name a config-file, ".config" is assumed. CONFIG_DYNAMIC_DEBUG=3Dy: basic-tests() and comma-terminator-tests() test for the presence of the builtin pr_debugs in module/main.c, which I deemed stable and therefore safe to count. That said, the test fails if only CONFIG_DYNAMIC_DEBUG_CORE=3Dy is set. It could be rewritten to test against test-dynamic-debug.ko, but that just trades one config dependence for another. Co-developed-by: =C5=81ukasz Bartosik Signed-off-by: =C5=81ukasz Bartosik Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: drop commit-msg mention of yet-to-be-submitted tests move RvB after SoB script fixups per sashiko review 1. CONFIG_DYNAMIC_DEBUG=3Dy is set correctly. 2. All subshell captures $( ( ... ) 2>&1 ) are fixed. 3. All echo variables are safely quoted to prevent word-splitting. 4. Standardized on modern /sys/kernel/tracing/ paths. 5. exit $exp_exit_code correctly propagates failure status. --- MAINTAINERS | 1 + tools/testing/selftests/Makefile | 1 + tools/testing/selftests/dynamic_debug/Makefile | 9 + tools/testing/selftests/dynamic_debug/config | 8 + .../selftests/dynamic_debug/dyndbg_selftest.sh | 257 +++++++++++++++++= ++++ 5 files changed, 276 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index e87bfe2e9e62..3f1c7dd278d4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9083,6 +9083,7 @@ F: include/asm-generic/dyndbg.lds.h F: include/linux/dynamic_debug.h F: lib/dynamic_debug.c F: lib/test_dynamic_debug.c +F: tools/testing/selftests/dynamic_debug/* =20 DYNAMIC INTERRUPT MODERATION M: Tal Gilboa diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Mak= efile index 6e59b8f63e41..17c4ddbcee89 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -27,6 +27,7 @@ TARGETS +=3D drivers/net/team TARGETS +=3D drivers/net/virtio_net TARGETS +=3D drivers/platform/x86/intel/ifs TARGETS +=3D dt +TARGETS +=3D dynamic_debug TARGETS +=3D efivarfs TARGETS +=3D exec TARGETS +=3D fchmodat2 diff --git a/tools/testing/selftests/dynamic_debug/Makefile b/tools/testing= /selftests/dynamic_debug/Makefile new file mode 100644 index 000000000000..6d06fa7f1040 --- /dev/null +++ b/tools/testing/selftests/dynamic_debug/Makefile @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only +# borrowed from Makefile for user memory selftests + +# No binaries, but make sure arg-less "make" doesn't trigger "run_tests" +all: + +TEST_PROGS :=3D dyndbg_selftest.sh + +include ../lib.mk diff --git a/tools/testing/selftests/dynamic_debug/config b/tools/testing/s= elftests/dynamic_debug/config new file mode 100644 index 000000000000..ec478b17873d --- /dev/null +++ b/tools/testing/selftests/dynamic_debug/config @@ -0,0 +1,8 @@ + +# basic tests ref the builtin params module +CONFIG_DYNAMIC_DEBUG=3Dy + +# more testing is possible with these, +# but insisting on them here skips testing entirely for such configs +# CONFIG_TEST_DYNAMIC_DEBUG=3Dm +# CONFIG_TEST_DYNAMIC_DEBUG_SUBMOD=3Dm diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh new file mode 100755 index 000000000000..01c035fe8c9a --- /dev/null +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -0,0 +1,257 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-only + +V=3D${V:=3D0} # invoke as V=3D1 $0 for global verbose +RED=3D"\033[0;31m" +GREEN=3D"\033[0;32m" +YELLOW=3D"\033[0;33m" +BLUE=3D"\033[0;34m" +MAGENTA=3D"\033[0;35m" +CYAN=3D"\033[0;36m" +NC=3D"\033[0;0m" +error_msg=3D"" + +[ -e /proc/dynamic_debug/control ] || { + echo -e "${RED}: this test requires CONFIG_DYNAMIC_DEBUG=3Dy ${NC}" + exit 0 # nothing to test here, no good reason to fail. +} + +# need info to avoid failures due to untestable configs + +[ -f "$KCONFIG_CONFIG" ] || KCONFIG_CONFIG=3D".config" +if [ -f "$KCONFIG_CONFIG" ]; then + echo "# consulting KCONFIG_CONFIG: $KCONFIG_CONFIG" + grep -q "CONFIG_DYNAMIC_DEBUG=3Dy" $KCONFIG_CONFIG ; LACK_DD_BUILTIN= =3D$? + grep -q "CONFIG_TEST_DYNAMIC_DEBUG=3Dm" $KCONFIG_CONFIG ; LACK_TMOD=3D= $? + grep -q "CONFIG_TEST_DYNAMIC_DEBUG_SUBMOD=3Dm" $KCONFIG_CONFIG ; LACK_= TMOD_SUBMOD=3D$? + if [ $V -eq 1 ]; then + echo LACK_DD_BUILTIN: $LACK_DD_BUILTIN + echo LACK_TMOD: $LACK_TMOD + echo LACK_TMOD_SUBMOD: $LACK_TMOD_SUBMOD + fi +else + LACK_DD_BUILTIN=3D0 + LACK_TMOD=3D0 + LACK_TMOD_SUBMOD=3D0 +fi + +function vx () { + echo "$1" > /sys/module/dynamic_debug/parameters/verbose +} + +function ddgrep () { + grep "$1" /proc/dynamic_debug/control +} + +function doprints () { + cat /sys/module/test_dynamic_debug/parameters/do_prints +} + +function ddcmd () { + exp_exit_code=3D0 + num_args=3D$# + if [ "${@:$#}" =3D "pass" ]; then + num_args=3D$#-1 + elif [ "${@:$#}" =3D "fail" ]; then + num_args=3D$#-1 + exp_exit_code=3D1 + fi + args=3D${@:1:$num_args} + output=3D$( (echo "$args" > /proc/dynamic_debug/control) 2>&1) + exit_code=3D$? + error_msg=3D$(echo "$output" | cut -d ":" -f 5 | sed -e 's/^[[:space:]= ]*//') + handle_exit_code $BASH_LINENO $FUNCNAME $exit_code $exp_exit_code +} + +function handle_exit_code() { + local exp_exit_code=3D0 + [ $# =3D=3D 4 ] && exp_exit_code=3D$4 + if [ $3 -ne $exp_exit_code ]; then + echo -e "${RED}: $BASH_SOURCE:$1 $2() expected to exit with code $= exp_exit_code" + [ $3 =3D=3D 1 ] && echo "Error: '$error_msg'" + exit $exp_exit_code + fi +} + +# $1 - pattern to match, pattern in $1 is enclosed by spaces for a match "= "\s$1\s" +# $2 - number of times the pattern passed in $1 is expected to match +# $3 - optional can be set either to "-r" or "-v" +# "-r" means relaxed matching in this case pattern provided in $1 is= passed +# as is without enclosing it with spaces +# "-v" prints matching lines +# $4 - optional when $3 is set to "-r" then $4 can be used to pass "-v" +function check_match_ct { + pattern=3D"\s$1\s" + exp_cnt=3D0 + + [ "$3" =3D=3D "-r" ] && pattern=3D"$1" + let cnt=3D$(ddgrep "$pattern" | wc -l) + if [ $V -eq 1 ] || [ "$3" =3D=3D "-v" ] || [ "$4" =3D=3D "-v" ]; then + echo -ne "${BLUE}" && ddgrep $pattern && echo -ne "${NC}" + fi + [ $# -gt 1 ] && exp_cnt=3D$2 + if [ $cnt -ne $exp_cnt ]; then + echo -e "${RED}: $BASH_SOURCE:$BASH_LINENO check failed expected $= exp_cnt on $1, got $cnt" + exit + else + echo ": $cnt matches on $1" + fi +} + +# $1 - trace instance name +# #2 - if > 0 then directory is expected to exist, if <=3D 0 then otherwise +# $3 - "-v" for verbose +function check_trace_instance_dir { + if [ -e /sys/kernel/tracing/instances/$1 ]; then + if [ "$3" =3D=3D "-v" ] ; then + echo "ls -l /sys/kernel/tracing/instances/$1: " + ls -l /sys/kernel/tracing/instances/$1 + fi + if [ $2 -le 0 ]; then + echo -e "${RED}: $BASH_SOURCE:$BASH_LINENO error trace instanc= e \ + '/sys/kernel/tracing/instances/$1' does exist" + exit + fi + else + if [ $2 -gt 0 ]; then + echo -e "${RED}: $BASH_SOURCE:$BASH_LINENO error trace instanc= e \ + '/sys/kernel/tracing/instances/$1' does not exist" + exit + fi + fi +} + +function tmark { + echo $* > /sys/kernel/tracing/trace_marker +} + +# $1 - trace instance name +# $2 - line number +# $3 - if > 0 then the instance is expected to be opened, otherwise +# the instance is expected to be closed +function check_trace_instance { + output=3D$(tail -n9 /proc/dynamic_debug/control | grep ": Opened trace= instances" \ + | xargs -n1 | grep $1) + if [ "$output" !=3D $1 ] && [ $3 -gt 0 ]; then + echo -e "${RED}: $BASH_SOURCE:$2 trace instance $1 is not opened" + exit + fi + if [ "$output" =3D=3D $1 ] && [ $3 -le 0 ]; then + echo -e "${RED}: $BASH_SOURCE:$2 trace instance $1 is not closed" + exit + fi +} + +function is_trace_instance_opened { + check_trace_instance $1 $BASH_LINENO 1 +} + +function is_trace_instance_closed { + check_trace_instance $1 $BASH_LINENO 0 +} + +# $1 - trace instance directory to delete +# $2 - if > 0 then directory is expected to be deleted successfully, if <= =3D 0 then otherwise +function del_trace_instance_dir() { + exp_exit_code=3D1 + [ $2 -gt 0 ] && exp_exit_code=3D0 + output=3D$( (rmdir /sys/kernel/tracing/instances/$1) 2>&1) + exit_code=3D$? + error_msg=3D$(echo "$output" | cut -d ":" -f 3 | sed -e 's/^[[:space:]= ]*//') + handle_exit_code $BASH_LINENO $FUNCNAME $exit_code $exp_exit_code +} + +function error_log_ref { + # to show what I got + : echo "# error-log-ref: $1" + : echo cat \$2 +} + +function ifrmmod { + lsmod | grep $1 2>&1>/dev/null && rmmod $1 +} + +# $1 - text to search for +function search_trace() { + search_trace_name 0 1 $1 +} + +# $1 - trace instance name, 0 for global event trace +# $2 - line number counting from the bottom +# $3 - text to search for +function search_trace_name() { + if [ "$1" =3D "0" ]; then + buf=3D$(cat /sys/kernel/tracing/trace) + line=3D$(tail -$2 /sys/kernel/tracing/trace | head -1 | sed -e 's/^[[= :space:]]*//') + else + buf=3D$(cat /sys/kernel/tracing/instances/$1/trace) + line=3D$(tail -$2 /sys/kernel/tracing/instances/$1/trace | head -1 | \ + sed -e 's/^[[:space:]]*//') + fi + if [ $2 =3D 0 ]; then + # whole-buf check + output=3D$(echo "$buf" | grep "$3") + else + output=3D$(echo "$line" | grep "$3") + fi + if [ "$output" =3D "" ]; then + echo -e "${RED}: $BASH_SOURCE:$BASH_LINENO search for '$3' fai= led \ + in line '$line' or '$buf'" + exit + fi + if [ $V =3D 1 ]; then + echo -e "${MAGENTA}: search_trace_name in $1 found: \n$output \nin:${= BLUE} $buf ${NC}" + fi +} + +# $1 - error message to check +function check_err_msg() { + if [ "$error_msg" !=3D "$1" ]; then + echo -e "${RED}: $BASH_SOURCE:$BASH_LINENO error message '$error_m= sg' \ + does not match with '$1'" + exit + fi +} + +function basic_tests { + echo -e "${GREEN}# BASIC_TESTS ${NC}" + if [ $LACK_DD_BUILTIN -eq 1 ]; then + echo "SKIP" + return + fi + ddcmd =3D_ # zero everything + check_match_ct =3Dp 0 + + # module params are builtin to handle boot args + check_match_ct '\[params\]' 4 -r + ddcmd module params +mpf + check_match_ct =3Dpmf 4 + + # multi-cmd input, newline separated, with embedded comments + cat <<"EOF" > /proc/dynamic_debug/control + module params =3D_ # clear params + module params +mf # set flags + module params func parse_args +sl # other flags +EOF + check_match_ct =3Dmf 3 + check_match_ct =3Dmfsl 1 + ddcmd =3D_ +} + +tests_list=3D( + basic_tests +) + +# Run tests + +ifrmmod test_dynamic_debug_submod +ifrmmod test_dynamic_debug + +for test in "${tests_list[@]}" +do + $test + echo "" +done +echo -en "${GREEN}# Done on: " +date +echo -en "${NC}" --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 5DE88367B86 for ; Sat, 23 May 2026 07:15:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520545; cv=none; b=ORBMZ7TAnOeqbMpMIOwb2abdhdXY9ex5jUphBEqIXNITPc3ahltjLNLN29bCxlHsqLCyeECq5Ar14JhULdWQQFlUUXbzXzC8o1f/zgWmERP6PlGg/ykT252y05hw70Rlz4qoHwHUSeWxioNoug5OmyCFuOpIgaXpiWKLJcI5Qys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520545; c=relaxed/simple; bh=fJJj649T3B3bmwoMx3I1b8H3sX85+6tYQ9gU6si3lQg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=J/YbrFgNr0S1r+BjYJSiAZiF06AUKsnkfpEZvin2sE0kWwym6eGp5poa9v5m8hp6GiXH0YQc+39Cs85F1RAqPCbh7pczRq5FAQaEomZoOBFvCAPnUTzXQX71nz+O9VujuTZrZjuFRjgGXc5ST++dmuN0M2F+epYtjd5ysdlWyLQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NCJmpk2o; arc=none smtp.client-ip=209.85.128.50 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) header.d=gmail.com header.i=@gmail.com header.b="NCJmpk2o" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-49041e84237so13249685e9.1 for ; Sat, 23 May 2026 00:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520541; x=1780125341; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=LDLU5WQYt4oY/SVN5IVezPdfdTCoMnWFmJoSA2Xzdlg=; b=NCJmpk2oVJTOOsaGZ2M26DywtgLPU7+XxtNgrjDPyYL1NQxdjlAMyOfyOf+K7ApSio UynJQo3NfEUU7LZONXyGU81D8kX1PlHtvh9ungsvWyESHQpN+Bcz+WSUuWIRZj8BFeBF OFCN5Xt9Kvexqy2ee6eQrxQEZPkNAiIB1MhDP+qjwKfi+fCvIWNf/OdtzWioA5oVCeJ9 XxS5wjdLgH5kPiVOXFzSYQE5d9SnSMvbo7pFJUZnjih2WEGqbY5KCJhuuhkz1TFqWzdV qjN4JkL6k6osvQNg68jgvCJd0NSMjX7NsCY3Gh63ELDMZ9sQTmWR/j8gVZqh6M9ZGlK4 rPqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520541; x=1780125341; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=LDLU5WQYt4oY/SVN5IVezPdfdTCoMnWFmJoSA2Xzdlg=; b=fTUzA1EyWbMMtVpQ3P3bK03eGiWj+kwnJY5mgnnLYC/Fik0FrUO8m4ELP5aEX5a8Ba Ah4LPs0ebroyf4q32f0pEQ2vqWhE0ptIb7c63IbO9uQwkYh75PDA5tQppw8GtFKKmsxm +tFcZh4+9f4x4YdURvNFvLnzl7xOtktRksLaaKNZd/A0SD6JloA25iqSon3tgzBpxd+a 9+Sn7oHsorhmvQkPgQf+JGqT0x8ufZgHwHhU/6vu9C+DtaC/ehuPcTtn8GtB7he2eKQk XGoSK3fk72Kp4qA1/7tCiDr1+w22L8Q1kU5PYqvlBr/OwX/qevBVvZYoa3aZhY9vglgE ho/g== X-Forwarded-Encrypted: i=1; AFNElJ/djhBcjnnabh3w/f4juA3N3YMDbAjA+k9JUy4n2ooGWemSbWw5HnUjXgoJCaIhcPYdw6md3Gkb3xA9LgQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyCRErHvaz/Xd9kkIW5kavIy2KIaYAJmE0VInEQlCj8JD4FFrxT syY2NfN0IHgW0Apap8NJz4y22qjOMXUCURM1w5dKPkssb8mB85tGPFSt X-Gm-Gg: Acq92OEEC+mVBRa5Yq3edxBSBroFfR3o1GMn4Xk/QAsPNYlpKHJjpQltqXfG1XOPYJl vcVAQ+aVKLUhd8IfG2uNbSHwaTaKrnkN/aXRXopAWdCAqP2L386emSlyIcwRk62zoEFGsRCdx4/ KRD92/aEfcsnMc0tKclGA6QUyJDH3idM5yzSjGFnHyBoHZ/JSYrjh4zPGWcHz6xJlkdOXv+vCVL 6oDf19JyOrG6rKL/beL9z2r3E4o0mwn3DoetZFRDstUtf5KBkuPUetJqwYvBkJIO0ayGTFaHhxI 0jsEwbd1f3V3w3I+/LQDoIbPxUPyFLc66iHzGDsJDXWAsysEjVavKQCM8jy/rpa10MAZMJTDcaU bJ3PAYiggSklNlwqqvAXxfy+zuY1JMD5ABawkvPvm/ijE9gGyd7eVn2IxytMEzBIEj4XU83wRXs iuVdwQRGvD8a/zOQnNQPWjnHg9wb3qSMIBMFoOCpA= X-Received: by 2002:a05:600c:4506:b0:490:3838:1548 with SMTP id 5b1f17b1804b1-49038381676mr146718845e9.13.1779520540573; Sat, 23 May 2026 00:15:40 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:40 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:56 -0600 Subject: [PATCH v2 23/24] dyndbg: change __dynamic_func_call_cls* macros into expressions 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-23-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=3131; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=fJJj649T3B3bmwoMx3I1b8H3sX85+6tYQ9gU6si3lQg=; b=V+8IE8KkGtFIdYyLDVrlrxn/sAoLHZdpVxJ31MGCeHA9ThYCUNqh2uYEtT6ZbgcGiaE/3Lu6i OMECpf5DJmoCzNLsou0p27ZdFaR4zl/W0edvspiJbNugzW2jMTcUHFw X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= The Xe driver's XE_IOCTL_DBG macro calls drm_dbg() from inside an if (expression). This breaks when CONFIG_DRM_USE_DYNAMIC_DEBUG=3Dy because the invoked macro has a do-while-0 wrapper, and is not an expression. if (cond && (drm_dbg("expr-form"),1)) { ... do some more stuff } Fix for this usage by changing __dynamic_func_call_cls{,_no_desc} macros into expressions, by replacing the do-while-0s with a ({ }) wrapper. In the common usage, the trailing ';' converts the expression into a statement. drm_dbg("statement form"); Signed-off-by: Jim Cromie Reviewed-by: Louis Chauvet --- v2: fix statement-expressions to return 0 (not void) like their respective fall= backs 1. Add 0; to __dynamic_func_call_cls 2. Add 0; to __dynamic_func_call_cls_no_desc 3. Convert the disabled fallback of dynamic_hex_dump from do { ... } whi= le(0) to ({ ... 0; }) move RvB after SoB --- include/linux/dynamic_debug.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 11ec40f488f3..fe73aa27b350 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -224,24 +224,26 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, * (|_cls): adds in _DPRINT_CLASS_DFLT as needed * (|_no_desc): former gets callsite descriptor as 1st arg (for prdbgs) */ -#define __dynamic_func_call_cls(id, cls, fmt, func, ...) do { \ +#define __dynamic_func_call_cls(id, cls, fmt, func, ...) ({ \ DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt); \ if (DYNAMIC_DEBUG_BRANCH(id)) { \ func(&id, ##__VA_ARGS__); \ __dynamic_dump_stack(id); \ } \ -} while (0) + 0; /* match no_printk return value */ \ +}) #define __dynamic_func_call(id, fmt, func, ...) \ __dynamic_func_call_cls(id, _DPRINTK_CLASS_DFLT, fmt, \ func, ##__VA_ARGS__) =20 -#define __dynamic_func_call_cls_no_desc(id, cls, fmt, func, ...) do { \ +#define __dynamic_func_call_cls_no_desc(id, cls, fmt, func, ...) ({ \ DEFINE_DYNAMIC_DEBUG_METADATA_CLS(id, cls, fmt); \ if (DYNAMIC_DEBUG_BRANCH(id)) { \ func(__VA_ARGS__); \ __dynamic_dump_stack(id); \ } \ -} while (0) + 0; /* match no_printk return value */ \ +}) #define __dynamic_func_call_no_desc(id, fmt, func, ...) \ __dynamic_func_call_cls_no_desc(id, _DPRINTK_CLASS_DFLT, \ fmt, func, ##__VA_ARGS__) @@ -321,10 +323,12 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, dev_no_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__) #define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) \ - do { if (0) \ +({ \ + if (0) \ print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, \ - rowsize, groupsize, buf, len, ascii); \ - } while (0) + rowsize, groupsize, buf, len, ascii); \ + 0; \ +}) =20 #endif /* CONFIG_DYNAMIC_DEBUG || (CONFIG_DYNAMIC_DEBUG_CORE && DYNAMIC_DE= BUG_MODULE) */ =20 --=20 2.54.0 From nobody Sun May 24 19:33:39 2026 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 9BD41368D76 for ; Sat, 23 May 2026 07:15:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520546; cv=none; b=ratmlGUbbwpH1dKZeu2RFl+WjKmWIsIZGUVErRaYgI4qGBNMOKVH0OhHs51Tos0rpiva8t6M6Gzt3spBV65qvsDA3/ocYGAV9FDqnEIaebUo+RwxrsjfQy4XyTt55Q12Q2TxH5VPuWfJ1ZM4YM+uRyOfzOfXnFh8xK43Oq8MNLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779520546; c=relaxed/simple; bh=M80+fNO6OBurAzoDghArAT2ZgkzXj59Sg4wMHAAZH/c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tw13WkCp2yQg/2YtFTgWzDDHh46jNaxfBo4MYBUUX2PAjxS9DqT/CGcjLXCRBisYfeKoYYxYA5rh4Yi7bdljWPHW4JeNJWCKvMqPRGFyzvFbVAYpmop8mreFXxZtPwRQFXB+s96xUDiiUE5HvRsEfEAUGQoQM1/IgSFrc1MmElo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ok/XYjGG; arc=none smtp.client-ip=209.85.221.42 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) header.d=gmail.com header.i=@gmail.com header.b="ok/XYjGG" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-43d7e23defbso4510735f8f.0 for ; Sat, 23 May 2026 00:15:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779520543; x=1780125343; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wCBDtFYH6irn68vEcfgObGsGHdxoBTw2InqF805Jo2w=; b=ok/XYjGGYqAhEicSNuybCnnfsy8bqOXgCc06ot6kit+8FPh4pLs0Avlh2sk0BnDsX+ MzL8mRgOhcH9AwrMrX1SlHBOQPg6o1LJ9dQeytRgccg4LV9IimeJOgVSUEm7Ag4XjZoM PXiUt9MPkO7k5cFzHIuRJVfa67B4exvMhBgWex1g4nhTEC1RoK9uZdyXtTLrcsG9PTY3 8jmaoepoKpk6ilkAndTRjTenhHt54uNbgEPXedLZJ+e2DcI8eqNSTOYC3ZnNN6vab+8G V+bWn3h4CeY088xxYi+rkLnco8ruh3yRDqWa9uX4MLNqZ45muvMlP09oYIAknGwSxxm4 x81Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779520543; x=1780125343; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=wCBDtFYH6irn68vEcfgObGsGHdxoBTw2InqF805Jo2w=; b=pxHAjGDKv42kxOlbl8kXD+MNKYF+c4vL3VZ93LhEelmJ+5JhIHNSqzLSJTpq/+4ceQ 4Cr23h/TpWKHwglWcpwXRxLorXKtR52Sz6h9GtWmO2C3BTQUuZA80kbtyloiDEXBbEH3 UGZUGbQ6a5ZEAQxRfzPaWGNVkes5zpURFTA9q2tfApUh0gqx0Wp7I8CG1bpdnuixTq3v re4De17iHQWgQcMWjgIeCeI5aIQGnFyCuzhhzrpytOLaWUNju6PosWOtUvMUxSWVPN6O I8EDu4Z8kCLV74/LzYBfkowhoWDUyk3B7l4RU1itxovUufRg2t6qx9HKPyNP2IxxkE0L HP0w== X-Forwarded-Encrypted: i=1; AFNElJ94ZiOzUPjpfKYHHJa0IK/9/klnzXcRr+3xd/gSDHbyAMNd9tavHv9cbybREKQA2hwQU/pXvQ0dLAcM66g=@vger.kernel.org X-Gm-Message-State: AOJu0Yxv5cSrCL97ywxYTSFCVjksm/YIazUuNNL/qX0JXPk9pSafYSFa LSukWFjRBmLt9LziS5YcTf4CWKmRH2GfrJw3LBQ6nS1lBP7Ht9rzjEFF X-Gm-Gg: Acq92OFbnUFYgCPqYk3j86yRV3bJtIgGQ+SqJPfbvY5XntXAkQMUDWXwW0lmjeqa1PB /m6igMQ80qTcVwFCIFLNGntXEHwgUue99j+K6MoIlyHUHTfO5Mk7vNl6YlHYhQ6GZFMLabuMUHz Vr9gYY3QuRBBbw/UdglbtN0BH03S73ul5nVUNA4dlGZHPN5kuN4EdllM8ucouhwoT1vL3dYfM14 4mGH1t4eawCuiy2luEkCSb4qcX3f1UYHd+Ta/fDkpfDDKuQVe6mwJNdsFt1cpPSsHPxcNnT2xR/ vJjzmcdW7IqRQ+qjZYCsToYxGTQ0ZEO/eBebBrgL4pj9bHsyBUo334iiysznPQ/uOsDg9ZBe8MX rFYbJle+XtrjMTvcPnrB2h8wwyAUMu1Aj/nyxIySSAZVXGxlltpma5k+F4JJUxU4l/OpHRnzNuo NxsgRgOGNUTrofK2XxSfQV2CjP77WG X-Received: by 2002:a05:6000:25e3:b0:43d:68ad:3b7f with SMTP id ffacd0b85a97d-45eb38af5c7mr10081766f8f.21.1779520543058; Sat, 23 May 2026 00:15:43 -0700 (PDT) Received: from [192.168.0.174] ([31.96.183.250]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45eb6d5cb76sm8639838f8f.25.2026.05.23.00.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2026 00:15:41 -0700 (PDT) From: Jim Cromie Date: Sat, 23 May 2026 01:14:57 -0600 Subject: [PATCH v2 24/24] dyndbg: improve section names 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-Transfer-Encoding: quoted-printable Message-Id: <20260523-dd-maint-2-v2-24-b937312aa083@gmail.com> References: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> In-Reply-To: <20260523-dd-maint-2-v2-0-b937312aa083@gmail.com> To: Jonathan Corbet , Shuah Khan , Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Andrew Morton , Shuah Khan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kselftest@vger.kernel.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779520485; l=5623; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=M80+fNO6OBurAzoDghArAT2ZgkzXj59Sg4wMHAAZH/c=; b=IPLjgcIxtWsAYl+aBjchTE9EychEIqrxQak1IFTHfNKzY4NcwzKCPKwEW2llTS3/AdszaVr7i N1vE4tjKZfgDbjInXaxKzrJqaN4Ut9tfGi7eVcksJB+R0JuwRT+4HCD X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= change __dyndbg to __dyndbg_descs change __dyndbg_classes to __dyndbg_class_maps this sets up for adding __dyndbg_class_users Signed-off-by: Jim Cromie --- include/asm-generic/dyndbg.lds.h | 14 +++++++------- include/linux/dynamic_debug.h | 4 ++-- kernel/module/main.c | 2 +- lib/dynamic_debug.c | 24 ++++++++++++------------ 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/asm-generic/dyndbg.lds.h b/include/asm-generic/dyndbg.= lds.h index 9d8951bef688..ec661f9f3793 100644 --- a/include/asm-generic/dyndbg.lds.h +++ b/include/asm-generic/dyndbg.lds.h @@ -3,16 +3,16 @@ #define __ASM_GENERIC_DYNDBG_LDS_H =20 #include -#define DYNDBG_SECTIONS() \ - BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ - BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes) +#define DYNDBG_SECTIONS() \ + BOUNDED_SECTION_BY(__dyndbg_descs, ___dyndbg_descs) \ + BOUNDED_SECTION_BY(__dyndbg_class_maps, ___dyndbg_class_maps) =20 #define MOD_DYNDBG_SECTIONS() \ - __dyndbg 0 : ALIGN(8) { \ - KEEP(*(__dyndbg)) \ + __dyndbg_descs 0 : ALIGN(8) { \ + KEEP(*(__dyndbg_descs)) \ } \ - __dyndbg_classes 0 : ALIGN(8) { \ - KEEP(*(__dyndbg_classes)) \ + __dyndbg_class_maps 0 : ALIGN(8) { \ + KEEP(*(__dyndbg_class_maps)) \ } =20 #endif /* __ASM_GENERIC_DYNDBG_LDS_H */ diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index fe73aa27b350..206337af71e9 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -128,7 +128,7 @@ struct _ddebug_class_param { #define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ static const char *_var##_classnames[] =3D { __VA_ARGS__ }; \ static struct _ddebug_class_map __aligned(8) __used \ - __section("__dyndbg_classes") _var =3D { \ + __section("__dyndbg_class_maps") _var =3D { \ .mod =3D THIS_MODULE, \ .mod_name =3D KBUILD_MODNAME, \ .base =3D _base, \ @@ -168,7 +168,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, =20 #define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt) \ static struct _ddebug __aligned(8) \ - __section("__dyndbg") name =3D { \ + __section("__dyndbg_descs") name =3D { \ .modname =3D KBUILD_MODNAME, \ .function =3D __func__, \ .filename =3D __FILE__, \ diff --git a/kernel/module/main.c b/kernel/module/main.c index c2b6e70f2e77..bd7899a91755 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2774,7 +2774,7 @@ static int find_module_sections(struct module *mod, s= truct load_info *info) pr_warn("%s: Ignoring obsolete parameters\n", mod->name); =20 #ifdef CONFIG_DYNAMIC_DEBUG_CORE - mod->dyndbg_info.descs.start =3D section_objs(info, "__dyndbg_descriptors= ", + mod->dyndbg_info.descs.start =3D section_objs(info, "__dyndbg_descs", sizeof(*mod->dyndbg_info.descs.start), &mod->dyndbg_info.descs.len); mod->dyndbg_info.maps.start =3D section_objs(info, "__dyndbg_class_maps", diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index b877f4c6d778..ce70cfee50c5 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -40,10 +40,10 @@ =20 #include =20 -extern struct _ddebug __start___dyndbg[]; -extern struct _ddebug __stop___dyndbg[]; -extern struct _ddebug_class_map __start___dyndbg_classes[]; -extern struct _ddebug_class_map __stop___dyndbg_classes[]; +extern struct _ddebug __start___dyndbg_descs[]; +extern struct _ddebug __stop___dyndbg_descs[]; +extern struct _ddebug_class_map __start___dyndbg_class_maps[]; +extern struct _ddebug_class_map __stop___dyndbg_class_maps[]; =20 struct ddebug_table { struct list_head link; @@ -1379,10 +1379,10 @@ static int __init dynamic_debug_init(void) char *cmdline; =20 struct _ddebug_info di =3D { - .descs.start =3D __start___dyndbg, - .maps.start =3D __start___dyndbg_classes, - .descs.len =3D __stop___dyndbg - __start___dyndbg, - .maps.len =3D __stop___dyndbg_classes - __start___dyndbg_classes, + .descs.start =3D __start___dyndbg_descs, + .maps.start =3D __start___dyndbg_class_maps, + .descs.len =3D __stop___dyndbg_descs - __start___dyndbg_descs, + .maps.len =3D __stop___dyndbg_class_maps - __start___dyndbg_class_maps, }; =20 #ifdef CONFIG_MODULES @@ -1393,7 +1393,7 @@ static int __init dynamic_debug_init(void) } #endif /* CONFIG_MODULES */ =20 - if (&__start___dyndbg =3D=3D &__stop___dyndbg) { + if (&__start___dyndbg_descs =3D=3D &__stop___dyndbg_descs) { if (IS_ENABLED(CONFIG_DYNAMIC_DEBUG)) { pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n"); return 1; @@ -1403,11 +1403,11 @@ static int __init dynamic_debug_init(void) return 0; } =20 - iter =3D iter_mod_start =3D __start___dyndbg; + iter =3D iter_mod_start =3D __start___dyndbg_descs; modname =3D iter->modname; i =3D mod_sites =3D mod_ct =3D 0; =20 - for (; iter < __stop___dyndbg; iter++, i++, mod_sites++) { + for (; iter < __stop___dyndbg_descs; iter++, i++, mod_sites++) { =20 if (strcmp(modname, iter->modname)) { mod_ct++; @@ -1431,7 +1431,7 @@ static int __init dynamic_debug_init(void) goto out_err; =20 ddebug_init_success =3D 1; - vpr_info("%d prdebugs in %d modules, %d KiB in ddebug tables, %d kiB in _= _dyndbg section\n", + vpr_info("%d prdebugs in %d modules, %d KiB in ddebug tables, %d kiB in _= _dyndbg_descs section\n", i, mod_ct, (int)((mod_ct * sizeof(struct ddebug_table)) >> 10), (int)((i * sizeof(struct _ddebug)) >> 10)); =20 --=20 2.54.0