From nobody Tue Apr 7 12:55:39 2026 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (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 E8F443A3832 for ; Fri, 13 Mar 2026 13:23:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773408239; cv=none; b=qx45AmZ0Mw7yAh/tI04R5miPmVToPpzY9z++RXaUHtLWiMnuo0yxUZO/HfZS5oPeE89s+2bWu85Djo6YJ3gBMsmfItw/Dt6Hrc7oRum03ApglosdgHXLLLxa3f231CIKHuCban/lIo71elHLhmicAb3rgHBA3TI0BlTGT2OyEpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773408239; c=relaxed/simple; bh=/DeIXqJLu0dhqgtEH5faf5593G1G1tM77qhOiecPIIc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N9EtUvZjegAENjQTIKPZToc5hvN0SPKJb2U6t7CWY14E7TyxyqKgBW7GDwN6+vw7Rf071BxHwtzGrA64lXuAtzWVnQGK0qZxl2OvVmAPy3Vi0tdVeApoXV60mDXzM4/Q3MQyI24jVV+czHSKUi5q4OiqCkOOlLcgVd6iNvLqNDM= 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=e4o3DJi1; arc=none smtp.client-ip=209.85.167.181 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="e4o3DJi1" Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-464bc03efd8so1515138b6e.2 for ; Fri, 13 Mar 2026 06:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773408236; x=1774013036; 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=fLJ6/kh9zV3xnzIvFpZnDpL3mZ5cCxT808iTivJti0s=; b=e4o3DJi1DLsxLhW6GfE79wnkHY2D8OQyr50Lne5MMObKo2GQhLIliCBaAt3ynCBjA/ IaNSbJSBMMVWZHzdxMMPZl3/yeM49N/0VU2apUsvLVs3RjKDKK6xu1b5F5GaL8hsCKwT hUmdEpzyu52e+y+PoQNGieQvu5JSBh0W5r7NH6Fl2XsjODcBLJxfS0Vq2C18S98nkKL2 4BwzNRaC7+xZKTrGbUDaS71kQmekmPPSPakDXpJVTs5yyZHgpQeVwNkJxJOW2+ItE0OA TkPFYdFa32et4irF/5dlK7KBWaRGoriZgLCjFT6LP6UFfh1KgB3B/NrXGBv+SaQUNq4u YRLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773408236; x=1774013036; 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=fLJ6/kh9zV3xnzIvFpZnDpL3mZ5cCxT808iTivJti0s=; b=KnI9V/5XqY38Nz0VLQj0RxDJFG7Gi/Zg16WxNVbmWzOUgeOisFXX7uYAekxfSPEhse WCq0vuXCgcflW2t3H8kdowirtHjoB06Py3NJ+OICnCNO+d8SbsqUsyJUl7ujkIkUfMSD ySOaVkcxPeNgJZuXZczw6IJHzkODPULg5QJUXo6MhqkPiyIPZs7cwuphwzx2SSVuM22f +YsZJ2zsQ5RLU57dMIRwXXaRGb99NaWG6F3sYlpayPO6od+NuifmPNXYhWcQ+dPjJbmG gIdy9ZoLewQojYTTHbypnlf2uliJq5XVNFG9+j4e1YY3CXLTuKPg3qV1fo0Jb1mH0GD2 lexw== X-Forwarded-Encrypted: i=1; AJvYcCUra/HJr0jRZklmzcKuouWIalD/ZJMlf+zZSZcxjlJbMceRJCYFvCfnXgpY9Ht66kcfoCPq0jvWF4n5Q6M=@vger.kernel.org X-Gm-Message-State: AOJu0YyRYzVn2aNdAtEpxZCwklmq+cU4OIGlIJk+JJUtvA1PT06Lv2KU En2mf5UAfGdltSil4UxVMYR9wvxhxQv3ZEhOeYXKOqmE1bqAxFYzNlpU X-Gm-Gg: ATEYQzxrmA0BHF+JLpjH9nUxcUJJC8KAHmGKKCV7AQmSbvKQoVq/ZDSiPsEuayUHbYF VThT0wF+ZD+/8xufpYsy/GQKdEazXClaWC2WuX/5TRh9s946T73q6Oh1PQmvC3/IgbCDl+Phbyt UUrx1AnkeQAmiHroM68GzoDmm1gruqVMKhGx9fRcfD8umKzhCOWDyop8xhDe0FIu5yPdyWmHQlU ObbyxBYBFbG70S4V2tT2cfRi1nDYGWpIX3KWHgtBXith/QnDwn87CHVwp/waGV64w9E8hxhU4Nb mvlAf3vkCPOnb2t4wqvnYyeqB98PuopKIO9NZl4IXiwDzETV5qodrzI/Y+ElfoAiQrKpqo4QlUL 6r4KntuvXcgxlxMIqr2CjlqazZnikPgdnOWiHNIJRqSP46mdNkH+++ROET1pmMhs1zINp7S2MBa 3aCBmhMs5tgxFxizK8Ptba9ovnCt27JR5h/ZVfbEnPUqd0ObcL X-Received: by 2002:a05:6808:19aa:b0:467:284:b3cb with SMTP id 5614622812f47-4675701cd1dmr1819155b6e.2.1773408235774; Fri, 13 Mar 2026 06:23:55 -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 5614622812f47-4673434a35csm4795987b6e.20.2026.03.13.06.23.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2026 06:23:55 -0700 (PDT) From: Jim Cromie To: airlied@gmail.com, simona@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, Jonathan Corbet , Shuah Khan , Andrew Morton , Jim Cromie , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: 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, pmladek@suse.com, ukaszb@chromium.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH v11 27/65] dyndbg: treat comma as a token separator Date: Fri, 13 Mar 2026 07:19:52 -0600 Message-ID: <20260313132103.2529746-28-jim.cromie@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260313132103.2529746-1-jim.cromie@gmail.com> References: <20260313132103.2529746-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 Reviewed-by: Louis Chauvet --- .../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 e383e93dc784..a77c6e9ff90c 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