From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 801A0ECD6FE for ; Thu, 12 Feb 2026 00:15:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E044A10E699; Thu, 12 Feb 2026 00:15:05 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BX3gK+tP"; dkim-atps=neutral Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id E603510E687 for ; Thu, 12 Feb 2026 00:14:42 +0000 (UTC) Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-40ea36b56b7so1442654fac.3 for ; Wed, 11 Feb 2026 16:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770855282; x=1771460082; darn=lists.freedesktop.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=KFDXN7CShA4R0fifKwYW6C+VfN8iLMds/9j20+4ypoQ=; b=BX3gK+tPgZzxneaiICDZeTQpNtUGRfIjKFfiNKZvF5neKiRWAc1Yy2ytXRRQiZAhqw v4sYj1U92QI5zdeKNU/oHZIosNTXqphMkjZenb33qall874gYyDMB0BrMIMbIIogaFNZ yy2CdiwvnuK3VCJ9WX3JPa9xfDCvIxpH60TSPX7LP+RqVgtb/NUK/eva2tRMy+8mCthY +nS7GBVZCQHBaD5uLopJkiZerG1MI5OvZMGPqxXBdVfl7H0yuaYFclbWSsO9ogvJsMT7 TOFayBfdjgJZEDYg+i7i8ArZTe8KNL2yJ7CBErYmBnxQYnSTQid0UejfvDzuKk0wdYoC m/ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770855282; x=1771460082; 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=KFDXN7CShA4R0fifKwYW6C+VfN8iLMds/9j20+4ypoQ=; b=Df8roscOzdezxZOoeWtL8+o2VXDa+k5CIzxALkyhdPefhnU3oc0rWBkZviUzrE7ZwW 4LCqJbBKeyDERcrv1gOLS6DuaFKjLbsPXXQvC93HinV5y9uvKG+jHDrUO171j5cDvL0G TQzCltA/I9ZbPhW5myH35kbN2FHajcZtBsyt/eXsezhGbiXnEDc7KJKz7+1jjGQsDI/4 CUjOtEoRJ6mLoZUatgmtgQJ8rGiyQsojU4B7l4e91bad7D/w4gjVa/q9UaiZisIz4a6S JTChH0YfhpgTNOpsMPImpVh3iMVF49dCghv4XcUNQYiQ3rhfWmIpCNFWgdx8IIZpamp2 vGgA== X-Gm-Message-State: AOJu0YyZ3ziBRYefv2PGbBkZVynQVq6NlaBxn9eVCXH7Noc8s1bCVhup wJO8xEO/9is2gdFQ36JMEOgHogttSoCO33WQGTBXuGeKKD5DY9svAmXY/Fz/Gg== X-Gm-Gg: AZuq6aI+YuMKlZQwgJZ8gchmonNJu4yGnexPOiiO6weeFBlPzVdNvv1ZCCScYZ/qOqb 5b5mFVfJpcpJNfiizapyccXrRL+4+xsQZnK4YIUzqcnqoT8qaF93ghdp0J/SAMHo3Vq0/iETPKx d19SsPQNoN92vTngfDYmFB+xmv5NUNDJPrqzYG+UnKp9uGRHvMbi4U6SlJFP4cOIBjwWKYz6fbv c6iXkCapshh+HX6glznhJ7r3BC9CLgA2dJnKQMAwEkCnSZPfZeO1wWDGqiEqxEtIZH73HwLvQDq QPUvAhgCBRkO4dN1t4HsnJqJA+SrR2Lv3x2gfbyFea0ipwW2Es53A9Sgo0i9x+m5wGcbhOTBWLM rkdFtJVaM7IGrrRT/oFEsBaYpdJRR0vs9EU3WWHj8G2BL4+xk3UO7aqrG9G2mISRkc4X032LMh1 WrAL1ZEsX6ot7NHMLc4X8cOL9DZnQprALW+i7Z0ag434yPe0xsAKCZNA7Du5606ww= X-Received: by 2002:a05:6871:3411:b0:409:8ccb:bc0c with SMTP id 586e51a60fabf-40eca030191mr338554fac.24.1770855281840; Wed, 11 Feb 2026 16:14:41 -0800 (PST) Received: from godzilla (c-98-38-17-99.hsd1.co.comcast.net. [98.38.17.99]) by smtp.googlemail.com with ESMTPSA id 586e51a60fabf-40eaf1062ffsm2331939fac.13.2026.02.11.16.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Feb 2026 16:14:41 -0800 (PST) From: Jim Cromie To: dri-devel@lists.freedesktop.org, intel-gfx-trybot@lists.freedesktop.org Cc: Jim Cromie , =?UTF-8?q?=C5=81ukasz=20Bartosik?= Subject: [PATCH 27/61] dyndbg: treat comma as a token separator Date: Wed, 11 Feb 2026 17:13:22 -0700 Message-ID: <20260212001359.97296-28-jim.cromie@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260212001359.97296-27-jim.cromie@gmail.com> References: <20260212001359.97296-1-jim.cromie@gmail.com> <20260212001359.97296-2-jim.cromie@gmail.com> <20260212001359.97296-3-jim.cromie@gmail.com> <20260212001359.97296-4-jim.cromie@gmail.com> <20260212001359.97296-5-jim.cromie@gmail.com> <20260212001359.97296-6-jim.cromie@gmail.com> <20260212001359.97296-7-jim.cromie@gmail.com> <20260212001359.97296-8-jim.cromie@gmail.com> <20260212001359.97296-9-jim.cromie@gmail.com> <20260212001359.97296-10-jim.cromie@gmail.com> <20260212001359.97296-11-jim.cromie@gmail.com> <20260212001359.97296-12-jim.cromie@gmail.com> <20260212001359.97296-13-jim.cromie@gmail.com> <20260212001359.97296-14-jim.cromie@gmail.com> <20260212001359.97296-15-jim.cromie@gmail.com> <20260212001359.97296-16-jim.cromie@gmail.com> <20260212001359.97296-17-jim.cromie@gmail.com> <20260212001359.97296-18-jim.cromie@gmail.com> <20260212001359.97296-19-jim.cromie@gmail.com> <20260212001359.97296-20-jim.cromie@gmail.com> <20260212001359.97296-21-jim.cromie@gmail.com> <20260212001359.97296-22-jim.cromie@gmail.com> <20260212001359.97296-23-jim.cromie@gmail.com> <20260212001359.97296-24-jim.cromie@gmail.com> <20260212001359.97296-25-jim.cromie@gmail.com> <20260212001359.97296-26-jim.cromie@gmail.com> <20260212001359.97296-27-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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=class,DRM_UT_CORE,+p\;class,DRM_UT_KMS,+p or as a boot arg: drm.dyndbg=class,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="class D2_CORE +p" new format: modprobe test_dynamic_debug dyndbg=class,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: Łukasz Bartosik Signed-off-by: Łukasz 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/Documentation/admin-guide/dynamic-debug-howto.rst index 9c2f096ed1d8..dbf901150587 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -78,11 +78,12 @@ Command Language Reference ========================== 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:: :#> 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 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 ``_``. - module sunrpc + Examples:: + + module,sunrpc # with ',' as token separator module nfsd module drm* # both drm, drm_kms_helper diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 85fa031d8696..cec054ef7d64 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -321,6 +321,14 @@ static int ddebug_change(const struct ddebug_query *query, struct flag_settings return nfound; } +static char *skip_spaces_and_commas(const char *str) +{ + str = skip_spaces(str); + while (*str == ',') + str = skip_spaces(++str); + return (char *)str; +} + /* * Split the buffer `buf' into space-separated words. * Handles simple " and ' quoting, i.e. without nested, @@ -334,8 +342,8 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords) while (*buf) { char *end; - /* Skip leading whitespace */ - buf = skip_spaces(buf); + /* Skip leading whitespace and comma */ + buf = skip_spaces_and_commas(buf); if (!*buf) break; /* oh, it was trailing whitespace */ if (*buf == '#') @@ -351,7 +359,7 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords) return -EINVAL; /* unclosed quote */ } } else { - for (end = buf; *end && !isspace(*end); end++) + for (end = buf; *end && !isspace(*end) && *end != ','; end++) ; if (end == buf) { pr_err("parse err after word:%d=%s\n", nwords, @@ -623,7 +631,8 @@ static int ddebug_exec_queries(char *query, const char *modname) if (split) *split++ = '\0'; - query = skip_spaces(query); + query = skip_spaces_and_commas(query); + if (!query || !*query || *query == '#') continue; diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/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 =_ # zero everything @@ -238,8 +238,27 @@ EOF ddcmd =_ } +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,=_ # commas as spaces + ddcmd module,params,+mpf # turn on module's pr-debugs + check_match_ct =pmf 4 + ddcmd ,module ,, , params, -p + check_match_ct =mf 4 + ddcmd " , module ,,, , params, -m" # + check_match_ct =f 4 + ddcmd =_ +} + tests_list=( basic_tests + comma_terminator_tests ) # Run tests -- 2.53.0