From nobody Mon Jun 8 06:36:23 2026 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.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 C47F63769F2 for ; Mon, 1 Jun 2026 12:05:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315504; cv=none; b=VmzPmIovpPaVyQpPYABu9t2PPSYUcjYV6uvME9cuBR5F2ltK7sbPf9uKP4UdRviPoTsAMOp9QHdWNwbpOy1TyLsxbGUhllMGLH2YeMkAxx4Nn+swaZWGqaMJN2lXogOkfX1PeorlW+iIZux21nIvNODoySxHjmDgIsWtMUnwyfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315504; c=relaxed/simple; bh=/BEze5uZvE97vkdxdEKscGQmmLTlvHt75B8/b2suPbI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y3JIJmgRPDRE3zVLLO2Cc1NRn5MBuzSKMl+nQpFLWSb2TDgBifDMAl2TFZfssy+0ofEbiJF2X43E5uEnDy3fiZtS2/kSk2Ypl0wPo9JhdL8cHPfBRK7VxhWE6RTnQHNB53Xgv0Rg4YGLwPKS0dyaeQdhxAU/xHTFS/B0bsbN1I8= 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=X8ZaUJTl; arc=none smtp.client-ip=209.85.221.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="X8ZaUJTl" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-45eedcdaeaaso2682665f8f.3 for ; Mon, 01 Jun 2026 05:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315501; x=1780920301; 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=X8ZaUJTlJSmPN5Lp2+drVg+Y8VYUe7hHrC2s+iTm+6b4FkIO3e6P2MkXYFG1ec5KlY ax4/vFi6P0aGj3O8nnMSeex2hpAdOHlcrqHv3ZNuIoyK2/zhaeRHWAkasCfVhInfCFGJ Xj9BZ6YzVEawtEvRcUXbD9zF34F+Ck+RkNQRStqsHaVOCYdTjXS+6695GvJDdADA7YD/ lDUVbLfNMcwbgBoLEw6LIXuqutA1Gjp5RmrMybocMbhC9NrhCNcNfvCjSEvykrrs7iAK WVSWuxl/WBD86kovAd6lMwp0DBI9Vc2itChVue2CNMo2htHRhaViBUSGYQdthbdgdCnm z2eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315501; x=1780920301; 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=qIAFCPYxlFPsrJrTtx9k4bu3qkITFyN2fa1kI5kXhx/dn8QbshAo8UKLP3i8/7a76N MLvseQDd6iau3Tgep72H5S7Z+cs8ciki2/Hj2FJMPPdn+LK5zLezL5J5D4N3wrxZF3vu uUBgCzU2Po5ACKs4d5Tua/kvgOuT25RUaAGkPQMbgBI9ng7saFJOxWpESlkJWCZbc0yT tL5E79iVK+ctmjnKiEY0JsYngcGB84rAz/c+JsGj85GNlx13J6d8WswDiaBOiWswBW8d eGF4tKNjSMnGCZP5IlpkHtpsJksrxeKzCGh4FyZfwqEBDl51+9enih3lAO5lKZ5mjnpS zxVg== X-Forwarded-Encrypted: i=1; AFNElJ+HKHWWaaJhX+tAzubmz4U5b8hojUnp3Ai/4hsYVZDZzWL+chiTttbgOVa9xfSwFFMh96Dd84NldLEUm74=@vger.kernel.org X-Gm-Message-State: AOJu0YyorMxWglXmEMENvuQWYqqgUaro3qocuLKYaUQNtGD92kesY9ON nL89g4pP/drMxU3BqL0ZUAfHwuGKAlTaA1ipeJZ8/y0bgCB+aw/i5TJM X-Gm-Gg: Acq92OFLSPEpoDWZ7mU8a1gAGkKwLz64hm2dHIUoJnwN2Qsjbo6BWAeg1dL/JOACrKD U1a1pFtiA2v0rtHFj6NORwJZM3HcXCgajp4TmBVRg0+1z3FtKa5keR6S9CuHuhFo6q1rCCRBfCz fCMIhn966xS/DmZrvbG1Apnq79QtctA/6Z/nr/9PX2jutE/8RkxkWtcKVRPjxpQkF4Qs9CtUhCM SmJPn/aMpIgW4rgLS96OtEkEcTqESjlmLev4x5KV6Ki2WDgGFzZ0e5StpGH3fjrt/3IxxzKJRuU 9tcQIWoNo1D/hFJQbKA31RnOVHRY1sUsMVs3mplSvlNmJqP3N0ZKVHdE0rwUADYbobpbfhPxNtS cg1OW5yhqQ0DSzY0ishKILTKLSZ7IhwqyaYQ/y0dZgKBpKCRBgjdh0tUeZ4mJMgf2FPPXDdkLQv keq3iIouDaGE+RJnkGUDRNziv2vRQRxN2YcARJaOMafQ== X-Received: by 2002:a05:600c:4715:b0:485:4388:3492 with SMTP id 5b1f17b1804b1-490a2932381mr196252395e9.11.1780315501072; Mon, 01 Jun 2026 05:05:01 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.04.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:00 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:47 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-1-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=2677; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=/BEze5uZvE97vkdxdEKscGQmmLTlvHt75B8/b2suPbI=; b=c8S96t+ZCXu5kmm15ytCexf2F+SACA7KqyLI8HX9Eb3WTFBQJJe/DEwNE9wWzQI9kMMtWSMe2 BCeYdCPPvMcCqA4vhxh710sNmgly3GwhDZJllsv9yBgjcughOSsHbPp 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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.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 3542E376A19 for ; Mon, 1 Jun 2026 12:05:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315506; cv=none; b=OTeYxJ98pDwdSywxMILi21/0mOFZkl8rr800aNzSc3OX1qPqJC87NDahSpXk9huDExNOItBxFm84wmWgnO+SuyXv8ie3Cxj8HEbkMFwHtW/UMb0+55AqjdG5BD/lQ7HcRqyeOKGimNhBXhTkycQJHLt7iSBo25NCGh5ZGeXQ3YI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315506; 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=uKmyK26jXVmtcNBDoptqCb44zqKXUs2I2XgCtSmBULz0bfsqA+5B4kMjq88gR0kpQpUISqfRd/o8nWuyEGt/FnKeGdCACD5uws5TiwYjCxoK+2IMI9mK+WzFChSUzoidz9ivtHewIymQdK6QgNMK/RBjPj4EYfns9f+23RtpwhU= 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=Ug+D/UHg; arc=none smtp.client-ip=209.85.128.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="Ug+D/UHg" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-49050bfe053so68927235e9.3 for ; Mon, 01 Jun 2026 05:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315504; x=1780920304; 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=Ug+D/UHgDkpae6UeG1SlmhwEpptQyKc7cGeIbceB0m0EM20CEYKERTMtsSMTn6gbSK RaLM4pUqtgz+45b5FVndHeinOjGur13/IwJGzak8WCKzpTM8a+uoTUPUXp8FHjT4ceho 87k2d+BgD2AaniUye1LTsdwCFjTwHkg1uJ1Y5RbP/tZoSqsT5VAzmrvH0XMuAm6hAoXO tYboE7CnCp+379XMUSg1+7sQewsHRaMNgsbS5xCuK1LQ6uBd2fEmhm3wJPgD05hZmRI/ DaquwYy0MbVz9Kkvh+L9pueOXvVVQ2QDYP3bccsMyrLMenCy967HxbUn3JPH5Et9rgYv OpEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315504; x=1780920304; 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=L7Btj46rGosD+FgczWLvoFLZsFTDGBnrgLk7/P1QtuHelkzEz+NiQfHMFw723j7ydq VLtz8/dAlbbCx7vq7wNF8d8Phbo1Z8Ses3ksypthu1iCbmi75NzCOgRAihsoSWeyyd1O yFaK/sVVQtr0La4i5+quVHkV/D53m0KWVNf05Xw4ZTkkEwqTLCcoKl4b6/eoQ+3C96wX mtIP5K2+HPP9uw+81esfvpsn/MGrkvuaAW4kHCHc/agft++l34DULAu8r2tq1CpZlRG7 cybDsXFMzS/pFfG5vaujukd1mlxXhbPdfP5zjbKdEFbgK64iFK9IC5hc66M1om5V9tnu Ppsw== X-Forwarded-Encrypted: i=1; AFNElJ+QJA+Wz7VUbssfKMJPeZetGn5c9lxfLRtkEjaMmz6iauR+MMgX3k3QDoNt9p+wEsg+7cT0+zlz4epw2hE=@vger.kernel.org X-Gm-Message-State: AOJu0YyXhuV8btwHk2HTUXi1DvDSptZnOwLK9oAj5afBrKk66TCB5n0/ WvlSrs2iLexGuJjwHUSgf6MKtEI/7mP1Zt22iMszpSY+4fUV5GNVtvZs X-Gm-Gg: Acq92OHAUc1bLgW6IVdNtm5PJhpcDjXJekInV/6NumQGq+3n6Pncv0rHAoT1dtwNtOP 1VhfJ0bOXjmvzu5+RWIxZ9R5XyMK5zjMTLtNIn5QUroMGHSaIblXtFHmZHEwvlpE2sHJAsvEiNi 4JeCG0G394ay45njOSrjDeh5CdhP9LBPrI3/Oce17AQ+LbR3WY1H31+J/g0xkcYTOr0pDZIQ/24 msjRRmUvjlI8W2IjbQHM7ApRR4djNQ/ZK426YrnS4sXm4eMhH+4kfF/T4mR+H0cYYtHBdyJPoLW c6oenhpcIfvHIOD7oAQGkv1pcurhmqI9y/z51ZEYhthOVe/6KGyylYBsfrQiFRwkUfAnDTpAV54 m+BjMphXn8ZYCHFsnDU/3fD4/7ph3BAtMxxD4D0kDXX35Wt8nH8EQI2qiDhDiVMZm4wFNfuJVrw 8crn1n85tVd1ixVOFP3gO4lHwzB+4jqKOt3pxirUFcPQ== X-Received: by 2002:a05:600c:1546:b0:490:50e4:7224 with SMTP id 5b1f17b1804b1-490a290bdf1mr200424025e9.3.1780315503641; Mon, 01 Jun 2026 05:05:03 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:03 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:48 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-2-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=1814; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=Ybb0kJKNd2BJDDcZYbhZbCACFsLVAC7m/M+jXCdbe+s=; b=77QENcw7TwO5sbOCSCb3za5Eh6W1VtMb7ffsLgiJ6qjsY20R6qLFWJ9u0VHPdNWz7TZVh1MSu fXZPCPflAUnCuxlFjQ2BltAWo25IThXGyLGV8vp/+SKUfZSM2Av2QvG 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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 CED1237649D for ; Mon, 1 Jun 2026 12:05:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315509; cv=none; b=ieHIZbvBNrqZO7JIJMR6Dn1tlF5iojsSwId+MFfa0nQnVaOLgCVm10UYMawpb7mkzJYSgbusUX0JBD0sNK5kBXHQBz0A619EGPbDT7qDZFlclEpGOkH8kEGwpqrpK7lntdifrm/7l0SVO4cQbzSrDVzHuTXq6wC0oMgB/9j9rFo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315509; c=relaxed/simple; bh=pg9cpl0bo1AtFElQETrwEKQ1mUnu0drU6Mzj79jx4XY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QNKn/DdGJ+QV0t8i1b8CNl2OmcCnXlUPXsAfHfQYeG66rZL579h9ygs6x0OanS2X7vMgJIUCodam8Z39Jm7MAAPuw7BrrLRlqyTQIC6u+yCxsCKdsm7/2SV4mCuO/lCiRcfx35+DRAvB52RsALji9UK9DLD+plV9F554S2tWHgQ= 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=Vgf7DSef; arc=none smtp.client-ip=209.85.128.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="Vgf7DSef" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-49050bfe053so68927845e9.3 for ; Mon, 01 Jun 2026 05:05:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315506; x=1780920306; 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=Vgf7DSef4gB0zebf3Q1+h4L+ol9NmD2RQQG2fveybXunjLHLDmAs750hKH/2pIQBmv 2y4zXSVGjw9WbdVdy18WEW+49i3p5qnA6reTvY7kMYuEJrJFl91AloSDMz9AvVpoAFI6 GFNrVcYlqPqhagOx26bFumwofP5Hnh91TeBXDBFq1pdVskJFmZZkyj1zYTnNFGz/ttN3 vODyrI2aSm70nWdUuiShMBcTcH91aHWpqtuZcG8iIYLSXljjynkj1VW0p4RfxkNlrapU Q7FvIiecos45aPOnAb2zqLbzKPO4MIXXGcOlUMRYjyf4gUlrKHDNWftPBqOg2gKak6CU bw/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315506; x=1780920306; 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=c+Q6KTreQJ6/qAqXnU+4lSXbJlQsss2r64KiKY/wCwjNfJcNymsdMm8Ac7AMhaKEg8 THVqKm1SH2nwhrvHvgWUguDzv3H/Om+QQRtA0T2qNbM6xttekK9JH0sIO78uu3XyT/mg AQb3ZMQjvBabZwGPx6KLRRISvRsh+OfkIPYIa5PXOWesAT9+A78WSXwthZjhfiAKFovZ nP6feO2E5s/KZTG5arMtO80rsA8mej9YBHBLKhXldcJ+IpDEpQZ2oBDFiqiWKn9nYCvO exlmnnacRv/FSt/Ke7ReLdCw0Bi8z9YPLCZrzIN9khj7dTROZZcJa4dypYn76CmRup6V a3ZQ== X-Forwarded-Encrypted: i=1; AFNElJ8e45lDt5D8/tkQdPX1nfyEEhdNwVuiymLITzbFpDLKjhDxCkV+LLbTbhiIDyBnSmOaaKgj49Y7fyk6E0s=@vger.kernel.org X-Gm-Message-State: AOJu0YzMhBIhW0m8G5I67vyZo9G+M3/bzeTvlzNQVInyq2vNlPdu142h 0XIaeorVk7aRCg7IwmRfpQNymLySjEwjvZcC1J746hXZKKs0z9pEsvhD X-Gm-Gg: Acq92OGN1czDbACCu909cyYLbkIhQyn/LD6ei0UKhIREuC/ma/S4HR6JIdqXEIt49n9 nPduNQwxop6acDnCZrYyoG0lPHSNf4NkvtwWXYamrmWOuvG9eI7jpQCYyzEQ7dn+6x8ex4vtRts QsT6YfqAveWMkWBhms5GqvpU0bFi4hY2Mh5h/Q5Vrj+6ZZ9VGFu28Uk7OmnFMl4NOv3NelRyiLg N+C6LNpRZksj1jFa3ENulW7ZyhkPia6fbo84nnXVkmdk9+KfYOYlq2Ie3KK6ipf+sM7ps+REeMS 94U2TH8pDvfxe55lk6jtOI1LRUnVRJee3+QHOTSGoEFnviZIuIZMGBe0d2E5nO68dEq22ivwCVy BaOKO0lHU+ESxFyo0J4EOOSSdvoDYWjr/mouNYClUUIRzPv6YLQETfAn95zv4RhEeaY0K3j7i9m Op0cXBYdldtnPdTJeN4759pfW18BfPT/WPbGl6APe5HA== X-Received: by 2002:a05:600c:8b53:b0:490:5380:f2cb with SMTP id 5b1f17b1804b1-490a28d390emr196642905e9.0.1780315506191; Mon, 01 Jun 2026 05:05:06 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:05 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:49 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-3-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=4249; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=pg9cpl0bo1AtFElQETrwEKQ1mUnu0drU6Mzj79jx4XY=; b=23QYrIUZ1wxoDtn3LfFw5w6UrO7uc0VBpToTUa3IhI2RQwMNTu3xUACitTHnN+z2ok6VpXv6S 09Unjbi/6e/C1jEzWOXpjsOo1u2YBPX4AC9D6qCB5SWs3nM4Ct+JMqo 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 Mon Jun 8 06:36:23 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 67C5B377EC2 for ; Mon, 1 Jun 2026 12:05:10 +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=1780315511; cv=none; b=oe4Dc4PoEA16DLp7lqom/gQB+OkkXf3bnkJvbylfFkZZs/cqv5xU2Zr6TTy4mgzG4xTLbscXy8alI9ezTUYK5+YWQ7kYpMfr2OkdeRX++JQN8YXYwQxpeV9p9cmOviEklWCMvue9OTFgJcbew2ZLjwMCptzjROvJ/OGus6rA7/s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315511; 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=I1IA/WpHRT51vyCjCjQKITGPkl6+9PbmBId7XqFw4ZklW+MMeDTHnyk3Gop7hIO6klK+UJb1+h3YAveUVgUJLBy4K8/d43FwDtWZvqrVtiJ9rl6hfmm0URTxVbYVhosFeTyopffZa3rm59pNGAGvpCeN3mXUow20F0h4uC9w3NY= 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=tEGpYROC; 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="tEGpYROC" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-46015dc517aso297586f8f.2 for ; Mon, 01 Jun 2026 05:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315509; x=1780920309; 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=tEGpYROC3b8WCnjNkq74IbPVh3VhTkKWIhG80fGP1fmEKfg+KnXM9yO1gHz3NOxfoW zqE7tJW3fsrnLvYSVTEAVNpbyIVfUQtL3XEXhqDT0zw+laN1w3hw+IveJ1aV2QWOMmGa +UU+aAMi1/G1SdLc7/uuGznVGII1V4BScfdziBygVqAsjl820SxueggGKeC+k8tKPT75 sRSLiy+Uvqw/100ZOTUL5j0p8ccb2n/H2p+XUTK5H6xD0xeGwWCA4ahuptlQ8iDctBnN mx93C4H5XgdweueMnuPuczAdueT1f3o9FUTLu7DkTKCXPIzO3QM+00MWxMMKpidGoZ/J CHkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315509; x=1780920309; 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=cFKggNvzc81945BwkJ6g6FWNvoOnI7hxBWpLJyI6CE3XGXGsn1pk3lSTNTgkk7wx3B p2BTngDzog41TxASI0KC6n/ccZkuHQpM1xmjwrgMz5DLDNEmnFBiMVYRuGzMn0nPM3XC Bd7AJARpflh8ew0LsvQF3ywfeiFMfioQePbvkfU74cjPdjYadLCBoaFl3ymkX5QxeOxK 2r0oCwPkzbwqmI1SELKT91nRARgHQ12j6dt1ny0jga7jAKZ1RKtrausl9zM5ZNEyBC0d VL5a1kHeKMzOSOCvA8vpDGGs7F2PJ/x1EjnWpJ0HTejPNvw0IwQhvfwEvbIp+MkQRbYP Uokg== X-Forwarded-Encrypted: i=1; AFNElJ8FG1AOHFCWlifwTCPZFeMtIj8Fx9bBrXkD8bgbBqKwVPUNCanR3l2glBf2a7XjdEHR70Uo2PQYkMUQ7YA=@vger.kernel.org X-Gm-Message-State: AOJu0YzUpNmmF2VkoJ5W/ROtTo/icKCyYNlhsETPW+IozM8SSNvAP8fI RuS9tnpLcN535AUD5YOqoN5agVKjfhlEMZyFto7rknBCCX33j9OJq3hB X-Gm-Gg: Acq92OEqYSysXjtK+jpUC0I76OukgY2c3ZJCWI2ldKZFNlfMQNIGNYKL3EHLwFGYCmo TGl5Se06pB1GwWarswmeFcxdO50dbdpCjcXM0eko04mgOBLoS6vw/EerZyrsbOJEx4Owe5s2oxg d6vrDSAkEHs0nsJ4guUAQTbZTv+3mbkVKFbvw53pBTnLteIhMqgsImr8rQyX36baiO8tFyHHQae ZrH/bhpqmjgHXxsMmKKpu5/yHyKBfSHxIIZN0Dsnn9aK3Zqq78LnPnDjoY+Jfs0EYmRUR2KMQYn px/0UlptxVSJZIy/nk7r0subhv2LcreeCCXxqvT8+OIaDQERCovvsL/Qa6BhANXOSqwEfCEV2wm XngIv8wyffgJ7gmNPd/MTAF49tzUlD5chhRpEkG3mn52NIDwhkOwJlcEoTZUwfV1rCIz1GpPn1L GrTrhE5KgxEOUSezv8uGuM94mY4b6o7BiELtVUSPQYAQ== X-Received: by 2002:a05:600d:6443:20b0:490:a1be:6b01 with SMTP id 5b1f17b1804b1-490a2923a7cmr151516555e9.4.1780315508566; Mon, 01 Jun 2026 05:05:08 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:08 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:50 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-4-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=1428; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=gyhl2dDHOhDRfo2EoLm//e3PBy86xHd/L/qSVe14+FQ=; b=odAHg/A0RFY+meA/TW8ZCLAdsG0OHafCZnPdBgvkp1M24pCVckS1yoK9eKlBI1667V0xBIsYV ww1XkipaWKzA8FtpuBJ3CTxXacOCF8vQ5ShKpVOzVqZfQjDgCRGbJXP 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 Mon Jun 8 06:36:23 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 9EF223793DE for ; Mon, 1 Jun 2026 12:05:13 +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=1780315515; cv=none; b=phqzwIia5cwUhX3I1EHBPQp72QZjMjw3P0TtMCfvX9/XM3vr5mXry8MtAl9DpKj1mTNGzF2ydQhVE4M+TSlJAbpywx6qIqIhNRtlbx8FfwY96NEl0RJFROd9CD92gnTXtJUrgjyJFoqinkpxS0g8cf8+GhSKOYmDYykW7mJVmog= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315515; c=relaxed/simple; bh=hdVbw4QKJX2tLtQU19EGleFHqr3Zp3coBIFOgLu7iTA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QjR532OXJU1u5d8DsJrnt+/WZY89vB5CqOoMzg1ClCKyIr+KSGMPoHHMPrE3Mo+XkYe6b1Au0is0EuPtWbwEGXQO3beX+E5i0U83HnUhvwzIHvbye5l0JnqAyS1BGBr518jRK+pKgkeKX9WKhKvPJ8vnl5MnBfgf59M0Q+I3eiw= 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=aJhW9B+y; 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="aJhW9B+y" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-490ac10e337so3727945e9.3 for ; Mon, 01 Jun 2026 05:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315512; x=1780920312; 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=ORGg5NVhIfXoxcjPdL/EfpbtAVKkW13ZtTAMFNgq2uU=; b=aJhW9B+y7IWU7TJC7jTOPNXH/mnrTsPq2UfFraF5/8KIhMOeboy51XDfUM6PgiJv1/ kRob51nyPKJ/OOmQJQ7d3geR1Qg/lwiwevNAGvFQYSDHzu/AYoKPQZyxSMmYPXCzI4YL F+qFqKiq77TuiG/1MrhmLLPofS9qYu8eglKTbT0n6Hh2xHnj1H0sIxmB3aNelTqyz7ND BdCp+kmNXMs1OLz53l722n0COcF+doQyZhXbZJx+a3dgKB/sj79CbUQXK54iD8yHWW+j 0lKU+4BDRlwEXVp41pZwPEPXdDsb19iY90fZgWScnVnS/lR7xQFXg6/sCCiycYNoQgzW puKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315512; x=1780920312; 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=ORGg5NVhIfXoxcjPdL/EfpbtAVKkW13ZtTAMFNgq2uU=; b=dfMdDuZ4lX0W315HifymXozDEcCOC3CsuoAgAIR8L1lqJV08YaKDFmaajwvzxus5ss Wa9vzDkRaaGnEbXlercaDUp1Po29MmOmKehinGmhj62aqJYpLgxIMWPxVcAX5/0fTCIX 4lEF/A26kksmyPYnnMIQxDBiLSzqz98FCokP2K6X6hE1Hf7Y+F3HN0xGD3e35kGHmKEp 7pweVojfRy0sXRIOFcE5aKVMUEhrbIYkWCc3dkMvTSvrmCmeTFO3TJ02tXYExt2iiucp Toan5nOwgDKSDKHx06aJrGQB5NH0q3ACkCGSym4N20qz6+pdyIc1NpQ8JAgI8Pc/Obgk k5QQ== X-Forwarded-Encrypted: i=1; AFNElJ8RTEu2goFKbLzxiu1vG369LAGsnrApb4HXvV0e1VWEYGZL0p9FQjfEcPz/0/YVbm7Tnh1/b2AXxrFwS48=@vger.kernel.org X-Gm-Message-State: AOJu0YyJUnNrPLzJRyK9T3o3mpLG2XUbVsHqkQ0HcuwMPJGKHadU63I+ vIcy61ZijnMrpxljiVoyXCTL8RaelMfq13A0BtDEkuzMlXN3Dyws6MKk X-Gm-Gg: Acq92OEvr535Yn0rVDAyBqpcz9H93N36Lpzc556dg3Upz8RtEum/zskldjX4aXnHt8C eTqW+lttdVPmh60DBsH9uaCrxMdhHeT3TEucpcRAR/TMKdg7aru4bRE3s7HLAlJH/oLlWphaThq bvabofQaBp5IPmlkt+kSWdPpLhvp08P6dfunjuMa9ZYL/c32LeCs1t9/LfptzkmvWtDogpiDXiU A6k4+0E/2+TdIsZ/eMTljSIvMbizD4fp5z+Ee8Df9MQortNriWTNjxdI6N6/IX1CCek2TqwntfG 3wcs1Px4lBDgKjljEJ1Rbygg3jpKvigfZDBC5NY6lLnm9Xxj1HijtxPaww8PSIjC9T/8ZtC8sAj WTjKwUwFGjg8tp8BUfdLZJRcfvIe8vkO4cTZeAQkFff+h6xZArNLcvaifJxM4bbj03BB1YytAyY coQlj6SX7lNJTtHm2GSxLZQq6i6rQgODISoYKsVZ1Y9w== X-Received: by 2002:a05:600d:6405:10b0:485:9a50:3370 with SMTP id 5b1f17b1804b1-490a29096a2mr146818135e9.8.1780315511918; Mon, 01 Jun 2026 05:05:11 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:11 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:51 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-5-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=6221; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=hdVbw4QKJX2tLtQU19EGleFHqr3Zp3coBIFOgLu7iTA=; b=+UHJu0jyPSMYCEvia+NsXeMmQQW8XgES85vrnptniRCpJnbA0BQK4A7fv0uWBb5hGSJT1j3dM YbsFfvPF+yAA8XDMLUtiSw1W0g6CX1Fo7EuNsjWIuAkfOYfu9rc+Y7B 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, INIT_SETUP, and NOTES. 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 complained about NOTES and .BTF_ids. gemini asserts that NOTES are natively 4-byte aligned, add comment repeatin= g it. .BTF_ids doesnt use BOUNDED_BY, since start/end isnt needed; sashiko evidently got confused by immediately preceding usage. v2: 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 | 18 ++++++++++-------- 2 files changed, 24 insertions(+), 11 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..145beb14b94b 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 @@ -898,13 +899,14 @@ *(.note.gnu.property) \ } \ .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(.note.*, _notes) \ + /* *(.note.*) are natively 4-byte aligned */ \ + BOUNDED_SECTION_BY_ALIGNED(.note.*, _notes, 4) \ } NOTES_HEADERS \ NOTES_HEADERS_RESTORE =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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 233E0379996 for ; Mon, 1 Jun 2026 12:05:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315518; cv=none; b=XRfdpCLZ6jNUioHry/7l02b+n0fQXxOov/XiRzXYkxCgrKuDHvEgzfc4PrCJkBheDz4Hl8ZkxAhsUCAWOktu1AXIrlSqDieguErJvkFWn262n8QKtfTBKkG/vrr3HLEeiXVL8yD8/WMVMiwoha+8gL/2+Ugcf3kskGLWlpBtLyo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315518; c=relaxed/simple; bh=+UeoPcUgk4vgSL6bIOBGSbmEMWJGj+kcMG3jKhNS13E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P+Apu0HhDfsFSmzYgUH9ZKN0QUY6aoxWzP2MwNx9Fs1Hff7XVSRo5YRm2woeg4mKtluAYNshRNJVVflt1LzrfDq/k0NndbVA7y2915qsi5wPJidfcnzGJDcMqb88zYeIQWcJV2tdKQcdM8Hed3FTnWMgVTCb7quF4vE7roX+/to= 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=gG7UxpN+; arc=none smtp.client-ip=209.85.128.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="gG7UxpN+" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4909e3fa4b2so29259315e9.0 for ; Mon, 01 Jun 2026 05:05:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315514; x=1780920314; 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=n9btmEwYy4mA0lJ0Eq1DfE2LNHPtUWEmA56rbSRa3u8=; b=gG7UxpN+wDuhR/no4N8s1p0sBObFvjMoumWIyBvx375W7QutFRMT+uGXAPptCQn4+Q rucni6MqDr6mwm0/liG3zQwC0EekgpkQWiSEA26FFnmuk0R8mjnDw/DzubIIDa5UArsm jpcQumHrSuQjtr1/a8uQfbqBlL7Bf5DVmYuwPmlNKesTvk8qQnE2CcVgI+C8waLmWImM 0c5vECF83xpLwQWgTTYtx4ZDNVKYAnM3O2iQfo88OS51HZcG2f9g6sAMG1HeoqzN0X4e /7mJI5NxHMMED8z3rlb2o7w/j8naZ4dJXxcLQeujM7Z0wdL7RHLkC4GIN+Gm0snxKkIp aj/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315514; x=1780920314; 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=n9btmEwYy4mA0lJ0Eq1DfE2LNHPtUWEmA56rbSRa3u8=; b=PniidBVXwmhJbUMGKJGtz0a3FyBR4VTUu7BK+4HUVKyuOkOmhSpvSeeRYOYsepE6Q/ 6XF2ZV22FrYFlNLaFTNUbf8u7IOHBvaWaPcMUIZ1ft0nL1XcaitPjV7BS/+vICNISbvT sGeI7qdFIwg+EFnJ5nvOHAS7YUOx9R7s/yhJerIGW/6FwBxAOgMi5x1j60Ts2Ge4ZuCe Q8tIDTXhYwVXScQolwo4x24KQocSMvhFeLMEFyoRnf8GdRjWhrtb+uXLrQav8Go0EH2n faOjZZQF9uIUKa+o9IiO8J3AeWlvmR7SzGhIJkuWU2tVH6Onzut1qMEWLHgFnAz3PcZb 4Ufg== X-Forwarded-Encrypted: i=1; AFNElJ8jqVJG8wMif0FPOXcbeuVCpMsKu9edl8eHZZkqzA5FgVb/XAGqOm+rHPhR+J1+GZT7nOqoMcq6W1vU3lQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzErcWfghW/ovwYLtyUDo7bWc8RxLnSt59g0w8zd9ifztix+qS8 CoDhiqayrdHrYk/GeFRdLhDSwezytTeHBw1GYd4nyFlQktd3NzyQv75K X-Gm-Gg: Acq92OFQHW8exHlho9uw80+CWV2C1XWyQYIcep0wnDabKpwt+VjUJYY3AKR3tLZVuFG qE6POb0SLrVSIFgDmDBm6j5ULGIZnTM1Q5leJaPFjYkC1tIi7CF3/I2zclLzQKwVS2q9kTFS/aW /lxoLA62zwrcFdlxPD0i5Z9CPfuXA+Qi+83oRjQ3IL0mOun6xbJHg7YNql7bp6sXu4kqJoxJ3Fl 6rMFoVcqyK1V5ZUKzUDSBbfa2RHJtWbkcVRI8ecieXeFG2EoPHJua3KuyNysJB4UmwhLDktkvs9 jGCBRkByGTGhNCeHP2YcsZG5gnrtG2BE5yYYGFufouvA7W9QBwcKWRZbgutiUKmNSe1FIXYPFB0 n/05O7N80Etl5qvHT9i7X1iij/st5SyX4N6b+cpaOKZewVm4fLepxCa2rrRDf87+Syhv8fRHrgA lB6WoXlVeAw28uJGGgYcUbHX1BtEuv/iHVFMg60dvlVw== X-Received: by 2002:a05:600c:1546:b0:490:50e4:7224 with SMTP id 5b1f17b1804b1-490a290bdf1mr200439195e9.3.1780315514334; Mon, 01 Jun 2026 05:05:14 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:13 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:52 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-6-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=3579; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=+UeoPcUgk4vgSL6bIOBGSbmEMWJGj+kcMG3jKhNS13E=; b=aehCj0PKMwAsGeX1yoA8ZPfivKihRi7JRV3fcSw/dL7t3mWFKMgDCcR0BXQduggaMx72SGO+e QFpbl8RtwUmAVWhr759+EI9HvVVPhBIXRwjiL5byPJQq8K/i+TNdP3k 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 145beb14b94b..2b1becd809be 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 */ \ } \ @@ -947,12 +936,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 Mon Jun 8 06:36:23 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 5BC70379C40 for ; Mon, 1 Jun 2026 12:05:18 +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=1780315520; cv=none; b=S7Jfa928yPJOBfCbHuePTe1kOfDSwAyowflVVELIbzrayOh4uah+a92JYZooQbq220mnMfvICJozS+saXC7idxPMo0R2GLdmOpaxxHo/qzNn0GMA6B5ky5yp4GD1dGtzNzQdcBOLZTKFqkjtb9BtG565G3mIGNgUvYQEHkPS0uU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315520; c=relaxed/simple; bh=dHDLAmmZkSEwCrVjFAbC9GSDOGfjrhwtK5sTHYbJuoQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZLk/C2a8mOCjTWrUo6pTToAC4r3cdHNbsVSUPGJK7WRCth7LAMmtVnwVAMZFTLALg21SwfgqnIVJht/enBTUNKc2ZwF/NWS2EO6MUogzbNnGdx6gwt1rymCQlv7oLkWypERpQ2MTvp7qJProX+NI7M/WyxiktV28N3xWsmcYh2w= 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=TaEdvlZa; 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="TaEdvlZa" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-45ee1a56328so4614103f8f.3 for ; Mon, 01 Jun 2026 05:05:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315517; x=1780920317; 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=Ks10Mou4dS+uM/gF5zD1xC7hoNz/3aUwUMnLMPkjLt0=; b=TaEdvlZaacjxn6igmxhyxUmq8lChVmItQcL2OA+lfuZjhA7KH+nDcTbdqgKGBvLu0I 3bNQZtu8xLTBENoTWNL+wl7lcsiKSh5XehyMyLo4QEzTrBDIXijDF6Jp0ZFWL2rH/rb4 7pPge7xcs2JRnKwhgRKw+/CiVIq2IC2mG+2Fvc/Zrw3n5odTSUd5EaAnqt9w4XdNersh xu8lJN3SaZQbhX+nYdlxBB4AyxavMF70TIr8OYFGGLCvMjwXyfykfwDzna8Rxogun2AL S/d+DL6Na8/PpSB0cv5YJb7rWFE8uU0/7yJy2Z2OSeYb1w7lLYD9qNBElJ9A4GERUQdv f6+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315517; x=1780920317; 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=Ks10Mou4dS+uM/gF5zD1xC7hoNz/3aUwUMnLMPkjLt0=; b=DAvmJjuBP+iuPjFXZuJYcTrxU/sJmsAga1+Jus/7kVGBhOuYWOlZAxCadUsiC3DqnV G4kdhJRsRBlRMKJsfX1hUbsp6TddnnHzd7eM/cYAFqguflOWHxheGQoq3LymJuTCmlqm XQS16BoXPDXm9PIZoU5o6KZzTu4NYRfM+iAq/21Cg9tE6ipfiPgVobcf5lFzoSDzcHo7 2LQytlB1DhFa+m5cm6wpYZEaXURMcXN/E/9TAaieiT5DaSn5Oq1bh3SJsvBAj/yNWSBX V6eomcXaFVXVkTch6/cRMBb3lw0sBMV2zWTMPwjxMgutvBu96HsES5OrZPwwujGYfIao h8Lw== X-Forwarded-Encrypted: i=1; AFNElJ/HucaVuxvsIVctHGLer0/eTz/gaClhQhVhX84KWvK1oQejPRVEIG+RmfCkaLRR4I8pQKq//oHMyDThPlI=@vger.kernel.org X-Gm-Message-State: AOJu0Yyj0R3mXveF7BFQN4LLd7VVQEh9mIp+Qn4q7Z9yNmYEdr1htkEm YoPvBhqBqw3+ubSS1w4Bgigc0i2LU0oSs5IbwPVDlT3M/9i+DjoGYfrS X-Gm-Gg: Acq92OHRVQSu6BspcEkJ2N3IxVOMqOY3KhV3o0kysI7XxbSEWOzxc+XWYtbDivuE8f7 weeyiIciVrYYKoulvmUzhLg3qf0sxtC8To7U0WrsL9V/7ZZ3olF7ZyN3yajHpT5E/EFPqX5ve5F 0FI4DYVn59/S3fwCz/1Afkge+IoIv2iHqJoxSQOj513ikejgUXG1nE3DDjtOE58jd+aUm1OmY1/ JS3u5r3MkhiDUnqD2bk4TrtaSZsotHjCN5RTXikBSJ+MNuMtP9bRvk7C1iyHLc5nYguTSK1x2e2 FJmKwK53bfj4dvOa0l1bObmxt5SMHZeWzijzfc6q/JT9Ogp7Hkk08ni0d0dorgVxtqAnauIoISc w4om3eXCHcN5MTIsK84JwmMp+TzZn4QPjrwUtPMOF39NAzJTQDIxrT38KV/x3/I2uVl0mobnOue gcfrE4AlDp60DVcRzPHAgcofF6FI5x4rF36R+DNv1SIQ== X-Received: by 2002:a05:600c:c04b:20b0:490:3fdd:d353 with SMTP id 5b1f17b1804b1-490a29152demr143162745e9.8.1780315516822; Mon, 01 Jun 2026 05:05:16 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:16 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:53 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-7-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=5103; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=dHDLAmmZkSEwCrVjFAbC9GSDOGfjrhwtK5sTHYbJuoQ=; b=PQG/mC/MYN8ybEsRt1jpLWzZe9n+cpYR5hlwKDJxDHfZeAenGyn9KBu5ronOwgq41sw9dE2I3 sLG903nGuaVAHed+XjjBRzw1VXV8ccy6jMlqvG3zOfNGFRVad4AcGXP 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 9ec290e38b44..6cf80e7ac039 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9083,6 +9083,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 2b1becd809be..0a1994bb8793 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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.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 3608537C903 for ; Mon, 1 Jun 2026 12:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315523; cv=none; b=Bl6sTVivnGyRhFA+2za+9orTz4j6V/yTO2ADacuQmZYxtHpZQQP03XoWESO9r/asQHITOM1JwDvrHVDPze5IvG3uHCzprBBLqm7fs0mEw+U1nNyoPOYDM+PsvohUk9TNBYFvUWGpbTPA3Jp8RnWe1SKRJhwGxA0E01BDOr5V2c0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315523; 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=XZ0c1aAme7gTo2vFXRFpQ5igPMmTQ/Zc2k0wWWAAMOy3mFSe+j2mKiSfSxwX77b6+C9e5t8D1aYz8X9ROumxUKSuANCKUPcmFEE+D3jiJfLHyuCDM3VNGTr1NFwF50YxphvbwbPDc9Y+Pe0pBiwzaxLbp0fhAIXCgkpxrk5CpNs= 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=mzCZV4e3; arc=none smtp.client-ip=209.85.128.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="mzCZV4e3" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-490a7876f8cso11451175e9.3 for ; Mon, 01 Jun 2026 05:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315520; x=1780920320; 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=mzCZV4e3m4by+nrNsGuy9P/0wDVHS7bRicxmoQYeo5nSV5OUi0icrh9UlF6JTkR4VL dRiPiypSG/nB10h/UDFkbtd88YOsie7CLbCr3/fSwba9rFsifgOE/c8gpnzytMt5AO09 v0eD+zEuWlv61cA2fIKjvkgHDrKaf/jyB4yzn08tBUySdc7nTkdZk9ruG5j4CnF3w87F jDPefr2U3ILOm3ZQO+mD2u/IDoQhIryFXA26TvUr4rCF5ZpOPalq+QVfMsRIjM36bc6U gjrEcdoB3Mb2YfuW8YobhKQ7slgomK0l5fBKA3Biet9G1VA+SC3mdXL3uRJgTUbL8BME A14g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315520; x=1780920320; 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=XiCNCpmQCjI9L0F2ApzuSWiZMYPLfT77M+pKw6NKp11WOFumya9JvHQGnNS7Zqpkmc gL3DReMmyZCinLINT1Z8O+PvB+zz3TSoutMvjdQHvSqvwW7TVUmRrSxCjLnowrTHvs/n NpkuuHFzPn/3w6ddYhNdzVOYcXhZyG50dQzhPPUInQhRi8qBPJKlmGllw9HW9LLUg/Ki QiCBIl/vTKzgfprfxNiZwwPJLItsWxm1VgYYryEHX4j6TgAKB/9OnawO9XscyPVTg4cm ZLvoBTfBlMgyw+O1w5tOztB0Dt7FCOMd6pP8meSZGurgsBLFe5OMMUjiXArPi3aEvUFb rgrw== X-Forwarded-Encrypted: i=1; AFNElJ9fTMcB3TnphyUGkS86F/Aw17MxyfwZlykabT0vFmYkFae7m/9E/J0+nqXp4wWjbTlCYlwbMODZAmJ7UrM=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/RR1+GJi4cClL9VHgrGxXHSob0XZHVVeXabAbbQNKZpExCwPM uL9/s0gPKs2cRW4sqnFEpRMfRz/QTeXAnnIFoJwzzAhzx6ThYbz9+CXb X-Gm-Gg: Acq92OEWWJJUGQXJOVMDwXT1QFwbt7GKrVkrwz6TrDfWLPDb8y2EVqiMwdS8zt/EtfD RBUtnbpYTj+b9FlBmwfgf1vvyXm68f5h8YNZwpOGpwjpDsTwNIDz8TVAdcapcBL7KglpchKH4XZ W9z7bCQHvzJrS5Bmk5+YUyBvtiI5Bzw6s6/lTPl484ddHN5l/fuWXeZqVZfjwjct5ywnQzugbQ1 Svws0csL3hfRjPFLbOhs0g2EsaX02kPIgHyiiipMGgCzdfEuTdxjUjv6NAuDu0FKOsDpxedN6ck hdeI4wm4piX86yHRinNED2rEf9uo22U467uPQbzRXLjrPIqdjlTWGJ1idUjEt62Uk4M9cYSCRA7 IFbAeonTLsm471sS32cahzgO4TmIxb5EvXAaCpS5gIGbZnzRXsO7emccTS+Kcx0hr9Fj7LzbN26 jUOyjHGS+ftJr8I4gpEnUzGCkdxAaeQrwflvu5E4C0NA== X-Received: by 2002:a05:600d:8499:10b0:48a:525b:e148 with SMTP id 5b1f17b1804b1-490a29122d3mr149472665e9.4.1780315519308; Mon, 01 Jun 2026 05:05:19 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:18 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:54 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-8-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=4346; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=ytc0P/UZw6i8hpySK2Au28vrT+KoK4/4tvvmOq28NjE=; b=+ufThVv6ucRec0InwE1oCIlL6liuHDUePM3lBke3OZ+hQCGp+ZsnENSLAGbcypyjP9YmxLFW1 VBzb0Ler2QqCfTSkZKIsWBtoCA6TP04CmDZHb1FiMbti/6RhHDWlB/W 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 Mon Jun 8 06:36:23 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 3C03437CD31 for ; Mon, 1 Jun 2026 12:05:23 +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=1780315524; cv=none; b=tJ8oX4Z5Wyn9RGwH8xEBftkCc9VyLbNk7J6VNeFh6ij1JCNZIwwSw32RzvAlyM/vSpSNbwldFet3ydygGIihMXmfxrkOp91t0ktbog/wnxX5Q/1C9SSecS5djKqslbP8Gvs/f6RBY/XK312ve/P4EDLowJ4o/MlP7tWvEXCT1XY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315524; c=relaxed/simple; bh=ifMjdOv9s5iBVhpB9m4hzA/NaIvmwyfWNqe78zgQbz8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fpW7LgkqNFdrhF8nqBPgCK+0yhhF+rAV6spYS2/BLUiZ5SgMzwu74wbmjEAR465qpHFcJT0zmQgWr2c9tlMMKgWvTRmxmK/+m+yIOImrKLDe1edfM9lQcZYNqLk/223i9JdF00cpec6hjXIeflmIjQ1RiMACCCV5gvlrBbfUl0s= 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=XrVkg5PV; 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="XrVkg5PV" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-490a7627033so11116425e9.0 for ; Mon, 01 Jun 2026 05:05:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315522; x=1780920322; 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=XrVkg5PVXznwg+aZbATtdN20I56gUrgwh/58hv9+pbGMqiXAj7xaJlpwUSrtO+SBOb JAVoNltbKlw3b/YCgBZD+y1DXNrOqtZB36PP9d8RlJ0O0aHTdYLDf6f47VFtXAgVdR8V oNFvVZD6UbD4Eqe3VI5Gn6BicX41otlW5QhvbP06MNrk3oOFOzjNBqCdVZdbd0SQkI8h lORe39oEXgUOwKHe8/P0x0Ewrey0+zR0Dl1iPbnd/wZK15gP5mpBiCAWZSN0lTXwK8g1 tVk6mzW9JJ44HxXF5sIeHHNoS7loHOCuxPSgzSjefizyO7rmcNll7R2+g/6UXC7TrFpN CaFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315522; x=1780920322; 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=BHvIqbwArRA9vuvpIlN4a+JsHYARsIpf/ljZLAkhuNWRUW/mu+wpsCJ/jIccMTdPiE qijkeqzhgRmqMkrd8CwbpFovb/Kz2adOWHjSKf60zA9+acNsNgyEcfMhLmjnyvBYBVJ/ rgmtx8nzb/LMCP4IRYBnkF3907IqDlLRhVGs+ejEiiyHdxoyivc6YADgR7AB0MV1b1ub WzxNBbdEhw64UnEeTmpWUvgslSEdaVHb8HePCfqS9NSvkGFfH1UFOTCnRJFs5BxDGuQM atcj86CWWx9JXU4L5ns/9fnutlluW7rkSLLB9QuTywAf4i8zhyMaNgO/LiYWVtkn18vE DZEw== X-Forwarded-Encrypted: i=1; AFNElJ+M/0QnaUKRZvmG4h8mJpPg7Y4NDV9xmJSx6MJDh0Gm39HZM3ciNbZVkWxigA3G4rQ98Xf1Jb3zsAC/30Q=@vger.kernel.org X-Gm-Message-State: AOJu0YwOikuXtPsWpG4lLe6F/2g6Ok/Te5XGLk5y7nm5Y4S3hMrQ5JsM it9VOJRD2PSLzZc9/KUFk+VHuyC8PqRB6cIaZdUnzyKz5jminj6ExyIq X-Gm-Gg: Acq92OF0RO/jVrjQXZ8Pd9ltQE29GC7OnRNga+8N0PdenBMfcVmT86YTQsaW2+m5Z38 czcgx+mD0rV8YrS2NeApO0xEuovDIi5870/88RHlQN+u19InWSFRGC2j52LjinOhr2ZgKnScTcj s0vDaDwOJtgx0ZKIcYSgC4/Oqi1L1h8w//7EOeEWx6LIt/mCqkhbnCZKQa9MChVuMdTbSp3fpkw 9eZ0HOLo5uh6pCxpJiKomKDrVzStQtUA0zG958fszKV+eHW7c32jqpO4bOUsRDnguTa3ocfnm7C X4BJh33GFtAZaVG86muxEmsmTO2aRL0QKhpVfCi8go73v2PYJ+ifZZCrTKqAIHJrswniY9hqJcB Opq5pDIAz/CdgiuM4PKiEPvXTa3spq7tOsOWZyM41IrN2m9s9TI+f+WyJnuMalQxlKANsBguBVW ciS4HQE/OtoxhizdDqFQ5hoGjZ0s6s2zp6rGmisA7xVojpVxRuWSq5 X-Received: by 2002:a05:600c:c0d2:10b0:48e:7854:1608 with SMTP id 5b1f17b1804b1-490a2938f7cmr143236735e9.25.1780315521656; Mon, 01 Jun 2026 05:05:21 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:21 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:55 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-9-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=3163; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=ifMjdOv9s5iBVhpB9m4hzA/NaIvmwyfWNqe78zgQbz8=; b=mCaalRPbwAZWy05AH+RmNzLnWg9gvB9Y7Zw40ICDhFM/JPQZF0PXJjeUPFSkOZHwyr2XgFYzH m1Cpsj0zzBUCiL+DlEjp+UVmoRnPewyX4K7Im0+VZ4vutjmBmnyF51m 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 Mon Jun 8 06:36:23 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 CDB75376BE4 for ; Mon, 1 Jun 2026 12:05:25 +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=1780315527; cv=none; b=shV1FYcS9osdoDtu3vtkZxROo2ne9D46PDIhOkATK8KkCArbC0QFUbeHAVzUcU/xGoFjSMv8WT5hD0CPZlNu3D5ttN/mejVKs6/7e5XWFwUgyT0mk9XLic62BuyNznhLeRA2oQ5woQ6XxbXA3eo+2FEoCs5C9szLy/dylMq69Gw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315527; c=relaxed/simple; bh=Ah9OubhC/0J+O5fnf6mytQN8u50S2Bl4xoeKfk7IEd0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VpQVX6VhbzKSeG6hvr8JUKnq8Vpmroab5vJqLJ1iPr7f023wABXUQG+CoMVHXras9FSf7iI8tzeRCmXpjyozFTrBFxIGKQvFNgD9yo2praL656E96TjIlHQ4HyTtUb8XybAUHX47H5HKdPc/IWVu2chydDFywhDv5qL5rhNr+8A= 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=AZH/IaOw; 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="AZH/IaOw" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-490ac357c55so6965225e9.1 for ; Mon, 01 Jun 2026 05:05:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315524; x=1780920324; 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=AZH/IaOw5BCYj5MyVGeetdPpxXjKM/sT6fhraaJr8sEqZzPu4o17YARMQ09KrXQICO KVYU8q/1tw2/Qo49KplhXKLieOigDS911PeCO9aSOg5WOCF3R8xtFlmS/+4lU/e2hOd0 3m+/N5riL79mvLklrUR00WloZyEZneA0Y3J4WyP2Ff2aiitqsKYeLdzJYXvVAH1BgbSc RgutmJBkYyYBzYSwlLBm0b+LpG/rym9JMMWHnOX4+B5+W/MHEDICfkBwJxfJZUtAmGiP /Q0a6B3B8VEOcmx0BE7a7jdfv/fslqZ/OFXEJJeMZbvIAMQu4AmLA310qW79w/4ihdAh JGWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315524; x=1780920324; 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=OMn6s/qX7CQ5w5HNWbupnzo+qDksEcZsMdnoqn8IPvLy4rKxv58BVDhkFiK5RdoxGq fz8eQbvnFns3aeE94AOyisHYqa559xRDf47h1ROd95vZMbkqodtfMO8duq8R4P/68KEg Y3AcJKMh5xPlvFbJxKMbXNQCy+IOiQwhnjaIC1SAlNZ/MiZyAKIVI7Dq5UUgmtu6X5qz 2JWKm00Kuogm6JPK1uHGS9MXO0qyfGx38QjNRffObmMKn32wqAwB9YqozRzNvZQtDXeU T0nWZEQj5aOWlrCnfxpP0e0ZpASMN0wuN+ZOnQ/KhUnCidFHN4wNy2T9Z9QNmKTBURgQ JYBg== X-Forwarded-Encrypted: i=1; AFNElJ8QPxGdNK5JW2qoZf9LB7MoVpF4CxfAmws1YaBXBjXyOEHqkIJcBci4XuUCkmyUW+FopvHx1nm9+FykXw4=@vger.kernel.org X-Gm-Message-State: AOJu0Yy+okxjRnwSgs6myNo1N9pcqSaOd7/AGMiLThFwqDoxbnwNWKM1 cYaiiIAeAZM9rPFos4ddoeWpZCgX/tV81oQqH6J/p2SAkOcSAR4b/Ofg X-Gm-Gg: Acq92OGiZ2SgLecd05qRbB+KVLT5MnMVdA3o772weGu+gH0TXhusJKULn6tATPnO5yD CfZQzjYCAbImAOe4FL2B35S6Zrv75V/w+HoLolwJGDpyXlZk2FHmTNJeVr42jjuP3swG4HJAJy8 PegljlEFCobEGO3cNovZBe95/PribdzUzm5bMmMnPFDb0alBxPq8BXfA6YhADGnFg/v72q4MkeH mrNpmZFZc98N417WLDY5JD7G9DB7rRZmW9GO4kSC0G1NBy3RekspWvvszFMyqJcqQqX6ia+lNJc q7CNUUZp8dAYcaMHjwckxVjn/W0n1IkFIkllY3Ss/X1hKLJM03qLMz4z0KDAA+PGfh1lWLpcTAI OiM9ungQrcvDmO4k+sh6XlXw+GOdZwn+aRlrJFSIODryoCdMUHGjaneVJNZ5ySPPSrmvkDavXgy NdFPAZLLlq1hmY6zAnlzHhQ6LreXb/g35cUB66NnvFiw== X-Received: by 2002:a05:600c:64c8:b0:490:a298:acf7 with SMTP id 5b1f17b1804b1-490a298ad48mr185339785e9.17.1780315524059; Mon, 01 Jun 2026 05:05:24 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:23 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:56 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-10-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=1309; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=Ah9OubhC/0J+O5fnf6mytQN8u50S2Bl4xoeKfk7IEd0=; b=4n65AvgYtX7DtTVqkK1I41Xodkq0iZVSmLxfv1Y6t8k120KPHW6PpndNmLzsyHWrgFjRlxjH3 1OE/Ktc1/TcBtwgSTMRYSIw1FJSESkUk8jXihxInLBxLSKTv4/NPkPP 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 Mon Jun 8 06:36:23 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 6A00F37F723 for ; Mon, 1 Jun 2026 12:05:28 +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=1780315530; cv=none; b=O/0LV7AuYB9Cog7/Z50KcLotVgPQuCeMcP+KIfC2AMO6kuR7au3rinJkJVc+gKe2iKKxoH1nDgj3jKcUBMKAd0HA0DrLE3hIst7PGSRH4fd1o4M8fwi1Er1nZ+UA0Tu9TVlkDPb+O23qlpB3ArHQRrum9uC5/4ew2/rDdvkyplA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315530; c=relaxed/simple; bh=3/WKOcRSB+nt/VjxfVuHRY5i0B3sWWTVXpV+X5m2Kcw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DSy/su57EAarbZ5fSY99XyJBaZ7mj3R5WdRX7qhwtCgBwDAiaZhw38cydvA5o759FWhmILoXJKs3lucJ/cOP9t447UHPPHjW+H30N5d29suk7EaSj3pW7o05k1KJJhS41esLF+XndzFQLOM7S7/KI1R1EhyCxs/SSf4WPznfiSA= 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=cD6EdhtC; 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="cD6EdhtC" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-490a7627033so11117385e9.0 for ; Mon, 01 Jun 2026 05:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315527; x=1780920327; 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=ouT17iaKBzrIR7K8VitMxlklOudvhENGiC0/9mkENrM=; b=cD6EdhtCPBbG6sAErDTz4FWhLPrLpJyMmMEsDikmXSBtnkdMpfhetUVx7HZ1Wtx6M1 WUJ5ncKKwjDLi2VL+lhQxV7iut3a07IocQLCjwiUN/gLIZOiC9+4lp7yJbhjQWfg4HNx w74uyeiaJN36J3aF5NARk4SwyI7OOFPEWeR78tcdI6Nl7v05wbbW0wbDiNtIhSxGzUfv Hb3aHGw1wylkqNnS8eZHuW1iJb/t0hbLNWUGnCf8/LdEE/NM/2fzaDliTL8b4pydoIT/ YosMWk/z2bcCcIE5XTVJmMB4U8vbD+qJmdFSlotMZzYkf+GeHcRrj/2vti8Kg4Z2+j9/ 3eYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315527; x=1780920327; 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=ouT17iaKBzrIR7K8VitMxlklOudvhENGiC0/9mkENrM=; b=dmIylcj083jzGpUQPgK+UKugKemG+aOqI4zJQBNaaOImyCVJd6O2H/h0gCKFkU5yZJ lF+txomMFoQlSlI4fd6foxgMiwMUxN70oziQGGRXHsPDzPmBSXhDEH1QN+RnMbfkfYPE iqI4CPaIUmNgibne1+PEtV8gh0Gcmz1w6m5KHdCXr447InClsOncwxSyZxIkPN2szBEs 0CLJ+I3TG7XgkrIpFB5djVQ2UCSKzHU2q4GF/o1d7+Ev46FdIYeZbiSoywMZ6BM2mlDI SogTfYdHPhk+vE1i/kicAxYJE/5aLTHpki93COHkpEIymiHIxPwQIXU1ay22mrCAO5iY x+Mw== X-Forwarded-Encrypted: i=1; AFNElJ99vcThRwhWxgKZPsTq0viOG8XYhMDewtGSFYhzmRQWXaYCRZsTMzvltukVe5wnwkDHVFHIcD1M82i8Kms=@vger.kernel.org X-Gm-Message-State: AOJu0Yyv/sGwz0Xo8QP6XecyKEJznwG7agPZzlM3pMniznaEihEMJkG+ F6DZufIdTm3j3ryuM/AbURbyCyE/lL4zWlX+whLz2jWyPshB1zKKfwQB X-Gm-Gg: Acq92OGzdtQ+pZZzl0EL1H3HQSgLsmA4h6w4XOt5xW2Qt2YGG9m/louVXJfSL4AHYiZ k9nEWet2MjFeKFoYBjpuSqfiZY0TM2mipFG4sjjruMpOW/cWGKnPUIzVSBCf6MKoXHC7z5LwQ/7 n1XoTSzCGF0C7rMrlIo6YvjmCaz/fgNGGTkfgM17l4IKJ/uHO3G6OONe37elhExnWFY/GYydFeo gFsA7DV8xoph5Oni/BQMjKIcrcRY6K1bNN38xeRYUV0m15UGHLWyPuACEQhxf2IuDcwBipCKeyO 1iYc3mUKKYwLSu6tFT8b6cjRi9PXoRlv7bHtrdCgFe0ETAPmG83WIIUmyWau4P2lCz8Ln4tamIv 7Z7+vGv4gUqISYF3gNFqzmTWfq6+CFMZgIjwqY4Ldv9to/N3LiZRVvmPaHVe8e36Y/WatMWEdxV R4hajrB5JFw3lyb1KE+o9J64isv4IccHLgyi2e+s9C+g== X-Received: by 2002:a05:600d:8495:20b0:490:44eb:c1dc with SMTP id 5b1f17b1804b1-490a292fbbdmr142331655e9.20.1780315526595; Mon, 01 Jun 2026 05:05:26 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:26 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:57 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-11-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=9437; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=3/WKOcRSB+nt/VjxfVuHRY5i0B3sWWTVXpV+X5m2Kcw=; b=OqeOHG7YH71FQlVqTbXNHnYKL3gCRCaL9qDibZgQmgUDjBpkryeT2pBWGCW8cJWXRrsaRaSlm E0LIZnxtU+RARDPWgoUNB4FgXsa94BQ3Y7QKeZOLUrOHfV74zA3TPdl 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 --- v3: fix name of enum in kdoc also change name of struct (to future name) 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 | 27 ++++-------- lib/dynamic_debug.c | 99 +++------------------------------------= ---- lib/test_dynamic_debug.c | 26 ------------ 3 files changed, 14 insertions(+), 138 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index a10adac8e8f0..78c22c6d2312 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 */ @@ -119,8 +108,8 @@ struct ddebug_class_param { =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 + * @_var: a struct _ddebug_class_map, passed to module_param_cb + * @_maptype: enum ddebug_class_map_type, chooses bits/verbose * @_base: offset of 1st class-name. splits .class_id space * @classes: class-names used to control class'd prdbgs */ 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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.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 D403C37F8D5 for ; Mon, 1 Jun 2026 12:05:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315532; cv=none; b=h38Wn3TseiGn6YzhKc39AAcfMYfhU/eiWEnpIc6BZTq0cTElOn6EgxFiTgyMX1qbQhZmMHPlAmKPpicLAnmfJoS9XdMA0ZJLdbeDN9rcjuFVqoEq50BtIko5Wizx4Vy1TirHOuXnmSu4oYRnnj/tQI2no1bc0NHb2TPPBUpG8TA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315532; c=relaxed/simple; bh=UEhkyuT+BoyqFKDfW8oKnsP6vZUUYVyVd65DI+YPTOw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SFRMo5WRPG/Au1v4d0EGg3QmTaIC5dvbO04SSp4r5KJ5UjQVziDuq1sgIkAc4jA/SfmY96+D/+Cf/x/WblTo86JpUO766xflrG4/MboeW2bUmra5ch+i8oZBC+wYGn1QatbyzXIEdBmrrL3ZXI120SaRYPOd0gvED1MtiCZL1Vw= 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=swfwETCQ; arc=none smtp.client-ip=209.85.128.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="swfwETCQ" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-490a7629380so13362145e9.0 for ; Mon, 01 Jun 2026 05:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315529; x=1780920329; 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=TGR65ICT1aK9aLz3a5pYWL7xsIsBQYnd5g2GK/yOwYw=; b=swfwETCQllHy8HLl27pbxCddXKW3Y3AAHBaypFWm6cKwpG92KujpJqieN8rJ4crmd7 9uApOcOU7G7jTiHIGrCmwRywKj5byqaKS0LestVISxeKyrSRRQvJ0pIqyQ9Bs3pGfg9N jgfS98psZgwQKwklvvwj5Za2buqn4Nxnf43BSMYKcF5agJvk5q6RNRlRwEfiUTbHs41u ISJ1o7+fJ57da5JJbXFZ/VLysOCq+OKIhVOe54N3NnnknmKXhE7BEH2WHXiqFKsJj6ro nOHffTKO6SsOofqPtxE3eH3htgdYkovWOHgaRAPFB/YB9YwWZwYQiF16P22WNH3mAqmA QJPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315529; x=1780920329; 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=TGR65ICT1aK9aLz3a5pYWL7xsIsBQYnd5g2GK/yOwYw=; b=DR6FADp1Q+mn/0Dtrmr18qLEYDaQu4JSgofKk5Ov3MgvbUtHpKg4Vq/jza6md6qitY LeX2V42vGl17s1lKIoLM0rfOfbW+i3MPvDUcp3Nw5vAt23fy7jq3XXL1v3qtkcl5qsMr MNJrnxmxFImLYwI5Hq3cWCknUjG6v8vKwdqsxi6xxGp2BXNpK2ffqiMmUFJA3/CwaEPZ ZRqfkQoktnhPUU0WsODOU6LfmeNXOqx8AUIOzYQE3imy/BOl+w1qaMDutqF08zjHIoij aIpumibIvhqyQjzDtYQSGd4vy3algKwU8CLPiwjycoziMHOkK/5XBmMHVSZQSGefcQGF g/6Q== X-Forwarded-Encrypted: i=1; AFNElJ+8qqdIDms8pUZh4kPwA/dXFr+ANBxTu2jL8smFT7yKDYHsP22BDI/vwu/S9MejF9ipPrYWT98mNCi6KM4=@vger.kernel.org X-Gm-Message-State: AOJu0YxY+q/b35vritzel6XY3XDGkqW/ufqt2s3qzGrCchdOJkgrFUO/ VbwgGl2wND4zKeFs1JxJNVpM9EzwZfWZf4E/JFVSmhTVmkJpvMoOMEGX X-Gm-Gg: Acq92OFLYPXYr7NqEsBm46Zi07h48WNdwGFvRAjyC3R67JKiURpiRwAhP3fjSm6BwSP ZngtuEkMWjJ49Kffs/NWNmkfhiu3tg0Rb0W++FNo2o7fZmJE4E7lGEo3lP7SGTcaOYInuMcpgG0 qBIlJs2/ng3nbcH4yreSCAd0JNNNMYwm2Zm9E0p+yWs8N7owo0Bl9XadJdD5E6DdRAPS8gqZ+UZ 0tDHVXXd04pkFo53WGB2WC5w0Jr9W31hlWVCv9Mlo93zZyTcI+uRfEv5ulwhzPssGDl0PCzM7zU eS/n/TMxmo9fjGi082EJWZUcmUdczW+8h2Ujgoq52WuBMnbnMLMMdQSPbTpZKhRhLc+s83S3iHI ltyJMoxtkOdcbJfM4Gt5vpyXoUZOXQBZF5OilXUxqBfQ2mbWHKVOr8nlk8Ht5nqZHswZ90Wo8ZC uC2y/vH4Bi9raLB3pSWUUnj0g6T3Zr75Pjo1AUK+EHQg== X-Received: by 2002:a05:600d:4441:10b0:48a:f18:ece4 with SMTP id 5b1f17b1804b1-490a2948034mr141224245e9.24.1780315529177; Mon, 01 Jun 2026 05:05:29 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:28 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:58 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-12-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=1065; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=UEhkyuT+BoyqFKDfW8oKnsP6vZUUYVyVd65DI+YPTOw=; b=6Dddfxtl4gMoLaO/5GP5/dyVmNyQOwcvkR2lM9WQtjic7D5PcmUL8Jdh/MJm8FRhW7WSKe5fr tDjKU6mMNzBBSyBqZxxHUogeQgkpnJ46lIJQQrTED6k3CUybbznd6pc 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 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 78c22c6d2312..867e3978675f 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, ...); --=20 2.54.0 From nobody Mon Jun 8 06:36:23 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 89C5738F236 for ; Mon, 1 Jun 2026 12:05:33 +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=1780315536; cv=none; b=OYJ71CVdViHKB5LgycWD6B6BNkFfNDTjmJtPdW+//Nf8uU+yagaZZrzyh/nyGulOrMS0+yCsj3bVNOgIDQ6ZG/mAvjm/LVNi4Z1jA3Z3xsqIuaNffallnDNYhUXx5vNiJpyNsgYlLtKwJd/g36jR7p3DGixT4vUZkME+t4rvN+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315536; c=relaxed/simple; bh=DidtLQdtySXkRLzEbeRMwRKF7/hq+UTu6iYkRqLCz0k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l8SATqbEGTkgCh1Vkd5ngME6YPzA/dQt5X7vQhLcH4kGSXZlSroLD0d90NVxMotlhjOuH3u4MW+FIxWuj/BItXXWhsGTPOoV+yh+cm7xE9YLzfbi2QIHmSKrFGFqG67qy/QZYvMyHJr8Xr2vAM7oFwYw1vPNRhjNKjGsEyx6Hlk= 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=nLcC2WSV; 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="nLcC2WSV" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-490a762db7aso9034075e9.0 for ; Mon, 01 Jun 2026 05:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315532; x=1780920332; 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=b2M5oRZ/p2EuYw6GIpW+wKMVVLqveBuY5+15T3rurn0=; b=nLcC2WSV+ujaOeeXwgzhy39iC1s1graeI/WuxkQ5gxAZcs8yEOe1K2ZwxvlHS88e4p 05BW2T2XCnOEJNIpn6J8AxqYc9vIU5rknIBwK3NaJVlLW19WTrZ88EMwev0QhWlAJVXf PMcRXAqpMUgKHnCwWKUQ33r/i/CwVtlsTLEdzsnqnnac4YN1nn0ozUOgc0NjLKoSYKE/ pVFh2MmOT9AtvTHtb7L+TwRAVwbnGdFSHtdHgvM5GI1lejz2yRO/pLsLQWRvWcHjkgF0 n9zQ/9Q5JCVYqKP5RD+8lG14x/BgoXROuVIOFy81N7jO4KaVtiW8v4ljqlIohw8q2zgk mxkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315532; x=1780920332; 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=b2M5oRZ/p2EuYw6GIpW+wKMVVLqveBuY5+15T3rurn0=; b=NU50FqscXkjbEOgdW/IJJ84nSEAsjOqqTMLga0mTUT2JXH+7nB2slRY9253vWFBV5i PzH5wiNO6B4newS8GgMhz1D23xwQ2LsGmh8N94EK86uEOYOagkyNX8JBi0LwQSueAen4 wy0yoEPdjvwCRKLhBHiK82YG3PC1bhSkoUhMibrwgk7Tw4H9xQdU4mQ+iiAwWebH9KYi BdzLLwcZXFaKDqyi96aC1pidXaXiY8DV171Q2LiCztRk1bXLOplfPyp8yF15Iuf2dpzJ DHhW+ySg4afhTQHYonG//JrOB6TxrBuwHOCecEKEz5cbJocbVC+qkj8Woauih1J+tihq sdcw== X-Forwarded-Encrypted: i=1; AFNElJ+VuzVSLfOFHA0QvaFmPOqjcwFyoDmyduEy6PxpPXAbiX7dKdqL/ByvN7dz197M8DColzgiFNbkSVLkxNw=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1oYYIxL+LWpyzcEqdDRki2W8f0Aal2nyM8NG5REFTdh+s3uJT jLidpI1XTwa6sA9KNaH8t+a++aiYo4v4hkuwA50iFA6IogDAJUjyp4/F X-Gm-Gg: Acq92OHRfQ6+l3/+MazksQOOJJqr/6i9WeeZ7rU+GLhvXEGwmdxkpRKoJK/hOcHKILL Xif3xx2PZZkqLygJ0AqdlxZhuI3l5ISvuxfgXrnLclQfJnVkOyL9T5F/iFWgABHv2yRRWC9GKmz QaRZizjJdsYYAYT19Ng9It1dzsfbBJ8Hw1y6r7T658H/zvf3qZDFwPost/B43t5I8mNW2ZcQawi 5PSAiUS6oQ00NlXp24p0QPxa6pwo2kzzn/K/6me80R/MepDQNPYpvWXhfNOBjWCoyokT8rsHHdL 585uNwXVicomoG9cxl6ya2TR+bzGKhEWYP1Egzb2/eHF7s4taFYWYCFORyvj5bHVu8r/uQKOrew oZP/Q/P852JqDK/3xYi+9yndROWiGxwe2MP1vJiIYX2my1K6p2UltHcOnVAByljo43S5u5R+QsY jnqU2OpVYPV4bconCQBtUs7OS9mT1Ll+29VtzwrAEGYw== X-Received: by 2002:a05:600c:190e:b0:490:a9d6:8f2f with SMTP id 5b1f17b1804b1-490af3ace6cmr14372945e9.4.1780315531775; Mon, 01 Jun 2026 05:05:31 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:31 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:04:59 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-13-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=4140; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=DidtLQdtySXkRLzEbeRMwRKF7/hq+UTu6iYkRqLCz0k=; b=YYxJCdy3bIfqzVtI7FPcxytUyCArgoEmIQX5xynIfWnMP6R26XQ00vt4jmSbcsr2kARUaWXJ8 I8YccdeO8g2C/E7Kz7Hlr44VpQYzxfYPEdiewhboS7gJR892v3FDMlw 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. drop-info-parsed vinfo-applied-nomatch --- lib/dynamic_debug.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 0377d9f8dcd1..bacb55f960fa 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -276,9 +276,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 @@ -487,7 +484,6 @@ static int ddebug_parse_query(char *words[], int nwords, */ query->module =3D modname; =20 - vpr_info_dq(query, "parsed"); return 0; } =20 @@ -511,7 +507,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--) { @@ -525,7 +520,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) { @@ -541,7 +535,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; } @@ -593,7 +587,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) { @@ -1159,11 +1154,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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.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 3DB3C37F8C9 for ; Mon, 1 Jun 2026 12:05:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315537; cv=none; b=H5xURV6Fgyo49PktTTZEFdKjeqH2E4W5ic27pf4XiQPrELyq0ArlkoTb5nhTfmPf+Xd02e4bfeVH+sCN+2X5snpT2AgA/hefE0penao7dZEKtbYEIiRPgmieYLytwU+wNHqxes5fLhFVr8eo8PMvbuKPaSvJjRVf2CKXDcwEmEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315537; c=relaxed/simple; bh=wE8HipMBgsDV2SYPl2IT8AHkLvxenM3w3wQOD/5dutI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PBAAtpTEXwETK1r8Qg4ITMtE++3+fKfGjiH6wNy6SnVBWfdeL6dGKlDlrtHa3wnSkxdfUM90HAJ665jqZflMFUtsq2Wcsk3C8gxaCwnUhhXNYToldWgafWoon/NcYzZ2P4vAECoof1VlV1S57zpoum8jV6cxF/sPpIbsjZiLNcw= 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=n22PKk2a; arc=none smtp.client-ip=209.85.128.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="n22PKk2a" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-490426d72f7so87844485e9.3 for ; Mon, 01 Jun 2026 05:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315535; x=1780920335; 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=DLgvY+msik7zixiHEqmkevZB0IHgZEWTQtTUruSN9ps=; b=n22PKk2abq/wviVfnmoozPHHElFAcZTrGSf9ywdxo6v4W8jp7fLDkooCJuWHFdLgOD agKEzA6vcOP74tQwybGRfAv03lklqDe/1TVNEGx89eBzdhLAJpdbbHxE4oSHatfmccNn 87W2wkpE+cFs0eoKMFnirtWNwZ2idFxLA6/VAR89EseV7dylkf+KGZi64hDeFvMFx/12 9cX38ocm56+NvHojmpqhLJu2Z8aiO5yFMPhLNo7qDYhdiq1TH9I/fKjRsl/HU3XI8eP1 WU1oGa1dPi9wjK/Y/jK8sT4WXG4FkaYHT0i9y4+C/daAmPCZ3yutH1K3BL3Lu46Q8GWx dDPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315535; x=1780920335; 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=DLgvY+msik7zixiHEqmkevZB0IHgZEWTQtTUruSN9ps=; b=Di9nNogOeHb6bQUklXLRyQaji2IhQ+CmON65gCsD4XBfAGmRS/BpwuNULVlO+mkFkx SYZ8Bhq1xtceOO2vjRkNIfA5CnnV3zIYOkOr1P69xFGb1TcM+YggKNrelKY9wGHrxQgE r7v5WbKsXQZUOkUGL4nIqDfFf6bMWe5Aay0auwIoAp/f917k++9XmhNnukkB+ZlD+BUL ipH8VqpesEZaHy4sTCB7MIgPCG3KKBV2ihrUVWPdl+qLogjTPdrYBPUf80XcI+Owcn/9 MCYivm1bdQzaodAO3SKGJwESItTcTV6WZzXdlgKbafsc5oDxCRSQSVbNQ8UCwhzq5HNJ iZsA== X-Forwarded-Encrypted: i=1; AFNElJ9sIsmg+wSWcLMrF98JXbXQy2sU6vu9zxCf3Wf4+tThoriYWf3dN6KB5zjYpRTQP6cZVS8w+lz2qe7dlII=@vger.kernel.org X-Gm-Message-State: AOJu0YzrZ8QmGoyMz0YgvM8R7Ao1c/t3Y4hUHK1J6zp50amyIE6340nN EWJp6dHxyN3FhmWDGjw8BFTpvjCBNX37x2c5qSe7RyPMmb9M5r7d9u/i X-Gm-Gg: Acq92OEV83tSqXqGCMSSDFCT2SytSjYAoqkCtViMlRnxIVvaHGp6OI7gfJpWzXJl/DN QjxbzRbpr38yaLnHi8Nj8teXAYJiPZWDujGrGDiWynIwc5m8WsOOt+yRqfDpbjuGIx/uWQZUyYw JHV4VprR5ui5aWBIMwasKybFnSV9ld+ZxMw+QT63Z53+h/tzl8mg8JtD8zlk0RGSQGW5tG9djxC /Y7GLmqeK2YzMP2QlfjU7qSY3zRBq4pneilXOvDae+c3QgTWQR8VRkDp097EETjgrv88QRS9Dpf WbLfFhWu/iD5kulr1gVnUOURwbeSjk0AlXCQit4+mkQzAveL+nzz7jJWDMQWIhEEloTLPQjfplo 7kyWf205zdzMbCHTHk47MlcbKpyJq+lbnUuZtyomzEZ7D87Hfg7C4H8nchhzehFMtGosD69pAUW 9+6EcywBgSo8YoxEln8NeuCgAUu8gBx7kO48+bC6tVJg== X-Received: by 2002:a05:600c:4f87:b0:490:abd7:fd9 with SMTP id 5b1f17b1804b1-490abd71214mr47977395e9.10.1780315534403; Mon, 01 Jun 2026 05:05:34 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:33 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:05:00 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-14-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=6146; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=wE8HipMBgsDV2SYPl2IT8AHkLvxenM3w3wQOD/5dutI=; b=6luAckFtwBDjvRrj2lZ2JAoTCE2QX2lpjg+z7ttQIGdmO7+EslosK9PFS8WZeb3EKbwqA7m2/ gbPklexLtWnA9PUn9sPtMa9ceFhNXHUib856W0frIxb7C/kzvtF8pVV 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 bacb55f960fa..182b84b6f6c5 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -608,9 +608,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]; @@ -618,7 +619,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)) @@ -627,12 +630,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 @@ -645,6 +652,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 @@ -652,7 +660,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; @@ -675,8 +685,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: @@ -689,7 +699,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: @@ -699,16 +709,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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.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 C915E3A3E76 for ; Mon, 1 Jun 2026 12:05:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315541; cv=none; b=B3OzwATtJsJVUnVS/LPA0a/8WfotwjR75QEKRc0TEOQp9j5WbiV+U0x3B1MTv1/LBWwEXL1otMhJypfk9AiJrhQrhzyA3VED7n6RM9QdRiZcryhpa7q8cT7OUAYiZ4lc1P1Bhvj6R+/u8cb2Ygh87x9qRUurcuJtPSlmjPcHccs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315541; c=relaxed/simple; bh=qrUOU8qnHGg0JvQozawLRdf39GqEwr6BMsdBUWY+zJs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RFB73MN1dbYKoLi2396cSA2q9iRK5iRKABzYVNrVkHrzM6S5GUjftYeQOciaujWkWWcimqCn38vLAJU/hv4h2ETWdS3uN1mz79q/f2MS4XHNwFzJws4xpQ7WnGeKojvyN02l1mXu4qlX09G9sBYfzBzCtD2eoaMT1QaIULUzycw= 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=nykfcaGD; arc=none smtp.client-ip=209.85.128.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="nykfcaGD" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-49041e84237so82060305e9.1 for ; Mon, 01 Jun 2026 05:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315537; x=1780920337; 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=LWYGhk2F/MyqS6FkLrsC1PXV1OSFLSJSVfJ4W+L2Bjw=; b=nykfcaGDKWiy6jwWwsuE+Z/ATaiThMTLv/3kiA2Eychw6D/wheSUN+crOSqf/sqb8A S8rxwOSqL/K2wvAxTXKV9nz/otQ40BA1roGeC/10oDEliigpZKZROPsXEcJdk3orUvGi 32it+Pq1rDzMF5M5xuXuHcZF5lzOm9F44mznsI2K4tN1KePoI43fqWFcuzn5WIUyLmXk M5XvfU1/dkawxz0Wa/+8xsjV3/9mETt9BN3huUmlk7Js3SSoAm7Mmh8rJsdoDk+1hKTW 9lcbpOcKJn0h07E2vlRsfTKPohg+G+vufEjjkLsI5aERbic1+CWgeUqIlPfNOinHs2iM sdxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315537; x=1780920337; 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=LWYGhk2F/MyqS6FkLrsC1PXV1OSFLSJSVfJ4W+L2Bjw=; b=Xl8OJZCqbGl2vsWBwcNY0B+zpx19jbFtF5YB1+ryjsTsZsC3vJH9H8WfDm2XTpPGUG mxjgqRs0iV31EKIDX4eM2xfM2b9IeJlJ/3n39JK+h2St0630BIy0xk0tBJbtRMBzCt0j xa+v9agJlvoFktR1L95ItAPTbRC34eo2jILWlhIYZ3kNu1QeZRe+/578hqe5Pr1aw+Z8 uRnh3GdxQCV4nFEO3ztx/M4mn/2EJS6Ilor5RdzVotedotm1ZG+yAPGXcoH4i33hq6JG EqMAtuqdIqkCSp2ceRdBvFxrkMmqzwfH1pBKRBM0+Fa7HHTpw0I4M1P0lAMyBiU+pBrf vmWg== X-Forwarded-Encrypted: i=1; AFNElJ9zIyqJS0fPLf0yiDLs9ChBNQ4OMzqCxcolapqxpxyyk8b6NCvmpk24Fqe6qtXMqN8ne7ZA/OFozbqAvTg=@vger.kernel.org X-Gm-Message-State: AOJu0YxEpAgsY7JBTVkNR07hdokXjUEbD8PtDN6po4YDZSoQg69Cc1Rj PdLX3MmYO870hxcVcwxzSdXaIjnwG2XKoJ+zH6Jya2QFF2lHij7ZZAmM X-Gm-Gg: Acq92OH58BwG2BGKpkeRkOCbgl8XCmUDfqCC6FCDEApLq/1oce3j5Lkc8CD+K+MrVnb GJRReCBEeV90+NpN2WhVDO/P+AvhX9YuCz80mZSAL86sFPw8q9eNX2bZVDGquEZvO97i4RCafl6 ghR9qeeO9b5XKaFwuB4khQYUxfnUBcY+5Z+5tJcdS19GBtq7xQ1kuEaBRUiwdqP1TgR97n/cLXV 7SNhaesd9ChpA70Vq5RQ2kAGMGoGGiy+rW9a2SGeRgJIyLoRPLwUz5qlEYYieAdOF5aZgcRI06N 1FKz5iF27isO/KPQnkLO25UhcrPPgPz0RpOKsyWzJWKijThu+GqJ97VHNlUmKrh+KXjGZiHSTGL 8NwSuTltPYAaJVJ74BaI3taVwcPZzZozvq28m74lz+KDFAIgqe24C2rQo22l0JZXVG2bbGXUMp9 YluJ+yMPaM3jXz3nQ+mojhK+90vqRwCO189Wk+eJaOSw== X-Received: by 2002:a05:600c:4047:b0:490:afd9:93e0 with SMTP id 5b1f17b1804b1-490afd99800mr2527795e9.0.1780315537003; Mon, 01 Jun 2026 05:05:37 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:36 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:05:01 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-15-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=2913; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=qrUOU8qnHGg0JvQozawLRdf39GqEwr6BMsdBUWY+zJs=; b=XmNB1fBFswv081gt/z1FJsg1wqGy9IGRATjjRtwSJGRi+5lebAnhlFPLse3F6qDEwV+zvZ0GH iOECBesKIdkB+6EBhmJin69PnZREkOeg/nCqW3L12Y0nksUfKl9Fqce 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 182b84b6f6c5..bb7e16d38f19 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -610,7 +610,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 @@ -619,12 +620,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], @@ -636,9 +637,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; } @@ -686,7 +687,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: @@ -699,7 +700,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 Mon Jun 8 06:36:23 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 1B73A35E1DA for ; Mon, 1 Jun 2026 12:05:41 +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=1780315542; cv=none; b=HFTX1SegQd84eRe9mXhWWg3tSIeaukOoqjnT04hehbPbyx1LcafOVjq8ZZZnD+7qM4TU5rTVjiIW4jlMxsx0NHruvf5SYsJfyaHRtfA96QHGsCFJqq0IdEGCeMdeh3mYEXtjYxeYzDqfNI6YqVxc1F+GUR0ZExH5XsJbwHSbtcg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315542; c=relaxed/simple; bh=8WCc/AQmafTM88wpYes/98KA5fKAXXEB1IR6mZSzU94=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZnAB8G/ssoOGci44j59mtu7rUJPeIO8CDCzgvuqPhX2lvTNn4dJsvDPsAjNZ4TPmGO/gWTpmzyD8/jqN+U/tSNLj88aA2uKCl7fDexr3cXh2yKLma6vGIqdf1XXvGzFWFAlX2MoD1yf2vfr/bOUlxKDhWRa5suA2n/IHlo7ZuWc= 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=JIgt/lhM; 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="JIgt/lhM" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-490a765e68eso10958565e9.1 for ; Mon, 01 Jun 2026 05:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315540; x=1780920340; 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=psUPNABkqP2HblkW4UQMkjLqK/FIcVyd+7kBKIY+9Ns=; b=JIgt/lhMSx/APN1s0ZGi0eGpA4yHxB0b4S/0mWkcArdF15+7M40wI4cEQgTbZbhZ8R NbAE06uaADDSNNUGuq8D4VhOc5CjtgN7L9CvAfwFdFQgRHrdS+Kwc6BKfIZUYUfcmstO Mt6gkbQb3wn4EzhK4mlAOPtSVZxlnkK5D9sRVZcUmbPSonLC403USh18uo5Ja6nveK56 nwihrDezw+FsJ2J3lyHncx7O/F7VmbhqP5u91O+cI4KOrtW1KvXQD3Su6lUBDJcvdRKJ +TqTnveFypqfEVOVhSGQPYZBrClWkX+1rQUA6fwQdjuVLzQNURGYZTTMinn8Tlhma2pE 3QVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315540; x=1780920340; 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=psUPNABkqP2HblkW4UQMkjLqK/FIcVyd+7kBKIY+9Ns=; b=eZ3XN7+IhbKbgxs9ToD0Z1rypR89s0qDrcDfWkXjvlDRN8Y7X7pyHYTwRjJWDGsaUX n5Bnxzka/BvvSjzs+suLPJCW7i2/7i0s20WYzR6Fvtyk+AOaDAO1ab+0TSbTRl7bxSni Cd7R3ypNmLC3qaLLn7FewOafdS8RJVvuEtk17zOsdSBSMnFz5VwA/3mN1r9cSiiK8rU4 7dGTgeRNMPL1G5OqZw83Body2URnDmbrfgNdX/RtyQtXiNK5xcfRlq73MAa3iGi1nMDh n2YWpFq9+G5J9PVlFMWUw0l7NWDiiqI+1IsQ/lVrMCJ8oBWYq7qkRQhv5vR6kITxwhjB ii7Q== X-Forwarded-Encrypted: i=1; AFNElJ8gPQYpjAc8V7NTEdoi0+R9Znt9qpd6s969W8aaLIxnnxj6YFF+31HzzeQIQDG0vo2ejapj/llH9R0q+8g=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1Fa7dIrLGxcyMkR14GnkW/YwPgZqexMCyVDKud69d6bpPGQsr 3vaK5P7nmJvmf/CiikCj02pGT3OVcGd3VYvBF+VK71CpNOHKfOuUtBCj X-Gm-Gg: Acq92OE+6NPy9yeByzISO4QAHDy2SCLsrsIrxjpzxms6KXx12zcZrq/bKBmq1xmUybX DAp0mdLZyh74IULsgvirRMIlWkn/Agt6bqWbIGlU4CL8ERQt140B1oX/TERqzdc861W+OHFSW3b 8S8lSEQ9cl0QtSqRRuizS9vH9uY11NoeSzWhta2NM9OCq3iVl7azu9VCBZj+R5QmHEGlMAwlHs0 +8tUSJhYEJ+ger+jHD9DhCfo0bebc8vEr1NTQd0nHUhcGCatHzcPMBMk6USnNQW9dDVZ6bzliqV oKqJHWiUGcXyuGWlpXvNrc2KYI/8ATWEt2pzPpaklinA8MuoRPdsZHsy0aXSgrMY1TL+Proy9K5 m+3W8T8r66EkplONREmApEX+iUfwpgVoAs9lLYxNTv1TYkKwoCasYfoxyBR3O7oCX7MoCkbNljD ww6mX4S+WQ+wcyGq059kQEIFE3WM6eKl+i9tqFwQN6yOeseeuN3ek7 X-Received: by 2002:a05:600c:6214:b0:490:44eb:c1d7 with SMTP id 5b1f17b1804b1-490a297e571mr244455875e9.30.1780315539522; Mon, 01 Jun 2026 05:05:39 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:39 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:05:02 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-16-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=6627; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=8WCc/AQmafTM88wpYes/98KA5fKAXXEB1IR6mZSzU94=; b=BjD5WAdaTH7kvHi8eul+ofgcHgnzf3gOV8ajOPS8GZk/X+MyPdcJxzy0lW6SPdRV68tdhY2+U tlTnnUrLcHYAyJJnECmztA9CYP+DuQxdktTirj4eCXhXYOTAL57yCVY 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 867e3978675f..0443781ed95b 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 bb7e16d38f19..34d002e0a08c 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -45,10 +45,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 { @@ -149,12 +150,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; @@ -165,7 +167,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 @@ -227,7 +228,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); @@ -1062,9 +1063,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 @@ -1148,30 +1150,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 /* @@ -1203,10 +1209,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); @@ -1319,8 +1324,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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.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 AEF3E3793CA for ; Mon, 1 Jun 2026 12:05:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315545; cv=none; b=H7+hlLnWKlReES9uJ59jakgPel7SjMmxbB3jYWDmepqDxpOCLYnCc1zb0vOFQdvFgLAcQlfvD24PdXywKt3Go20+q4AMJGTncA4w2EFoO7+uR36Nl82YrUsg/WbL/g0IVT8QgafG282e5vAvpkR0/A9tMcJc0aLUKITfj/KWkVE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315545; c=relaxed/simple; bh=ZfklE9gj7vCfD3eea9V5X8HvMt8Vi5qjDtQN6GjxEN8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g7QMghbbY+9fpIvy+WvrUqLJDgE2s3u4mTZ5NujdZmZkl2LKwU9/+GPmTJgzoySnVbmuwGYoegjS/+Q0zb5g8m31og722oQjIWRr3WkwsM3HFynJbK58LxNEiP16jIT4yjT2W/Ih9b/X9G7G8EwQelrrTlJMDR3fYvUQnztyWUk= 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=UF4Q4I/U; arc=none smtp.client-ip=209.85.128.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="UF4Q4I/U" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-490abf12f0fso3280975e9.0 for ; Mon, 01 Jun 2026 05:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315542; x=1780920342; 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=ech87mZQ32X3CZj+LUnUER+oXQssLV3xJ3OsaeZimlc=; b=UF4Q4I/UHe5u7yhuJwOZSBuIYlvyRpK7QE/Wz4cQMkXgVNSQBEpSItY2c90fj6DEqX rk9PFniK2NlNoXgrstfaYkNOq56kfIrh7/4y19DAl3GAFDGjRIY5Bnzd1AoVZMXh/Ubw 43dSslLZS3N0ZFKDl+q5jKq1LFXgQ4IcqWaZ+BjXD9hztW5uGTQQO/tdZ8OT69gy3OKs BfHmDn4gktezG6iJsCP+XJ+ssznG9qi++Sjsw3s0aVDJcbYefgdAYJBaNQmyZiVTftz0 ghLRJFwwaalVF/ilof4vjPEFVDSeMyLdy6KPUI0lYjB+cMAKxa5VX6Ur50MRL8xPBawN fp5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315542; x=1780920342; 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=ech87mZQ32X3CZj+LUnUER+oXQssLV3xJ3OsaeZimlc=; b=QCdvMQQrWocZz3EdLBwOO2VS3Yuo3fgCOBKgUrOD/o0tiPVf3SNoqsY/OKGXG8hIOo 5iY16HZl+cGDFdQlIXXNMNhkf/wGk6GpISGGddrudr1IubOtZktGg0Shop1E94Ssa7iv hYsP3Xn2DaXNfu3Ufmd+l1dGtn0eiSr6OjHPWs5ELSCtzg2gSTHoPlP/8k7+BK9U/Akq s9DxjtZC767WJsWRo8Y6BsbQ5NVMeJqt8YrYVPW7DRaRE5B6hJoBhvfnyaXXi1tCrRRD gHZkUiYry/lt0pDPvvFgKyX6hIlj9CrsWhDaKkC+a3N/1o+XPkxPQ6Ri0qcqncgLYl3g Voow== X-Forwarded-Encrypted: i=1; AFNElJ/q1clBrXI2GQvIulN2EtjHDRgYDR2mWcYpsrEh+5hjOf+fwD7S9fJzAKzHSKM5BdCJmqSkRawTzUjr9SE=@vger.kernel.org X-Gm-Message-State: AOJu0Yym4pDiG4+sjWKizU3fzOEpzYOZFGKeIFpe0WFmr93GNWf6yWtq TlenyP5T1WNCG8b9z4nPpsO5L2fidN0doTeYFBG3QKxXklQpO5eh9Rlf X-Gm-Gg: Acq92OF46R9uPr7oTiCxZjIhUZ5DZc/6JkszbOuy4HrA8CNF68HiXKErFqQl0dLdOfZ Q9wqoblGTChpUfw9byo2rNkMvQOIc/5ZKl6P8RlIeFzebm+WCqU2ke6ZdlYsfWrHqrTrUlZuR07 noeD7sHo9ytgArY5Vdc7lbF2TJ9Xwjte48OHpUvmgh7THrzhgpcgRp8xk1EvksOqUi5WCsR7L1N f9bqJC2tcAZNalp/4W73HsCLStvBrmxj135VJRCjgqqlmtT91L5qAaH3xN8ySdTh9SSEE6OaiKn 4pM5EEdzfmqh6w/QM2kYOs+u/1+IkWvYKQXBZMjcdCxyl9Keo6jKpwr6VAo3AWCb+pdorFnpzaC i6FTwA3MNTz7pvx9Er4v/hoEDE+RrwzytQehdpdhBjhbDp+wd5FvZzDct/28G2D2hRqtvk2vOcP Y+FUkw6cVh1tPcluHwQIfjwZgNOoDHvx6rgfkcZmvdYQ== X-Received: by 2002:a05:600c:1913:b0:490:af63:2cb1 with SMTP id 5b1f17b1804b1-490af632efamr7899045e9.7.1780315542019; Mon, 01 Jun 2026 05:05:42 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:41 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:05:03 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-17-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=2772; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=ZfklE9gj7vCfD3eea9V5X8HvMt8Vi5qjDtQN6GjxEN8=; b=n8nbwWaKVqGnAekTc7n4FU2ddyIF+UIcZ6wRa5fDPjwBR201R0OD3zGDuaEJfEr7LlWKf47jD m33YXSb5mcNDMK+V9++XRt+r3LXwU+PrmjEmwe2Tl6yun1FRoZoWzIK 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 34d002e0a08c..41bbb72ef730 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -129,6 +129,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 */ @@ -156,7 +170,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; @@ -1160,8 +1174,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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.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 0D57B3A5E78 for ; Mon, 1 Jun 2026 12:05:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315548; cv=none; b=uiWSAnWV4KSmF9nzHuKdwllz6rISUh9rriCLYeGbOoBFc7HQRjLPZJWFxCO/a2Q1bWm38KtY7ya8H1eqD3Wv7Nfrckvwp4uEZ6J9lIKf0ShzLkpOKJcaFJdGGrnOP0TjFg/sIGJCJUrmSncEGal7B9mNxGen1HWO5f/zu12Wd5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315548; c=relaxed/simple; bh=V/j5R/K8D4fgtUgreo+1w1Buebew+BCTOgoZDwfl7qQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LWNmmhW5m9Pr1T1Ud6uxY1YB9x60Ea5/yBDIlC4yGlm3oGCLQC4QlIDxNV5txYyhcVrluLfA+h7D2qvvu6j/vLT/3pe9TABpZip7aKbw9IGrW7HneK/JbfRFUXQr9SvBlyIlbPthiA2IA4WI4kMyQpsrQkpmSWjsPSem4jFYz8I= 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=mM+D+2ro; arc=none smtp.client-ip=209.85.128.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="mM+D+2ro" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-49068493267so55512745e9.1 for ; Mon, 01 Jun 2026 05:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315545; x=1780920345; 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=E8lT2isG6DA0tGp2Ppb+W7ASsvCdkctPNMIenODYem8=; b=mM+D+2rorVmgLaDxn6y32IVGyVNmfPIVB1UXuMpuzZ0X1DR4GcLHwj4sNpTq4f97UK kvOggEm4EmeXTNc40tbX721cUYfnoG2mLu4tJFELjhfMm/zoRC1mrHfTWfa2pEe18v35 nkW/cQ7b1scGoRg127nXyIE5nckmq8Tc3QIw6buPcjEUum1hqlH9F24zaGr2yz0wZEO9 5YEjJWMGnJD3/NbrlQbn57+cZdQ2k+vZWUZ86uckURGnSWEpIpcNKxvcgyPrUyL3UzrC Ph6flxku+MNdifDj6uVg1H9u40VReeKxbpKa5lmq9Pb3L3LSlOHIHSh2JnNGZeDd4dg8 sGdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315545; x=1780920345; 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=E8lT2isG6DA0tGp2Ppb+W7ASsvCdkctPNMIenODYem8=; b=ClM9m5oZ90ISF3TVT0mxzFHEBObCGpgfO/LkDrJ9zhv7PzxTu4xtk0s3j7qJ0Pf9Za O8ASIXBuxUZ2oL1QLzNU/NnB9HqgkX2oi59qe4hCD2orqyutD/7xgoCmNNF6XAV8KqK1 N9VwtpcguIhoXuCKhL5zG/qofEMaClJfpuFNFGPjqDi1Lhs3vEAg9kyP//fzwIq6ShI3 HbYXHqQJJqQ5dInYnYPJs3DFMWnxN8RYspOo0O2uMWxSfC19ROyhgrXlElx+sNgRWUqy 7hEPMuprf23Rx9G0PS6UYic10t/wAxP63RHXoHTKeIxn1SOXWsxLXiAdkxBkOSgJXwWR /3MA== X-Forwarded-Encrypted: i=1; AFNElJ+Xg2n7g1g+S5kU6cCe3hrJZDrKFkjcM5zYuruNdM3M8OjTHehPN9z/6BOhgx3TD6tMkTyBTo54+GLU4D0=@vger.kernel.org X-Gm-Message-State: AOJu0YzwZU/nOWpi2qgWGpoXxWo3hfS6ttsEuLneIHlYSudDVgIaU//Q v3VuDrjLPm1qsV/7kP/m4XN9uQCxXHCmkSo9U1fkgmSJ4z5T53VVzZyi X-Gm-Gg: Acq92OERDnVy5r9lAdEjJ48EGUimQ8AtGSa8Ca+5AEzI9oc9Tm+kOjcf279AgR2u2Vf 7WjEabvWViHuswmUZcSOZTLayNO8D6kKIZEl10+SXbxt2dWvAIlfrrEI4GOcu+ke+HjPVkYGx93 AmqzLbc5wHxuPR1EMYcUq9lO7B3XRHioPSFzIh1oc80zxlb51CHsJR0OAA44C6wYFpT5I0P1BUr 6StiFmWmF5hK4jys9am6jFfDc33ak9vTYLGEN8L9qC4T748CuPLX4F+Fg4ZQ83CD7PkDDUpGOqp hwCa2WVU+U+K1i3Qn9oOcEfnbCd0sy1RI/CdMTiVXcKo3pSbPOEGmX5axl6yze+ppdrKnJ8jMMP wx56Wc5El8QNfbhrLUsEmHjEY9dZg+/kdB/knM/5OBFI8tPrbXLT2Xg1/Ee8+kbo/vxs0Ag+nah i3PaYbEvwRDNDUNSWYHbyEUPbGGmot8Vi8UW0ti9m/Gw== X-Received: by 2002:a05:600c:4714:b0:490:a296:fdad with SMTP id 5b1f17b1804b1-490a296fe25mr177731505e9.24.1780315544455; Mon, 01 Jun 2026 05:05:44 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:44 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:05:04 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-18-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=8824; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=V/j5R/K8D4fgtUgreo+1w1Buebew+BCTOgoZDwfl7qQ=; b=rrCbvc+2Tbfml1sWLCOFCjhc/nZmY9fPmT7uj76vyn27GRPL2ImSmBmkViL99StldOIuQTWrL z9sLI/Y0bNND+hVEShLcIvw2ONz1PcY/Uwa1/gB0Qhr2n8qTL8ImNUk 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 - Updating `drm_print`'s `__drm_debug` refs to `u64` further changes to drm later, when BROKEN is fixed. Signed-off-by: Jim Cromie --- v3: fix undefd behavior when classmaps is all 64 bits. change struct ddebug_class_param to _ddebug_class_param change module_param_named( type-arg from ulong to ullong) in drivers/gpu/drm/drm_print.{c,h} api change later 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 u64-fix u64-drm-dbg _ddebug-cl-parm-drm --- drivers/gpu/drm/drm_print.c | 6 +++--- include/drm/drm_print.h | 2 +- include/linux/dynamic_debug.h | 4 ++-- lib/dynamic_debug.c | 34 ++++++++++++++++++---------------- lib/test_dynamic_debug.c | 2 +- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index ded9461df5f2..9b4d8e3baacc 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -40,7 +40,7 @@ * __drm_debug: Enable debug output. * Bitmask of DRM_UT_x. See include/drm/drm_print.h for details. */ -unsigned long __drm_debug; +u64 __drm_debug; EXPORT_SYMBOL(__drm_debug); =20 MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a deb= ug category.\n" @@ -54,7 +54,7 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each = bit enables a debug cat "\t\tBit 8 (0x100) will enable DP messages (displayport code)"); =20 #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -module_param_named(debug, __drm_debug, ulong, 0600); +module_param_named(debug, __drm_debug, ullong, 0600); #else /* classnames must match vals of enum drm_debug_category */ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, @@ -69,7 +69,7 @@ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_= DISJOINT_BITS, 0, "DRM_UT_DP", "DRM_UT_DRMRES"); =20 -static struct ddebug_class_param drm_debug_bitmap =3D { +static struct _ddebug_class_param drm_debug_bitmap =3D { .bits =3D &__drm_debug, .flags =3D "p", .map =3D &drm_debug_classes, diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index ab017b05e175..21a0ced0b2f2 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -39,7 +39,7 @@ struct drm_device; struct seq_file; =20 /* Do *not* use outside of drm_print.[ch]! */ -extern unsigned long __drm_debug; +extern u64 __drm_debug; =20 /** * DOC: print diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 0443781ed95b..91546a99014b 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 41bbb72ef730..7298520a89dc 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -625,8 +625,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 @@ -636,24 +635,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; @@ -662,7 +664,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) ((width) =3D=3D 64 ? ~0ULL : (1ULL << (wid= th)) - 1) =20 /** * param_set_dyndbg_classes - class FOO >control @@ -682,10 +684,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", @@ -697,24 +699,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; @@ -760,9 +762,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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.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 ABD613A5E98 for ; Mon, 1 Jun 2026 12:05:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315550; cv=none; b=EI7votmjFXNjRl5cpAvmOCIH4fEb5kU4aYiafkSOFIipKSsQiC7o2j5E4IRKGwrdOoBcQyqM20Sb7vhziX9dKmn3x6jcSISOknJUnwCaGGTu8YpLRnUQA/UDYLo3vf8HyVjuJ0BNE6TEB2mnlFRoBhB2g7DDr9oiUNJWp78IGU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315550; c=relaxed/simple; bh=eambVU7ufnIppcvfXPF/c4B56QemYWVPWGPat1hayXM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e6lBpC6zLq88eIdw5sRunr9tInDWtU4DPVL5TGbBL1Cbg7lJ3S2c3nNzACagpvYb2C/SasGhYt+pBlqDAgNYe7CdmFPFp9ScGQz0PYkycrsnB0bEUVsM9XndrpN2zK8vluNsq31j9yugq1UyyB125joHsTGeSzSspr1yJAM1YJc= 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=ZGJgfvuq; arc=none smtp.client-ip=209.85.128.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="ZGJgfvuq" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-490a762db7aso9035815e9.0 for ; Mon, 01 Jun 2026 05:05:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315547; x=1780920347; 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=ublZUVy7k9bBtrp9pskmrGP7XsxBT/AV76L6BqF9OnU=; b=ZGJgfvuqDLDKHRXRc28JckdFjId/Z507Bge3QiXARS/bEhSfYS03hR/2VjLfBUXjRA yJ7LtWEhZ40UfjUGHi0kWghP8yEGyMix6LQfbB0sIGlDyWv9x7xtB2mua0k8T6GMAqtD hTphJUv+mWUS8bmmkb9zuzktAU3a/GOdYziujwH7i11pHT9cFotRO8WWf5ly9BzTJOoU 2ptFM1/jl9K60UAXvOeGhakI2yO7zhSOWsfEad+NGMGfmhyAK8O+a9Rrj6tTazL3jB+a a6mJFAusJZabO4acasdkn9YpkTdMUo9+X7Yo0fPydvfUs1QTwSMYzadiHV24HbKfW/cT jB8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315547; x=1780920347; 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=ublZUVy7k9bBtrp9pskmrGP7XsxBT/AV76L6BqF9OnU=; b=KyO64T/szt5YzoXe5VnbNoH06q9h1LNU0xivX5F9uDhm3+XUVoTSOkYH6OuR2LPSCv U+hqeSD1KwXgWjqCJsohzcn4O3VhLU7LWPn4lwH/oqmcN4gMu6J526eMGkSKwQ8zaANK W3Re3BdFJsX8mELwbF2Mo3gJMph3eYhcwIVuBefKpv4MXX5AUYZsppuYQq68A97meaWl KKiGJWL0qTOZWkyj7Vw26SUrNNE6a5+vcDfbnuYmKhLYtG5oL2CRYn0OUFuRwaOB9TTz amek55f38HXe39YnJ/jeIE0fjCpsJd+3NguzB3MsAV72sUGQCPYk0HWAQHCurCoz5d1o w0cQ== X-Forwarded-Encrypted: i=1; AFNElJ+0GLrfoAJ5yyYf4cQOp26Is5mMBq9ZhZpOAkihAZm1mVWGRQNL0lhJ7jXdBDHtuXGb9DwVcFSk/Ymrm8E=@vger.kernel.org X-Gm-Message-State: AOJu0Yzitxet4vnJfvkF77l14ll4BhBC+SLw6ONABmIkZoFE/D0mOM5T g0N0RaaWuTPtEIfL8sZ3raLR2fBPV+WaxT0let8FFfspXJXgWxlMI74c X-Gm-Gg: Acq92OHt1/0ZKgwIEI6ZEOt8/Pm8hK5QpTfOA1os9IhD6Wq7uD1NtpKWqnaafBrHNbW xCdI6i8Cw4VBeDJRB6ucC027t3+GItzZFxr0zY43VkZNd+4aoN4DRSVjFgeLiaDkMvYJw1tSpyw NM0n+WSq6JkEPMIWTOfy9KgV10qRkoS/ubdEayshgOn3SLKFWg3YWGgjOgHKSV66DB+qICxAvgJ nxNl3iSlaG880lurZQ+3+Q/22sXh5dVJa8L3K9JHJ11lqIVIyqI6Yb1zeU8Dgd1zsIFhHsEOcoS 8UtQIqz0lOSuj52Ij2+Axp3DQRiodEIcXb0ZIFmGJ6CyvzD4zledtEVVTDjbaGjhQWeQnglLdMR y8G56Htqzky6D4tVnovxEzUCs7b/u51SfhNchTH6/KhUssYZU5YAt7rofP+cgpih1s+JrjHfrT6 cGJtM3l5fNKttuWPcY2pVPInB16g8OuE0s6u++kGnz/Q== X-Received: by 2002:a05:600d:844a:10b0:48a:557e:6b4f with SMTP id 5b1f17b1804b1-490a293afe2mr146300615e9.23.1780315547025; Mon, 01 Jun 2026 05:05:47 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:46 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:05:05 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-19-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=18780; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=eambVU7ufnIppcvfXPF/c4B56QemYWVPWGPat1hayXM=; b=bEQebrr5OX5y+Rn9Q9cd845F5fpSD/tGOLLkkCmFnAsXmNCPtVqXDw7gi33WBq6/Mf/lCC2Tl LYK5e5b3X0gAl3k6w6oqQ53edTPhdJL65CiPZzRyM+aVxCkEMN+oxgQ 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. Change section names together, for more obvious name pairing. 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 --- v3: squash in section name changes. 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. dyndbg: improve section names change __dyndbg to __dyndbg_descs change __dyndbg_classes to __dyndbg_class_maps this sets up for adding __dyndbg_class_users --- include/asm-generic/dyndbg.lds.h | 14 ++--- include/linux/dynamic_debug.h | 40 +++++++++----- kernel/module/main.c | 12 ++-- lib/dynamic_debug.c | 116 +++++++++++++++++++----------------= ---- lib/test_dynamic_debug.c | 2 +- 5 files changed, 98 insertions(+), 86 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 91546a99014b..8fc315d0e5a5 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,8 +126,8 @@ 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 { \ + static struct _ddebug_class_map __aligned(8) __used \ + __section("__dyndbg_class_maps") _var =3D { \ .mod =3D THIS_MODULE, \ .mod_name =3D KBUILD_MODNAME, \ .base =3D _base, \ @@ -155,7 +167,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__, \ @@ -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..bd7899a91755 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_descs", + 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 7298520a89dc..0995cbef6f47 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -39,17 +39,15 @@ =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; 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 { @@ -136,11 +134,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) @@ -163,14 +161,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; @@ -241,7 +239,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 */ @@ -262,8 +260,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; @@ -624,13 +622,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 @@ -682,8 +680,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 @@ -757,8 +755,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: @@ -1005,8 +1003,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 /* @@ -1027,10 +1025,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 /* @@ -1074,16 +1072,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; @@ -1116,7 +1117,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 @@ -1168,7 +1169,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 /* @@ -1176,12 +1177,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) { @@ -1190,7 +1191,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); } } @@ -1203,10 +1204,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) { @@ -1220,19 +1221,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 @@ -1379,10 +1379,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_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,16 +1403,16 @@ 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++; - 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; @@ -1422,19 +1422,19 @@ 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; =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 - 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 Mon Jun 8 06:36:23 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 08F333A5E91 for ; Mon, 1 Jun 2026 12:05:51 +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=1780315554; cv=none; b=Uirf8hPtc+Aox8zP5iu+zKQVKUDrYvWUEgDxq8vwpLwdKVm48uTcJrFtnw4tXIgj6Or9KUzyAyVA8eaBwjAFj9upevOGtoirp933WxUdCP9xmLaZkAfv6yYh0MkSmAm3cddE04+zhCxzXZW/QsQTaj4sMMha7zcIXxSfr0QIq/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315554; c=relaxed/simple; bh=y6p3A6uJDF/yDiP/b063q30riIoq+nmeL3g433fxlDE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f+9pQtZEjXBV8Kdeyj/H3sg6VDnFjE0zkXKdfrn7u1fciZkkdYe0lsgOxvIMihOzceC88gONh919DIWeGJKOA347fEzg85weMo4VGPsTlSUBi/gXENpPLGHDW2OwvquQ1UFTf8/QY7/X5GV7NwO9XKd/ClOb6CIZQSFH4gvWoao= 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=qaRysFnm; 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="qaRysFnm" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-490a7678b2dso11173835e9.2 for ; Mon, 01 Jun 2026 05:05:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315550; x=1780920350; 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=YHXrjdw657eeJgY3cFQAuPQpAizodk0A5lck6/SEBoE=; b=qaRysFnmhSPtCqTjxHUjGGvL2FmZtHkFfZ74Df6M6Y+t9P9LOvpUgAWtalMxMYXE1m LcdYBy4K8bkvqromCMxGNFnX19NVKZZK6ip8KYAxxfLloOXsSjLJCHCs7Y/AGnmgcWPB t3ZkbJaxUJxzDKt+pcrQefSDxtDDRTnTjzLtBAK+tzbwHCji5S+/qEkRTDnESnecVCSa PQDBgys40dxBpBtKQALWcYzlisBoB6gjdf+ABRXncUDDCEFLR5GpuzBzedFIoM7xJ2Rh uRhkDNVNkCQevxUVuA5Whp8YaMjsHs4l8kNtKrGflhaMiUNj+jjgWI6f2HgMlhxENaX2 HlrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315550; x=1780920350; 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=YHXrjdw657eeJgY3cFQAuPQpAizodk0A5lck6/SEBoE=; b=QxbOobLCVZLDOOk+aj6Ahzhi55cF4VZFYXKyPkUrHppfqZf9WiNJ2VJgbxu4dkXAha MP2dcIDArvSFNlllc5aawkVz/zCQBR5k34qdQDB/j+o67I2drr9GsASS5rmcMomldZAW n/0bpYHgEKZ3Ku5pkxtEbRyM/tjzjeCCqDvSPXoLsagcabxlZ28W8JmN9tUsy6b2U7XE sSGbThkuDyr4CW0F6aAcreLBkfBn80HZ8ZxQY/an/q0pJj2yRlBppJGI0cBGQZytRryN rLc5jGQkNwlV4J3ZZF5IbvRrVtnxY0SK9TKpR60HChycHzrV+pkD8gJIxO6y2/ok28Hs /T/g== X-Forwarded-Encrypted: i=1; AFNElJ8o5FSB8PX0E696OuWAwR284NIPJBY1zW+3kwBPi+B0Ns+ntxW492kDfaTZ/GOAuC5eOpE6f2kX7o7lyzw=@vger.kernel.org X-Gm-Message-State: AOJu0Ywi63S+5OHbPle9FLXocQuMh36okj6psGu2SMomKBahrp5w2G0k ORyhW4Q+fTDbZifgRZBbDlsvA+xKrOfhjgKmxOFLEgg/d/FT6v/Jm+4b X-Gm-Gg: Acq92OEqT/cWF+hztij6UE75oSpuwhS13V3dFLi+cYMkZSiVkVru37PACkwzi4IcqzW ts57roa5dLeJlFNJc7uSoMEpnCSHIij+bSkdtzxR8h3XOKsqvdgRV3OWs6WsGdFwR1AUE8CAtjp Q+yZxMn+p1Rgvag6/4VCscrPugxS/P2t8ssg5rFKT9s37eoyUbLpvHVRGdmhhBfmXf52tVrBbN9 7x1Cjjglz0SU1U0gejSCewPjwlE/1Y6ZE+mY8OrskWhQWLa2P3HTtZ9uoC9i8HNba/+iiDJjUyN sdcQ9Zzph+Gz0tzW+iLB5gZfQb0D1QtvTAcoki6SZc1EQnCEKsty5J487OOILXnNvPhjQtflJv5 sKaD8dcLIAnSMmVq0wtWNryDUmAWmwniyJp1TBhLFoYgi4D/8/5xBlvmcRheU3hv/C7rSl+dKD7 yA42W/tkFoCVPeEU1XI0z9MEW2HMNHVWDL+Q04gLcE3w== X-Received: by 2002:a05:600c:3b27:b0:490:958f:2a5c with SMTP id 5b1f17b1804b1-490a292fbb2mr193246165e9.17.1780315549539; Mon, 01 Jun 2026 05:05:49 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:49 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:05:06 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-20-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=7732; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=y6p3A6uJDF/yDiP/b063q30riIoq+nmeL3g433fxlDE=; b=/rFIm7r3rRYlv8rITsVUoxHcg4xOqCUeGvEjMyejwKauQf4V2MBeJLztnXjbYX2wacd0pGwB4 jkWy4QvlPjgBMfOXYkv6A4QFo0asElRQtoNnBKfjjtk8Yx7ag900EE5 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 8fc315d0e5a5..e4a62cb73267 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 0995cbef6f47..ebfff48c4a6c 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -46,7 +46,6 @@ extern struct _ddebug_class_map __stop___dyndbg_class_map= s[]; =20 struct ddebug_table { struct list_head link; - const char *mod_name; struct _ddebug_info info; }; =20 @@ -245,10 +244,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) { @@ -260,8 +260,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; @@ -281,7 +281,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; @@ -1078,12 +1078,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 @@ -1111,13 +1111,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 @@ -1178,7 +1178,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); @@ -1192,7 +1192,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 @@ -1200,27 +1200,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); @@ -1232,7 +1231,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 @@ -1295,7 +1294,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; @@ -1315,7 +1314,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; @@ -1413,7 +1413,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 @@ -1424,7 +1425,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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.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 C7DFF3A6EE3 for ; Mon, 1 Jun 2026 12:05:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315558; cv=none; b=M1nTqWphbNEhPi+GS3RhVxCt4Tqud5WsaVcry7GW5D4OAgCgK2PsIDjvGBQzYIN0Qj7ysJiwVf8bsjf8MhqMvGrRjTjaCplMoK2CqqSI5xQxj6VoGQi36WVub1ZQormUPnU8TmRiL+pgvxPY8d5ovfJQS7RqxuYQ8X2qdLq3/ys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315558; c=relaxed/simple; bh=+pK3ELU4w20zDsjOhD6mPHGUqpMWzd0Bpz7aF7sTnso=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cITuFo2qdElFzIMPSOmXksQ8WmNo461Zs7ghZ3kl5n89lh1vFU4U6R7pUcoEyvUKCjFlmbF7XFskcyeSQO3A8CGKCtX1e1mSayxnimFFVaqbEGm82hYkuwlkmVVZuI7PtWdWgQmYqLwGtD+p1qvOooCC5NUjNOAkSppoA2MicPY= 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=p3WQ229V; arc=none smtp.client-ip=209.85.128.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="p3WQ229V" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4904c1ce4c1so112029945e9.3 for ; Mon, 01 Jun 2026 05:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315552; x=1780920352; 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=Hgs5d09klBJiSQ6rUhilK4VUYGAVQwrVr78Zd+w8cSs=; b=p3WQ229VAQoRcGr8T8Rp72oKuHzXAmi5IYwpLYvBjC9WAfva7kwmPNqDO24pK/IbrX K7GWoMMLmaZf/lJz/X1ojRcveYJXVlkkBaQaj8rdi8G2YDgfMxJx49s2xkhUF0YXaR9H Jn4fNSEMbpFJlIbZd5V1AQZIA0DS5tck8gzQ9x72IfXJ0R/lQOnpNnfbHSOvkR31tuZA GJa1suddix3nuFDp9s1Uxk0c1zaOjb7FxC0ixPw2K2gosxUXgVjqpP1DkY7Uv/Zi0RQf hksQsEkrYLMm4nhOAKevdn30BOZQZKaz5PYNARpAnmHBygL7oKrXZMo48gUwnMUT2pzE csew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315552; x=1780920352; 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=Hgs5d09klBJiSQ6rUhilK4VUYGAVQwrVr78Zd+w8cSs=; b=RbsmhtApvLCbBi3iWkvbmDXSHQlAhaVdMtWh2Zony2UgebZyYbl3I7IZPQdO/xy60o 4D9pNICAGqdWSQy6x0WXRcbdX0CrHS36DgBxJ3fdtlv6aldxJDSFLitYfOdf+Pm0upNq qcjhwq//ZWQ6w1d1QvC/2r8HOnXUNEdRf6jwP/Cc8/H7DfiX3t7iKiEo9RDpBsfb8QBf 5q6jzvoF0+HZz1I2f+5OPLY2pmuznk2nFLL+rNgEg8pdk90DhQSsS62NPnNYP0wIaQX8 2p28LS6sNO00STRAygyDUMwvAJFhowrdiUxnOhtsnvl9hlsO1yowovnmHcB0U2hsVp1c q3rw== X-Forwarded-Encrypted: i=1; AFNElJ8E9zuCc2D4trGB7VYeejsJ8guQh4r4kmLhHvHO+Y8+FP6NOq/uadH3xrcAjLAGUSh0TKsc7S5o1yrnYWI=@vger.kernel.org X-Gm-Message-State: AOJu0YydGFxuyCvcaBobah64WFwnQVZq+JWYToZTtrSY2PlOMJpADMuA IPue4mCINqrhehoDFmz99XADsigqaIyxxJ1GE17/yLp96sSWy4qP6OH6 X-Gm-Gg: Acq92OGhk0UH+2O7H4csRkvoV+/iLMmsxSjAQ8NPZczJR7MMcKMocYOuMh1LHQOEBc0 QiHR5zoC02EBpnE+sVNPFOTBRCgWFg1gUsp42fWUxVXtzOcV8Jxh/MQ2QW87VbEXszqp9T9v5ww 0OSUMx2sa97fo8o5ahVnn3GKKkYiGYL67VxLhtaW7iIeYk2vwdJ3iMpSOKsiZd98uz7/ItXmlgJ BZKHVWKbZzVGN897Rh3QmeRWMwXBTe7CybS4usU3mIybzYgoXJUCi1D8W1vh4NHauAwsS8cOXFC V2gzD6YiEU0A0DQdM/a3nfLNsRjJ0sUT3K39xd3alUpCtjPJcnAUoVg37liNozoMh21odYjDgbU 6rNd5qDfExOfBPwddM66IR8xrJaFePDHghtRNxeUyf0sJqiel8Kwb6HafrQup+Aq9HakF4ZyUSi En/GZdc7vos7G+QnHI0dwiZ/5Soyg7ZgzyYliIa+lbxw== X-Received: by 2002:a05:600c:6091:b0:490:6237:521b with SMTP id 5b1f17b1804b1-490a2b6b21cmr202105565e9.27.1780315552020; Mon, 01 Jun 2026 05:05:52 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:51 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:05:07 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-21-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=6283; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=+pK3ELU4w20zDsjOhD6mPHGUqpMWzd0Bpz7aF7sTnso=; b=TbS1phZ6wCP9h1H8gSJ3AR6y0BvwAqEZArTZQwJ8qYv+aXmDh+2BAvoO8DY2i6pV26d8lADbU 0qmPtH7gGYjAJyolynwAyf50nCvEEH59PFNeDem71pJ6wZCuqwLuupT 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 --- v3: expand block-comment in ddebug_add_module 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. fiuxp --- lib/dynamic_debug.c | 84 ++++++++++++++++++++++++++++---------------------= ---- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index ebfff48c4a6c..fdb730db385e 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -161,8 +161,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; @@ -1167,34 +1167,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); - } -} +/* + * dd_set_module_subrange - find matching subrange of classmaps + * @_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) + * + * Narrow a _ddebug_info's vector (@_vec) of classmaps to the + * contiguous subrange of elements where ->mod_name matches + * @__di->mod_name. This is primarily for builtins, loadable modules + * have only their classmaps, and dont need this sub-selection. + */ +#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 @@ -1203,6 +1203,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; @@ -1215,17 +1217,21 @@ static int ddebug_add_module(struct _ddebug_info *d= i) return -ENOMEM; } /* - * 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. + * For built-in modules, di is a partial cursor into the + * builtin dyndbg data; the descriptors are the subrange + * matching the modname, but the classmaps are the full set. + * We find and set the relevant subrange of classmaps here. + * + * The modname string is in .rodata, the descriptors and + * classmaps are in writable .data. All are immortal. + * + * For loaded modules, mod_name points at the name[] member + * of struct module, and the descriptors and classmaps point + * at the module's ELF sections; all have lifetimes matching + * the module's presence. */ dt->info =3D *di; - - INIT_LIST_HEAD(&dt->link); - - 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 Mon Jun 8 06:36:23 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 4682C3A719C for ; Mon, 1 Jun 2026 12:05:57 +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=1780315561; cv=none; b=afc4hfakq3yxl7FiVY4U1b/uIU3Bwnm8d8NQvPV9HTkNLTgHSEBQ7gfJ6XLfLiMmWMn0et2Woj1mT8ElHhyY/ijMLnjU5XldbK2vsnv+SCFqBDLQv5MVrd/IY/k16CI9KjSUoZh7imG7HvarrrS8xoBEgo/JKfxEX8p+Y9Raj3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315561; c=relaxed/simple; bh=beffx13F53TU2XEmbM9tQ+HBGxp491P2D4sjMFQTIgQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MxEWf8C3gUZ8JOUSr6cWYqFzr/3Clvgt2u5HJdZSvx9o5/iWQ+EnQyNnuEmgi3diebpFWcmYyiwyVosq9PEzK0bhY6uGitUqA4kT5MEUNHZabWVUGruj4ajTOdeU0+LX3IDhcc6yNuhxW5bMRR3t6TuWcbXwYi7FmupvxbXtezU= 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=sds5L9Iu; 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="sds5L9Iu" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-490ae94a89eso3129665e9.1 for ; Mon, 01 Jun 2026 05:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315555; x=1780920355; 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=gGmIKQdNt75wRPwPP9ogeMu0eNQjjB2cwFIkDSGhGCg=; b=sds5L9IufdLeUREFS43cawdJcSIwGT9C2DV7JISFMdQnYG4fUycCaIbuKDRoDTqIz5 lvV/G2K5u+SOPizJfNz73pmFi8xfKM4CvjgQip6a6+sscskBbSZU+opioMFMV9zXVQZX Zgn4NHEETPnERbhtKiLrPMs+O9eBqmP1WH0cUINd4VkpOUZYEclONRWPrqJdibD4dH7B DyQShj33U63Ck0K/jqOoVAsvuOWRB4285CuEX6eeDL5ybxuUxJGfoeX+FMPxjE5bNprd fSdsTsOUf+hc6E7M8afG4K8mh/oRXqx9qqvC+TvLt6siqTpUN31KCUG1hL0k0hO6onR+ 4D4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315555; x=1780920355; 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=gGmIKQdNt75wRPwPP9ogeMu0eNQjjB2cwFIkDSGhGCg=; b=JgEVrX7vgqrdqs19Vz/grIej9OyOJkS9BjY3oQM+ko/A0LClkkCAQxqILLmeLiCwwI qZJTX3Ukl1f6ecR99VCINiM2+xslcFbAoJr71pm8vjm+kNppC7Ux+47xSqlhERPSbgVe wqVCb4OkWpXkDVP3/CAyJCjEv/Tv5NEZyn91xo14z+Cy7JiOimZ6+wmx8BydZWEcDHcA eDtGFK2tlEIh19md5ff8cZpfbum0FO6P6AiHHN0nXoTl9DdmucdDA3/h54zeriucmAVF R9dmOWr5UCxmMLAtP3B7swTQ0LaTVIUcYnEeDroDoXK2fuDXzvcLl2dThVVZmOCS3XJn b+rg== X-Forwarded-Encrypted: i=1; AFNElJ9S7GghuT/5i6GylSIskb+WkFGOsXkdBoXwE66GlkGcsYf9PJdWgDX20e8fKfq4delHeNU5b7r8jafuGao=@vger.kernel.org X-Gm-Message-State: AOJu0YzGD+9k6xurSc4WxFH/y83UYz1q53ZBUNiwNiohFQdmT+iPwD3U LKw9vlHuyPw9wjSGcMDp/VsMM+sX7auh4syasnLbrBs3fEl77mqu01q6 X-Gm-Gg: Acq92OFHU2ONc6gaTTdR3auFxUIkpxuIPKU83V0RCdhHL7CUIecVEOHRFJ5TkxGftCY /MAiV32uJqz8f3R2S0o35CS2tB3dRrAMkCu1BkP4oyZ+AtHp97LwMXFyEItOO5hx/Lk8WXqbcrh wZ0fOaHrd1hS4Fqz8f6l0krx+YfyRuNe6scbL7qKXS/qpuGuMa1eNKbtU/9xkb4CvichEM87BZ2 LiN4x55wyR3u9oyVln7UAPCcs9QQoLuGoR3ex5Dg510zqwxQvGg7MRtjUybn3h21Ds263KIoD5S q+8/n5zgJVi+B05m0xWCf1sIYoeA8PKpwv2tUMTXNoAquCLYTo9QWMBCk/kTpkQZR+MPKZ66+Uu ml9Bd14o5L/EIzZQGTX88FC8psGrFtyhU8YOHJlT3i8w35NezGq/4dT+KI4m64aQ0Y1iluiRZQp SI9amluR+T+cI8fFDP8FzZenj00iM1qBp2yQtIPYxdKw== X-Received: by 2002:a05:600c:5306:b0:490:aeae:1eea with SMTP id 5b1f17b1804b1-490aeae1f1cmr20861945e9.7.1780315555002; Mon, 01 Jun 2026 05:05:55 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:54 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:05:08 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-22-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.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=1780315495; l=13151; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=beffx13F53TU2XEmbM9tQ+HBGxp491P2D4sjMFQTIgQ=; b=xeiYUBjCENglst/LpkbKnn6z+U7hYl6CE4lmzcO5kYMeaXfTL/l4VK5kV8zws4Beg6ZLpofz3 6rH+F8sZECDCpJi5rckxeEa9GTWHlzgHSboNmj9Qfkxp/r07Y/ogv7M 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 --- v3: use ksft_* exit codes 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 | 258 +++++++++++++++++= ++++ 5 files changed, 277 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6cf80e7ac039..b3d41824220a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9087,6 +9087,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..8b2b7388678e --- /dev/null +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -0,0 +1,258 @@ +#!/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"" + +# Standard kselftest exit codes +ksft_pass=3D0 +ksft_fail=3D1 +ksft_skip=3D4 + +[ -e /proc/dynamic_debug/control ] || { + echo -e "${RED}: this test requires CONFIG_DYNAMIC_DEBUG=3Dy ${NC}" + exit $ksft_skip # 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= $? +else + # if no config, try runtime probes + modprobe -n test_dynamic_debug 2>/dev/null ; LACK_TMOD=3D$? + # assume builtin dyndbg if control exists (checked above) + LACK_DD_BUILTIN=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, got $3" + [ $3 =3D=3D 1 ] && echo "Error: '$error_msg'" + exit $ksft_fail + 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 $ksft_fail + 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 $ksft_fail + 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 $ksft_fail + 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 $ksft_fail + fi + if [ "$output" =3D=3D $1 ] && [ $3 -le 0 ]; then + echo -e "${RED}: $BASH_SOURCE:$2 trace instance $1 is not closed" + exit $ksft_fail + 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 $ksft_fail + 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 $ksft_fail + fi +} + +function basic_tests { + echo -e "${GREEN}# BASIC_TESTS ${NC}" + if [ $LACK_DD_BUILTIN -eq 1 ]; then + echo "SKIP" + exit $ksft_skip + 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 + +for test in "${tests_list[@]}" +do + $test + echo "" +done +echo -en "${GREEN}# Done on: " +date +echo -en "${NC}" + +exit $ksft_pass --=20 2.54.0 From nobody Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.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 30A1A3A7597 for ; Mon, 1 Jun 2026 12:05:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315562; cv=none; b=e2KaqQlhpwyyFyYu3DeCD/cC7x2drlIS+bU/+JFauC0N1XcGBmh353F9i9dI6hWpt0gTB5Ip/ub8tfWR1JoOh/IFXNYyg/HNk/8SUi9DX1vttnukQHpTuu2BTr5MFcyLCSBmj7Y2uZ1HdmzM6HfriaIxuJItt7jO5qTYbgH907I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315562; c=relaxed/simple; bh=h10PnN9dZij/9KIShcmtDym4aMWTMKg/65aOZIHej50=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pgYd4vyTitVFIz6fJE+SHWWMUA/Npfl6FJ3SFVoPMVfywRs0y/L+zEET05+tvKueu/iSTYYpKWkKq+n0+pb/qDkgTRwRsBQs+Ktm30artJWvdkahjopwaw9qjf9LwfjrHpetehE4z2TFbyKwpX0rqrd6hLW0T8RlsyU6dBeYQnQ= 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=V7iIvUfM; arc=none smtp.client-ip=209.85.128.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="V7iIvUfM" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-490a765f47aso10993365e9.1 for ; Mon, 01 Jun 2026 05:05:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315558; x=1780920358; 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=yYycUh0v045JLMzHv+cDjWaRSMlpTVGG8/fmLB5h0j8=; b=V7iIvUfMhb7SYycWP/6siol7VERg9dKBNgPg4laUom+r4Kbhz84wRvPQEVVnvtj9YI m2kIT31QSXKuszMcgiOKmzAFUX8iSNDHEFQT8HiUo8SyBcFTne2q5HsNq3VydGaqHOTX 9c00nbn7JYsvDVsE2pdj6BX7oedieF4kPyA1ALfLwtjOLHXmA/Xb/zfJYPVTccKCAytC FiHuRyXuWCedPmh83dBDgiGBJ0FGPjflPuYNVWVw6XGXpg7Finsr8v8vGsTTolxR4cqO pVhnhq1wk8EWPntfCHJM3+zoAk0JShijTCPbB9rajTEJ42dtvkZjRCxZUsu7zxviHXQ1 GbOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315558; x=1780920358; 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=yYycUh0v045JLMzHv+cDjWaRSMlpTVGG8/fmLB5h0j8=; b=YBYDNp3X3qQTdxIiZi96TFcL5ii6kgXuD8GcVmnzoppKVBsJgyrepUt0WhhMxoEy+K zNvlOG/PQ9fD+8MMfPT7m4xPetwruby4J/xHcfHy3u4hsJL3Lmd+yziG8u5nzEOF+Gx+ 3URIfilllzfqa28Q6Fkg/BeJ9TbiSOXVvc9+393Z9pIlQE56kVAmZHmJzt8AVLAAUntw 6wXJdv8M/2xLRyzpyKtGYkoaOYzTi6EJ90xdg1/1lrHwWsiLpWfVAQi6QU96JbalZPEm qOy7e4coSPlIOA4/7JcXePBoNrFYq54e63+42kyiMi5havo9lFeGr392ddK69NgTb//h n+eQ== X-Forwarded-Encrypted: i=1; AFNElJ83Ogi1EwWxHLR8u8E3gxzpB3rsY6QuwOKXKc0p1fTP7TUHZ8DDnmaGE3eRyY8LvLIZa+QtobfMP+RqUxQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzA4pnCQ4XqCpDh6AspDdmE03xEEcXake5jrFtkXVmclTJtMBgJ thBHOc6MdyIIl0gCxGAcYJwaZf9RDG3beXY90itm6F8Q4hODF91kPQ9B X-Gm-Gg: Acq92OGQgn7swj2aP72GvP7X9OBMrgvkGU1a5MmHi9hdtGkdiGBYYGDGC4gyRVCW6k9 b2TyEm0xvC09HU4MW9z57boa0Jc2g2yljFqoF2wrkdbFP+qK2KfSzpySUFTTUCCYQRA08UQivmc 6mZM2PWJYq5gstxeZZNRCoHrpEIXhMLwHxOmvtNw9bnOnQbb4X24eKvsSEcBlTsU9ChQjveVZMl ZNm9FnsNFf03Jeg4nf744NYdfs1oMPASUWLuc2j+QIjsBg/RmoeTijfWlZWEIKV8800mCsD8N3q QAzCVDCm3ycnFtQc9PB/HjEJP7PbAfjhlS9WQMKBnuv9+lNSxQcrs+Zb//7bknvxX8UmBQ/7lK5 vaeBmjlA7mdaSRy2ggsxoHmATkteJZ0naRdV5vd7CjiDxD+feGSosBGiTrl2+J4+9Q1NIoPFjCC +cQWosYOi1D0ZBANY/jp0XvuTl2OSmpADiExDm8gedOpJ+luc+HA9L X-Received: by 2002:a7b:c3c3:0:b0:490:5191:6e26 with SMTP id 5b1f17b1804b1-490a2941d7emr123128335e9.18.1780315558152; Mon, 01 Jun 2026 05:05:58 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:05:57 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:05:09 +0000 Subject: [PATCH v3 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: <20260601-dd-maint-2-v3-23-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=3131; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=h10PnN9dZij/9KIShcmtDym4aMWTMKg/65aOZIHej50=; b=7d4cXQrVbi/WeQvP8ZQuwmniE0ZO2BzoQ9gySu/7FaWMnxSGtRwVplsGXCR/85fxmr/fnL+vF wSHFrEsdBaeBNH4X2ZDEhDHxsO9POFKRVGtZMsRU54EYlGrkzM4lXm0 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 e4a62cb73267..2d6983186f37 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 Mon Jun 8 06:36:23 2026 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.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 4E5153A6B92 for ; Mon, 1 Jun 2026 12:06:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315564; cv=none; b=r13CJOYwJWLOOrQInRjwrMk0m3leJhf7AXoKx9LUeXrow9P/8ASkc2+ku6VTetromjd2sauZga3Dq6vlJrVvBmOg+BaN2r2yYY4BCJ5p6q9MlsZ5JT+OWGjkwR02moxmNv/quIi1/ecWHUE+VRbkiNSXCB3wDliw+tOlNldEKnE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780315564; c=relaxed/simple; bh=sEO7u0MUmNyTUFNIPBYBwtZCCgzYuBjfxfoGHbMv0oE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aTXXXoZOklwVq8428TpSZDaq8G7gc69A/fq3UJ0v18Mkzap4Mwi+r/ihwdtRJ7Sz3HXuMLqpoCL50eJeh0gZYpFI7RBnpFvE/fh62t0yuswJm/c0whoa8u41YSw+4H/jMj/I2KxO7bMrbhQbOgs5Lytj12uRI9ZwKRWouQsG9ZE= 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=emQ0ufQA; arc=none smtp.client-ip=209.85.128.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="emQ0ufQA" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-490acbb0f89so3557175e9.0 for ; Mon, 01 Jun 2026 05:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780315561; x=1780920361; 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=vU7EFGuwqCZWgkJhEpDIGpXxPiY17lJwErVDlJ76auc=; b=emQ0ufQAvvX5Yq7G0xvsXQqdAXdECmMQL0fgULqP7x4AbHzbn9FID0sgTxPP1cN+5N phgMCYmxdtEKj9trh4ESlCb4GWV9WlSZPOjg+sWb1vQ150Q2AyPeXlWt4/xNorJnguc4 6tIJkXixN7F4N34K/RgU5fzc7Ycek1XnTTd/5A2TEwmHNrXWHIcDLtHcbCuofQtmqUch 31a1z8RtBnBX9tWT+BhFT9Rq3n0dcKsme71BAIpP4xl9dpZIzskOfS+xLuRtI4js7Pjp 3s5+RVImHEGbVPmvOEXTP+cXj/EMbwqxgbC0wgi0P9ZgwxtYAGVmWQqFIu0rM9hyraEh JaBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780315561; x=1780920361; 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=vU7EFGuwqCZWgkJhEpDIGpXxPiY17lJwErVDlJ76auc=; b=Sw5Wb0yr/CSY4bEK14vboreT7HbZ7m3SI547kUul3sKCb5e4LeeaEjtkZ1NwCMDTkj PS8IszrR5W5iXRqnKy+EkvUqMYZWxDziH+NnBSvam8zfkFuUnLwQpeZNzvvGxEhOKJBo UvEQ+/ZaX/wjfE5xeR/BcldvftITP0qv3nyeIiY0Bn7Y696l96rPm++f/bWHv2CNfw+8 U1WwsKhBREtlW5YLB+FCxEipuyARsxvIA7CLfEje4vm1pN2XIuds4iR+AdLXTXwELfQt khbxfMke5zM+F8TxkTPZ0EgF805sEN/7Lbipwa1cQ6B449APLoK+55kRvaMQhq06vLMQ tA/Q== X-Forwarded-Encrypted: i=1; AFNElJ/WUN2HaHpk/dbOUKF0bQsO0cNKEjNyAPBFDM1IzUHZrxte4lSa4K2AztWKt0FMWgfQpDiygfFaBl/ghsI=@vger.kernel.org X-Gm-Message-State: AOJu0YwTKeOLoJrwn96DTbgkKt1dmGzZexaCujmdPOJoNqgl+m/klwn7 N8Gw+svtGwdMs4OOVya/t00Kjxycnilej61VLztu+P5I9DqfwcLCLX5c X-Gm-Gg: Acq92OEs/TYGAU0wVqmLghpo/hZ677tLp5Xn7H6Tie3X6HcONwqmGmCp4W6g61lrM0E zRIpWoccg6XmE00MDWh403Ye3d5nkIz2BAZrNEzQblxuBfEiYKhgLz+3Tqd+yrAG6zQZfT7WKnl WRmpioApe6XZ1TYC2WBMrkJv6A8/BQIzehEkwzVwAuOgv/++bHb7rkAHQ9Cti/ILsxc80G20lfU FuBRveV+fue9B6kirdc451UPntFe07+2P5XarXdX5her93sJRm4Kr7bdCMZnSADQk4hdDQvXvfG iNvZ8Huzms1vEnPo7E5svs6WXxB9fDFYK390mwgiYCODQQhz4txfPiSM2IBs9CSQqcYJVWI679h i5d+t8yMlhLOyqvqh5JZOKwme1riqvQoHCCTC+20H7qF+mA66rXE0tO8D+hPJC88g3dLaW1Bdrd Kdi7deuQbJxMj1PKwFHX7hV15qwecC3WzKnpeyCCYLuw== X-Received: by 2002:a05:600c:4e92:b0:490:8fd1:72a with SMTP id 5b1f17b1804b1-490a2900dacmr202132615e9.3.1780315560582; Mon, 01 Jun 2026 05:06:00 -0700 (PDT) Received: from [172.16.188.153] ([213.181.114.83]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4909c152570sm103972805e9.9.2026.06.01.05.05.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 05:06:00 -0700 (PDT) From: Jim Cromie Date: Mon, 01 Jun 2026 12:05:10 +0000 Subject: [PATCH v3 24/24] dynamic_debug: use KBUILD_MODFILE for unique builtin module 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: <20260601-dd-maint-2-v3-24-4a15b241bd3c@gmail.com> References: <20260601-dd-maint-2-v3-0-4a15b241bd3c@gmail.com> In-Reply-To: <20260601-dd-maint-2-v3-0-4a15b241bd3c@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 , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter 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, dri-devel@lists.freedesktop.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780315495; l=11525; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=sEO7u0MUmNyTUFNIPBYBwtZCCgzYuBjfxfoGHbMv0oE=; b=DPwcRKWEUYRhXRmC55DFt4XbR2ofmt1arOnS2i/wN8YubW92I1k8pJhvFDor9/LqQslDrC/N3 VZ62XvXMhV/CsYupwAafT1pAtBZ/E9i8lMFkaVFl/5C4jYDJWbI3ouy X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= Historically dynamic-debug gets its module names from KBUILD_MODNAME. This works well for loadable modules, as the module loader has always required them to have unique names, but for builtins it is basically kbasename(srcfile), which sadly gives us many modules named "main". This makes the following ambiguous: bash-5.3# echo module main +m > /proc/dynamic_debug/control since it would affect 4 independent modules named main: bash-5.3# ddgrep =3Dm init/main.c:1265 [main]initcall_blacklist =3Dm "blacklisting initcall %s\= n" kernel/power/main.c:49 [main]pm_restore_gfp_mask =3Dm "GFP mask restored\= n" kernel/module/main.c:2862 [main]move_module =3Dm "\t0x%lx 0x%.8lx %s\n" drivers/base/power/main.c:149 [main]device_pm_add =3Dm "Adding info for %= s:%s\n" We can improve this by using KBUILD_MODFILE for dyndbg's modname in builtins, and KBUILD_MODNAME for loadables. The above control-file entries then become: init/main.c:1265 [init/main]initcall_blacklist ... kernel/power/main.c:49 [kernel/power/main]pm_restore_gfp_mask ... kernel/module/main.c:2862 [kernel/module/main]move_module ... drivers/base/power/main.c:149 [drivers/base/power/main]device_pm_add ... While this is a user visible change; [params] becomes [kernel/params], it is not a behavior change; we now match the query-module against the subsystem/module name or its kbasename (the simple-modname), which as before, matches all 4 modules. This allows queries to be specific when desired: "module init/main", while preserving the existing meaning of "module main" The deeper reason for this change is not obvious. If any builtin "main" module were to add a classmap, it would attach to all "main" modules. If 2 "main" modules defined separate classmaps, both modules would inadvertently share both classmaps. Since classmaps map classnames to 0..62, and independently defined classmaps are most likely to start at 0 (unless author is planning to share the 0..62 range with other classmaps), we have a setup for later reserved range conflicts. Having unique names prevents future conflicts. This solution isn't perfect: 1. it changes displayed [params] to [kernel/params] etc 2. its mostly redundant with "filename */main.*" 3. "module power", "module module", "module base/power" might be better but would break old queries. Adapt dynamic-debug selftest: 1- Add 'test_subsystem_module_queries' to verify path-based module matching. 2- Use dynamic counting with precise regexes to determine expectations. 3- Reorder tests to run slash-query verification immediately after basic tests. 4- Update basic_tests and comma_terminator_tests to use 'kernel/params' instead of 'params' to match new path-based names for built-ins. And adjust Documentation Signed-off-by: Jim Cromie --- v3: new patch in rev-3 Signed-off-by: Jim Cromie --- Documentation/admin-guide/dynamic-debug-howto.rst | 40 ++++++++++--------= -- include/linux/dynamic_debug.h | 17 +++++++-- lib/dynamic_debug.c | 3 +- .../selftests/dynamic_debug/dyndbg_selftest.sh | 44 ++++++++++++++++++= ++-- 4 files changed, 77 insertions(+), 27 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index 9c2f096ed1d8..8befb69575b7 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= \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" + init/main.c:1179 [init/main]initcall_blacklist =3D_ "blacklisting initca= ll %s\n" + init/main.c:1218 [init/main]initcall_blacklisted =3D_ "initcall %s black= listed\n" + init/main.c:1424 [init/main]run_init_process =3D_ " with arguments:\n" + init/main.c:1426 [init/main]run_init_process =3D_ " %s\n" + init/main.c:1427 [init/main]run_init_process =3D_ " with environment:\n" + init/main.c:1429 [init/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:\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" + init/main.c:1424 [init/main]run_init_process =3Dp " with arguments:\n" + init/main.c:1426 [init/main]run_init_process =3Dp " %s\n" + init/main.c:1427 [init/main]run_init_process =3Dp " with environment:\n" + init/main.c:1429 [init/main]run_init_process =3Dp " %s\n" =20 Error messages go to console/syslog:: =20 @@ -161,17 +161,19 @@ file file kernel/freezer.c # ie column 1 of control file file drivers/usb/* # all callsites under it file inode.c:start_* # parse :tail as a func (above) - file inode.c:1-100 # parse :tail as a line-range (above) + file inode.c:1-100 # parse :tail as a line-range (below) =20 module - The given string is compared against the module name - of each callsite. The module name is the string as - seen in ``lsmod``, i.e. without the directory or the ``.ko`` - suffix and with ``-`` changed to ``_``. Examples:: - - module sunrpc - module nfsd - module drm* # both drm, drm_kms_helper + The query string is compared against the subsystem module name of + each callsite, as shown in the control file. The simple module + name is the string as seen in ``lsmod``, i.e. without the + directory or the ``.ko`` suffix and with ``-`` changed to ``_``. + + Examples:: + + module nfsd # simple modname (as from lsmod) + module init/main # subsystem modname (as in control file) + module drm* # both drm, drm_kms_helper =20 format The given string is searched for in the dynamic debug format diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 2d6983186f37..aee6f3d0916f 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -8,6 +8,17 @@ =20 #include =20 +/* + * Pick the best name for the module: + * KBUILD_MODFILE includes the path (e.g., drivers/usb/core/usbcore) for b= uilt-ins. + * Fall back to KBUILD_MODNAME for modules (loader requires unique names). + */ +#ifdef KBUILD_MODFILE +# define DDEBUG_MODNAME KBUILD_MODFILE +#else +# define DDEBUG_MODNAME KBUILD_MODNAME +#endif + /* * An instance of this structure is created in a special * ELF section at every dynamic debug callsite. At runtime, @@ -128,9 +139,9 @@ 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_class_maps") _var =3D { \ + __section("__dyndbg_class_maps") _var =3D { \ .mod =3D THIS_MODULE, \ - .mod_name =3D KBUILD_MODNAME, \ + .mod_name =3D DDEBUG_MODNAME, \ .base =3D _base, \ .map_type =3D _maptype, \ .length =3D ARRAY_SIZE(_var##_classnames), \ @@ -169,7 +180,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, #define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt) \ static struct _ddebug __aligned(8) \ __section("__dyndbg_descs") name =3D { \ - .modname =3D KBUILD_MODNAME, \ + .modname =3D DDEBUG_MODNAME, \ .function =3D __func__, \ .filename =3D __FILE__, \ .format =3D (fmt), \ diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index fdb730db385e..7f78c6b3eeaf 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -248,7 +248,8 @@ static int ddebug_change(const struct ddebug_query *que= ry, =20 /* match against the module name */ if (query->module && - !match_wildcard(query->module, di->mod_name)) + !match_wildcard(query->module, di->mod_name) && + !match_wildcard(query->module, kbasename(di->mod_name))) continue; =20 if (query->class_string) { diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh index 8b2b7388678e..541a2ea7bcb3 100755 --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -76,9 +76,9 @@ function handle_exit_code() { # $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 +# "-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" @@ -223,7 +223,7 @@ function basic_tests { check_match_ct =3Dp 0 =20 # module params are builtin to handle boot args - check_match_ct '\[params\]' 4 -r + check_match_ct '\[kernel/params\]' 4 -r ddcmd module params +mpf check_match_ct =3Dpmf 4 =20 @@ -238,8 +238,44 @@ EOF ddcmd =3D_ } =20 +function test_subsystem_module_queries { + echo -e "${GREEN}# TEST_SUBSYTEM_MODULE_QUERIES ${NC}" + ddcmd =3D_ + + # Find how many 'main' modules we have in total (by basename) + # Use a more precise regex to avoid false positives like [irqdomain] + local total_main=3D$(grep -c "\[\([^]]*/\)\?main\]" /proc/dynamic_debu= g/control) + echo "# found $total_main total 'main' modules" + + if [ $total_main -eq 0 ]; then + echo "SKIP - no 'main' modules found to test slashes" + return + fi + + echo "# testing 'module */main'" + ddcmd module "*/main" +p + # This should match modules that HAVE a slash and end in /main + local slash_main=3D$(grep -c "\[[^]]*/main\]" /proc/dynamic_debug/cont= rol) + check_match_ct =3Dp $slash_main -r + + echo "# testing 'module init/main' (specific path)" + ddcmd =3D_ + ddcmd module "init/main" +p + local init_main=3D$(grep -c "\[init/main\]" /proc/dynamic_debug/contro= l) + check_match_ct =3Dp $init_main + + echo "# testing 'module main' (basename match)" + ddcmd =3D_ + ddcmd module main +p + # This should match ALL $total_main entries due to kbasename matching + check_match_ct =3Dp $total_main + + ddcmd =3D_ +} + tests_list=3D( basic_tests + test_subsystem_module_queries ) =20 # Run tests --=20 2.54.0