From nobody Tue Dec 2 02:41:32 2025 Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (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 447E9369235 for ; Tue, 18 Nov 2025 20:19:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763497173; cv=none; b=XKFCeFtaa86xlNOJaTCLT1F/5knFCLfQW520cBGjN0KhOQUSBgvfjX+GSKtgmngCCw5j8u4VaFLNRhcq1vxgm+4GqHCfbLLJnchi2OW0qNEEC44YgsJWflQftf2OqJK+td9A2rqYp8JOkHcQPLSg8fBUxsY0AiEiX/Cga2DOoKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763497173; c=relaxed/simple; bh=fSdaw1JlkB6R9xYAc/koBzsT+rP7nOm1rusWL3YiAew=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eQxmU7hfQgJVB6G3G0FX70rsosZzR0HeQUxVQ0TREm3RevWM/GP34imt1te+JmYT++1l8F+tqzKAmp1T/EjLlRtwBcOXhSF0GLGvLPYv2tVTvwagQvxpv2A54cUxz/vLjpGn7itXJc+DC0ey8/uCT1taxxjQXVCdlv9rui57iMU= 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=YVv5FLpQ; arc=none smtp.client-ip=209.85.166.54 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="YVv5FLpQ" Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-9491571438cso95885739f.0 for ; Tue, 18 Nov 2025 12:19:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763497170; x=1764101970; 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=iDmLAh6L3qfE5I3PPkJH8Cxtstet5049GvOKQ6v63l0=; b=YVv5FLpQDnTu2zTyWwrIhHxlbPzyYqoipIxStMimK0gcILoYe13f/81DjvQng7DLNv TEmNjSw+Px5qfbcBhQQ7VKNzp3eRIVxc3FVyHw8zFVY6FkX+IUBgk6jCoAxT0LbzT99p ahs9SBKAatOQY/n8IYAclQd4vLiXb5qqWFszoO/SdkLBpOunrSeDWA4wGMZ/IttPFCPi UqjseASUtGUEk29nMjSUachvl8CedNfWO8oPjzbwfVZTbeSYw3HvBWcMjkOyz724gHkQ KkhqoeP8F3at1K2/rSuVeDApOIf7RC9TdJ4SIay3deZXSZe+rboZOY8Lrq1fg/+qPetn iHzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763497170; x=1764101970; 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=iDmLAh6L3qfE5I3PPkJH8Cxtstet5049GvOKQ6v63l0=; b=C7iTFOSwzNXv1pJpFBr8k1ObArIehIMLYm1G9Q+PU8+ZhiwONF404lkfIfaiJgpc5i cceb0IeiCVJ4J7tjTHSc/KM0BdTSQVCFu3Qn/KFKjp0bJvlX8TXzD3yY/WYGjUUVUMuC kteCJcZDCrNFeduNOhQerZVYJRZgqrq0vQlSYosvdPW40ulbxT15KVtOnnLWVTVFgMBu XmeCturuBVBrU1fsNLUwEhEDEZhlSqXP1WgZICh58GX19uVSTpsa8MGcCv/RPhZrzUzt vV9uiSMFfZlOaOz8o4vdwPoywNqXmhPJC6lG8f1fEqxMCEdwTeoppWL9UV1oNA48fzuM VGAA== X-Gm-Message-State: AOJu0YzD6d9NfTuS0sJLRAJXg7pL+S0YHqZiLkWgPngz9uJWsK94jcdJ 2ElB27h6KB2V5aqi91Ar3OU46ZC8Rs/i6+vLhAtVcYqtKR0UWa4WjZ0ZJ2acS4Kl X-Gm-Gg: ASbGnct2PrVTJJr6VdjXU8F8ZA9XmsL0038Ue+YA21LcskFCzLgupVS7rLpsBAeAwDT rFN3JTPVeM173f+lCAtW1WgGQBd7ZMUymZ0eemH9ZBekqOLXC++xmkn3Myx1wfprkmZKwerdFjx 3gBXwsldWPv8VsxStLU9XoWn9YUpl+LXUp+mFFUzjDkmFfCIhMBXKvTVnW9no7tZtsWEa2wM8bZ RxtPWOzPSq4fL56Vw6JBjN4qHN4ldovVtBn3KPgz/zb2hj25tr5nBe8WlYyRclyckevJ74Xh9bJ ghX2iEIMfhi59H93LyCSQ6zRa+nQQXQCyAQD0ZfP5Ex2AIq9mqo1AlajekijIzKL0pD+Uw9ChW9 4ZUK4dKuLIpLXOdd5szk+GlaGXAYcNewbZXHgYd4WfMb1sKj9JKq2jFZf15D9MyqGg7CovODKkH s1p5x7KT8Z4KYkRyoMWLPt1vKlMknglWEAoALVHCwUOrVaSFrnfCGxBI6X7usPKE5Xjuy0m/Luw EhSSN8vHXTdHeBV X-Google-Smtp-Source: AGHT+IGHKbB65vavYEMOS/NJ+GV6ZutSZ5VWZuxeJuxtFXQ0Q7SAMBMx+6kusKwl8ZMfFS2eoq8GoA== X-Received: by 2002:a02:c004:0:b0:5b7:c784:53a5 with SMTP id 8926c6da1cb9f-5b7c9a3e6f2mr10102281173.0.1763497170093; Tue, 18 Nov 2025 12:19:30 -0800 (PST) Received: from godzilla.raven-morpho.ts.net (c-98-38-17-99.hsd1.co.comcast.net. [98.38.17.99]) by smtp.googlemail.com with ESMTPSA id ca18e2360f4ac-948fd4c273bsm419823939f.18.2025.11.18.12.19.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Nov 2025 12:19:29 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, gregkh@linuxfoundation.org, jbaron@akamai.com Cc: ukaszb@chromium.org, louis.chauvet@bootlin.com, Jim Cromie Subject: [PATCH v6 26/31] dyndbg: treat comma as a token separator Date: Tue, 18 Nov 2025 13:18:36 -0700 Message-ID: <20251118201842.1447666-27-jim.cromie@gmail.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251118201842.1447666-1-jim.cromie@gmail.com> References: <20251118201842.1447666-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. Signed-off-by: Jim Cromie Co-developed-by: =C5=81ukasz Bartosik Signed-off-by: =C5=81ukasz Bartosik --- - skip comma tests if no builtins -v3 squash in tests and doc --- .../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 63a511f2337b..e2dbb5d9b314 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 69a87eb13262..c34de431305d 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.51.1