From nobody Mon Feb 9 08:28:26 2026 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.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 3E5433064A2 for ; Wed, 14 Jan 2026 02:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768356029; cv=none; b=OB0aY97axleK5oCSR2oIQiUtC/M4Jp89lM3JNYvGlmoIpjk7+vKxiedl9wHGdgeaqDVh6987mb9uHIlC53jE3BXrp/t+zS1qIqHbcDy9BmUaOaEyTVilO/6+AL4zyj39jsLMQnB3JuPbB0xMRiJlelDgLClOl5B0X1kSBRa+D5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768356029; c=relaxed/simple; bh=9ih6W8Y/5V2V98AP03k684uMSvrAzs/VQOAmnnbAdf0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SUul4ccjJ4GiJYEVlgrCBta0A9B9792T/FierNWgAKPIrjRFx8tD2nG/VDasCLAcDvQBzYsFnCJze4DZylVSghIFEepjT2fSg3qFU0SZ9YBC/1qN5bGRYQHEj0V//J8JytbXMt1Hq/fhH/Ub3PS8dlcQ/RqoCCTeWemntG2bR0Y= 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=aCdsd1t1; arc=none smtp.client-ip=209.85.210.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="aCdsd1t1" Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-7c701097a75so5022378a34.3 for ; Tue, 13 Jan 2026 18:00:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768356027; x=1768960827; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WDCSt59K+10ZOKnakaeCilFtSVyquWS+P/cFe/a6uAg=; b=aCdsd1t1bpjo9kktuakmkzMMneXG6iL0Zx/ZOSfFoQvfNwu5vjgkk7A2rX6Uz6laXO dQb7+CNRwtYJZEgqIyEQhXMKvaUE16uHMNaurej8Eoi6qLuuoCkKpXHbcwYw/K4NGp4N zreIne/rUJ3ImpHWh/CHMpdjXDIgKYVbkB+VQqKnS2UWmfjvYbp/6W9HMwWokez4gUuP 1PSLd1nZzHCZ2OdgNnJvjzmUBKZmYnPnZnXjpDNt4oO7DNkZO1L9XAzxg2VXkaO0W75H 6Ti4wn+6n6k/FC/osMNZXi3L2NazYT3KU2OCJGmQasQMZnuipzJ9gK18a7O0CG43Wn6i fTpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768356027; x=1768960827; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=WDCSt59K+10ZOKnakaeCilFtSVyquWS+P/cFe/a6uAg=; b=DC3j9e6NNxLGTfeNnrveatijd4EKbf5SVAq/POkON2H71TMwPiHsZyCFV2VLrlUusa XQdy92W0lgYgFYo1nKTi1tWgrGyjk7jyd+R+8DqrXT2eAORCCht04IlcLOgCNr2ai65w QrEZRNrjOuthF3X4G0zkVEmb9vNwzqKyY2EGvrmv5xvXfFHsmLdYaT89pDpw3R/Xa5Sp mDjHBtS4p4vWueLKdYxYMST2JjBDt/HkQnL//IZ+z+58khcMHscJ9HyBt8mhIoEkSpGg SdC7Do6AwrIStjTouk9n6ygN7OJCJw0uClCFvBbv1QTmwJ0sPshJf/XbfqKqwQGWPlxG 8R4A== X-Forwarded-Encrypted: i=1; AJvYcCUOvE8LJd5ckxcgX56wefvqSEw5jMBxET+bfnUFt0i25tWXI52HPVP8xH4YdlXnaZTl5cdzuRQBmxpTGF8=@vger.kernel.org X-Gm-Message-State: AOJu0YxZTFb7GWAKuTgLQPtMUA64VfKaRiJ+W81RbIaCSZoywx+23vqC XHW8Bjim/kqLzOZtT+zXNm/OAumh2sDvPYX83m9Z97bKEnq9ODlmpmVt X-Gm-Gg: AY/fxX4GkjfTX4vWhN5KlhVmD6H4RLU0GR46A3oo6s74hoTHPXs6qta/clZ0Cio5NU5 aijmGX6nmOZllSKuvjonZh0/BNZCSoTZMjTopP6l3UBn2DXhwtkIOcMexZe+DxFQRv3RYla/Pwd mZNiH3M0DYV/Ah7/t8zBefZoEH/IR54L1Z5PT7yaLqOTiK4P03RQtwt3cXFgyk0pnkyTmUPOMu6 CUc+boYz2BKuunSYvGmCYVCJpmLaoVGVqU42A1MK7/4P7Ej0Itysere/oPG+32MonbdZkrtrL7T Hjp7uWYc0JFKmrYsmILbLJaZQKNe/REkKOZNqa7U6Mm/4g7zV0DO21nFuD4bOCmYvPNk1jvqBT5 8T8Xn5I4Yt9kl1Ut42cj/i+cv9ngBRQwF7FHt+Dy0ScjIFsDTqvbapBcA0nkMzyHqLMuPpn0giw 6Bf89kOY5gq3k13IIdch4boHaaVAvpJWl10FX0 X-Received: by 2002:a05:6830:4c8b:b0:7b2:aba7:f4e with SMTP id 46e09a7af769-7cfc8a99a10mr780858a34.10.1768356026972; Tue, 13 Jan 2026 18:00:26 -0800 (PST) Received: from frodo (c-98-38-17-99.hsd1.co.comcast.net. [98.38.17.99]) by smtp.googlemail.com with ESMTPSA id 46e09a7af769-7ce478ee668sm17747037a34.29.2026.01.13.18.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jan 2026 18:00:26 -0800 (PST) From: Jim Cromie To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Jim Cromie , Jason Baron , =?UTF-8?q?=C5=81ukasz=20Bartosik?= , Louis Chauvet , Bagas Sanjaya , Dave Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org, Petr Mladek , Shuah Khan , linux-doc@vger.kernel.org, Steven Rostedt , "Liam R. Howlett" Subject: [PATCH v8 26/31] dyndbg: treat comma as a token separator Date: Tue, 13 Jan 2026 18:57:42 -0700 Message-ID: <20260114015815.1565725-27-jim.cromie@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114015815.1565725-1-jim.cromie@gmail.com> References: <20260114015815.1565725-1-jim.cromie@gmail.com> 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 Treat comma as a token terminator, just like a space. This allows a user to avoid quoting hassles when spaces are otherwise needed: :#> modprobe drm dyndbg=3Dclass,DRM_UT_CORE,+p\;class,DRM_UT_KMS,+p or as a boot arg: drm.dyndbg=3Dclass,DRM_UT_CORE,+p # todo: support multi-query here Given the many ways a boot-line +args can be assembled and then passed in/down/around shell based tools, this may allow side-stepping all sorts of quoting hassles thru those layers. existing query format: modprobe test_dynamic_debug dyndbg=3D"class D2_CORE +p" new format: modprobe test_dynamic_debug dyndbg=3Dclass,D2_CORE,+p ALSO selftests-dyndbg: add comma_terminator_tests New fn validates parsing and effect of queries using combinations of commas and spaces to delimit the tokens. It manipulates pr-debugs in builtin module/params, so might have deps I havent foreseen on odd configurations. Co-developed-by: =C5=81ukasz Bartosik Signed-off-by: =C5=81ukasz Bartosik Signed-off-by: Jim Cromie --- .../admin-guide/dynamic-debug-howto.rst | 9 +++++--- lib/dynamic_debug.c | 17 +++++++++++---- .../dynamic_debug/dyndbg_selftest.sh | 21 ++++++++++++++++++- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentat= ion/admin-guide/dynamic-debug-howto.rst index e76ccd987704..350d93834e19 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -78,11 +78,12 @@ Command Language Reference =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D =20 At the basic lexical level, a command is a sequence of words separated -by spaces or tabs. So these are all equivalent:: +by spaces, tabs, or commas. So these are all equivalent:: =20 :#> ddcmd file svcsock.c line 1603 +p :#> ddcmd "file svcsock.c line 1603 +p" :#> ddcmd ' file svcsock.c line 1603 +p ' + :#> ddcmd file,svcsock.c,line,1603,+p =20 Command submissions are bounded by a write() system call. Multiple commands can be written together, separated by ``;`` or ``\n``:: @@ -167,9 +168,11 @@ 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:: + suffix and with ``-`` changed to ``_``. =20 - module sunrpc + Examples:: + + module,sunrpc # with ',' as token separator module nfsd module drm* # both drm, drm_kms_helper =20 diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 1da2de7b1769..5ac7248d51bb 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -320,6 +320,14 @@ static int ddebug_change(const struct ddebug_query *qu= ery, struct flag_settings return nfound; } =20 +static char *skip_spaces_and_commas(const char *str) +{ + str =3D skip_spaces(str); + while (*str =3D=3D ',') + str =3D skip_spaces(++str); + return (char *)str; +} + /* * Split the buffer `buf' into space-separated words. * Handles simple " and ' quoting, i.e. without nested, @@ -333,8 +341,8 @@ static int ddebug_tokenize(char *buf, char *words[], in= t maxwords) while (*buf) { char *end; =20 - /* Skip leading whitespace */ - buf =3D skip_spaces(buf); + /* Skip leading whitespace and comma */ + buf =3D skip_spaces_and_commas(buf); if (!*buf) break; /* oh, it was trailing whitespace */ if (*buf =3D=3D '#') @@ -350,7 +358,7 @@ static int ddebug_tokenize(char *buf, char *words[], in= t maxwords) return -EINVAL; /* unclosed quote */ } } else { - for (end =3D buf; *end && !isspace(*end); end++) + for (end =3D buf; *end && !isspace(*end) && *end !=3D ','; end++) ; if (end =3D=3D buf) { pr_err("parse err after word:%d=3D%s\n", nwords, @@ -622,7 +630,8 @@ static int ddebug_exec_queries(char *query, const char = *modname) if (split) *split++ =3D '\0'; =20 - query =3D skip_spaces(query); + query =3D skip_spaces_and_commas(query); + if (!query || !*query || *query =3D=3D '#') continue; =20 diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/too= ls/testing/selftests/dynamic_debug/dyndbg_selftest.sh index 465fad3f392c..c7bf521f36ee 100755 --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -216,7 +216,7 @@ function check_err_msg() { function basic_tests { echo -e "${GREEN}# BASIC_TESTS ${NC}" if [ $LACK_DD_BUILTIN -eq 1 ]; then - echo "SKIP" + echo "SKIP - test requires params, which is a builtin module" return fi ddcmd =3D_ # zero everything @@ -238,8 +238,27 @@ EOF ddcmd =3D_ } =20 +function comma_terminator_tests { + echo -e "${GREEN}# COMMA_TERMINATOR_TESTS ${NC}" + if [ $LACK_DD_BUILTIN -eq 1 ]; then + echo "SKIP - test requires params, which is a builtin module" + return + fi + # try combos of spaces & commas + check_match_ct '\[params\]' 4 -r + ddcmd module,params,=3D_ # commas as spaces + ddcmd module,params,+mpf # turn on module's pr-debugs + check_match_ct =3Dpmf 4 + ddcmd ,module ,, , params, -p + check_match_ct =3Dmf 4 + ddcmd " , module ,,, , params, -m" # + check_match_ct =3Df 4 + ddcmd =3D_ +} + tests_list=3D( basic_tests + comma_terminator_tests ) =20 # Run tests --=20 2.52.0