From nobody Thu Apr 2 20:20:43 2026 Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.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 7FE8F3A75A5 for ; Thu, 26 Mar 2026 18:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774551318; cv=none; b=ocKTX/+QO/28VJebWdac+ZnyoGzKHuF05ywkfhlSQ9rqdDk5uXRB5j7T8yHInXkOfi9LXwA0t8weSGyGhJzk+e84nZwqa8AAwF+qXmCPhV1MlUZw27E/ebhNKhO29SaTwPN2Er7ANl7ZWbqjm2alPwqH0K3ex3yQ86Y9yPLpmgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774551318; c=relaxed/simple; bh=9ethbFA+3sG+Yt9H6ZFtM83MzmnmFw3XXUtYcrjFgG4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hl/8gGvsPbPqeQf2GynQbBqaaJv2VbCGVdf2+ghw9FQAMR1vCEvRbiydox0LnIF0satb0YVpta9D9NHgM/AOQ4knSqfTxbwtm1lLZKlt7Pp5n4xzoEQCZSvidc0jyVkMGZSPMwlkeyuyuGpPrlwlfMKhKdOyIF3hEtWkduLYXKo= 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=p9uiqp7f; arc=none smtp.client-ip=209.85.161.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="p9uiqp7f" Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-67bad873c3eso872534eaf.3 for ; Thu, 26 Mar 2026 11:55:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774551315; x=1775156115; 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=Op8z6BF2VC082oV6Way2DdykcbiTU1bYqkraAfxcvx0=; b=p9uiqp7fFDgZ4LzHUuEL++z3IOR42FKZwwJdMdTOeBMAGuUIIrAlORLrxX6zhwkjBx GpOQ9La5NGH3AXrZqN3dAeGHAtf1BWQ75K9eiiqxOYKsB5GBDZXt4M1MB2nYx5QIQd/v IYDIgminI5FKYomYLzJ5sUEgu+DXvg7qxSS6yq41O+jQQIipGG3X9cTHVVt6Y1QRMeU1 1Wqk59ln5eF9fG76gbVn7iIs4b8KMoDfS2GT8ynvIVffItn+lF6cq63MKU8COxE4259m rCLYv+bAhiNrUesAXPAeoYEhzcHPIGTKI68YuSjhiFsmER/R1fLFTaaNstJUeVznQXor JFcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774551315; x=1775156115; 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=Op8z6BF2VC082oV6Way2DdykcbiTU1bYqkraAfxcvx0=; b=jCh4S+U80M39WDSxU1IwXbzeSqQdx810EkjOxyN0ozJ7QAFTvc6VzlWAuHgUXFe8gd R/LufDZx51jikgUEF5ozURgRsKyvWYaL0pN4DtBnu+Xv0/3mhJOHE5PudBW8jePA4n4Z mTpMwUMBKMJuymcMqzhFVbJvsYoPZEhlrMNYkNiJS4IDKwhNwGonbZp499ikldu1Mj79 KkM2a9QbBLPd8FLChMXj8szln4GHPfER7rJR7V3AP1NdcNf2OfA6wFo9GTvkBz+sHuFs ZFbLa7LBD9kvOLU+pPOm5LZzrEHqYptHqzA6rtqUYvD9BHDqBnBNYui3tDDqYhudp2Kx qkOg== X-Gm-Message-State: AOJu0YzN3BdU3GkRpJ8+zkfHpYb+hhxnX/54YY3Pf8B7TlCtxiLKVhPh 3rH+iioHhOqF8Y1mbQLCkFDDyvxCCLILwdaTS4MM8K45n084utzO6WO9YVDGMg== X-Gm-Gg: ATEYQzxR8Ot70Wcwc3V2xG1VIc8p4aGSRdxbH81PTRc4FVMryPdqI2qWR8ND4JiJXdw ckGOxhHu9DY4bx53iqdqqkq4XM1TI4gdaxdglI96PRAGNtgBOm4Ta0bdGpfgm/emTNTz/T4yotF jIG903o1QHb6GCcsxhG7lvk1jxaKOQSaK/nWDGpbv8ZKEFNBUAUXex0QHDbdsCA6jmZoByhZcpz T9D3PE/oODMhB6BCPJ+qZ+Ftz5tsmHGO+jpo2N23njAa9hdTDOWURRpDAFCCUJw1q2cFRRfuoMf 0ERBMrjFoMRz9FFPjP0mAG1R7SOqG5xU5FoawCevMoACtzIAKZxu5CjzMt/1UVztHUbGWJWXxyt MElQvQ2xXn5ZCUJQF9tTAZQ02B5GXJqjMBEN4XUhDxNft5/S3crOpYF9d3k6KdNRGKBSG0T1Oxm RhrPnDiWAAOWn1cVe3tokG8dJkQzNRljPE6qcb2nK0ydO9b9OY X-Received: by 2002:a05:6820:8c1:b0:67c:305f:ac67 with SMTP id 006d021491bc7-67dff3cfa80mr4059105eaf.11.1774551315200; Thu, 26 Mar 2026 11:55:15 -0700 (PDT) Received: from frodo (c-98-38-17-99.hsd1.co.comcast.net. [98.38.17.99]) by smtp.googlemail.com with ESMTPSA id 586e51a60fabf-41cc7760c08sm3075171fac.4.2026.03.26.11.55.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2026 11:55:14 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, airlied@gmail.com, simona@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org Cc: jim.cromie@gmail.com, mripard@kernel.org, tzimmermann@suse.de, maarten.lankhorst@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, christian.koenig@amd.com, matthew.auld@intel.com, arunpravin.paneerselvam@amd.com, louis.chauvet@bootlin.com, skhan@linuxfoundation.org, pmladek@suse.com, ukaszb@chromium.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH v12 30/69] dyndbg: treat comma as a token separator Date: Thu, 26 Mar 2026 12:53:34 -0600 Message-ID: <20260326185413.1205870-31-jim.cromie@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260326185413.1205870-1-jim.cromie@gmail.com> References: <20260326185413.1205870-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. Reviewed-by: Louis Chauvet 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 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 =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 c6f3b0452dfa..16cff6c3b81a 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.53.0