From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (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 BA54C391853 for ; Wed, 8 Apr 2026 20:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775678568; cv=none; b=dLNTER736HWB11fNsESQGJCEBQuGCZCkjSXJpxhz7Cw+u5EQ2ihy8HZfXHE21bikaL/o9oeqRPuNwR7LfVzorVlYVlTmlTnhwzIkUd33PSOI5rKlbbTXBHqT9m8dSarHK9fxEJLOZpbTzQVPifftzMNV3jXqZvQz80zGOfU7AqI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775678568; c=relaxed/simple; bh=9ethbFA+3sG+Yt9H6ZFtM83MzmnmFw3XXUtYcrjFgG4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kHMVNAjc7kixo1kyUXCMtmRvkbanMwRvL4KxQ9sKTV5EUnrg6gKfCJFU/8N84PVAGtKQJtZtmoYJHcyBkovDhEiLIhBGZ9llLCJa/VxqyPdDPMrBEzQeiGfOFcjmh+RuNOB0xsNL6ZU6TOhfL8Po/imuvXaN0okdzMI8GXVVeVo= 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=rJh3hUEY; arc=none smtp.client-ip=209.85.210.50 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="rJh3hUEY" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-7d55b97f358so104235a34.3 for ; Wed, 08 Apr 2026 13:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775678565; x=1776283365; 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=rJh3hUEYt62u1+mXXNGPY9vXmxP07pfcTZBIV6+sLihzHueR4YUM0HyZj37/rwvjbK iUVTneUPcFPR5c2xwfRu42RZ9rDx1twBWwLS8xFCO+tUzwfQS602r2FwD/pC9iMVp7+2 rwsLS5kX+evFAdFD9V1mcRO2q/gIYtwl+b5+gJ1mfnhUjHdnAegMONPjuIsF2UKkDVAw RR3Ms1f1F2aXc0bYQJUvZLMV8lnXAyx6C3OcVJWLj3kCmG7hbN8tjaUyUje5wVCE0NqY NOIaWkm6rYhIL/mpElVxGtEl8RwN0fAfV9epnaYi9MMKIQ3gBz99qYRuEk6SWW1R642k Cd1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775678565; x=1776283365; 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=eYixnRvp8rzsfOTDpg1UO2jOnrHgr7yNBGhVEFMybBy9QiDnnbnjbO/hu4QN2xTmRx tTf3hIYOvUGNKqAJouJdJ+CHPjL0bL6oCKaB92j37AKPrydpNYf1C7zvjOeP+0l9KeKO q6wIIkqfYcZh2KFbhJhNXP9geVGFaRkuwITb27KozVFcdG2dfzeV2W4qTwNtqrA2l4km 8AQy4qRdFOvqlMSAHSTxTn62/Q4+5tySipjE7DDfIqmJ5BCfS236YVGNT8ex0C2uzaKN oiUQwLCCYEW9doV8vUrgYFpJIHgyqXD+IYlgknw21Ax2CS2SNu2z1WyV7YtYwb0RwhH1 EKiw== X-Gm-Message-State: AOJu0Yxe8gDBhtZV9ihQ36e957FNhb1nf3u+sv6W4WN52MGkDmvTrYO9 ZLuZMMGNpv1nqRaTaXRMlt+CF2vtq3H8u4piGx5IzHl7qid0YnKwbRz7Ouggtw== X-Gm-Gg: AeBDieujMoNiiAtElUn6pRUcCVTDQBtCWjaKKmhWH7VloQ0vRU0osO53yAA4Kd8Ck0J sWmSF0bmiTgIdRul1TrrbtN0HPYQ+p3q4Dco+6l2L7vfCmS+gsYrvaEev/iWZnQCe2tPzV+Ftgs 51GhGyBqCPzaxadzUb98t2zzZmtmKno4Thrx2lb276N6rIPZWpyzFcVECqSeoMQehQDEVdxaWWn JlxGwqCRxQbkKYB5LBVdwCFbdQhRAjZZ33iuN6kJ5Vf78gvmUf3cKYqNbZobipJUe5gemYQDfKx sZQfRfQyrIU8N2AogwtGgHAADgF1c+0K0xiRyUVG2zY4LE0gzuTNANalpq3E3EA2dq+fC2/kA7Z 0d4IuyuFqF7ydBFtTsVsGTj3LKRfQq+UNxatKL8ynrXxBKj5iLG1G+67qCp7OOznaeJa7bRevNc eo8IonRwFfsqzwCeV/6Vq0CUSrKbbBZeSUUJJYc08JSMWOUoEyTIaFnAjVnl263klVXFdR1umYl r0= X-Received: by 2002:a05:6820:81c4:b0:67b:b8d0:a7d5 with SMTP id 006d021491bc7-6822024fab7mr13382144eaf.53.1775678565380; Wed, 08 Apr 2026 13:02:45 -0700 (PDT) Received: from frodo.raven-morpho.ts.net (c-98-38-17-99.hsd1.co.comcast.net. [98.38.17.99]) by smtp.googlemail.com with ESMTPSA id 006d021491bc7-680a63c7fd1sm12254208eaf.8.2026.04.08.13.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2026 13:02:44 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, jbaron@akamai.com, louis.chauvet@bootlin.com, Jim Cromie , =?UTF-8?q?=C5=81ukasz=20Bartosik?= Subject: [PATCH v13 30/36] dyndbg: treat comma as a token separator Date: Wed, 8 Apr 2026 14:02:05 -0600 Message-ID: <20260408200211.43821-31-jim.cromie@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408200211.43821-1-jim.cromie@gmail.com> References: <20260408200211.43821-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: 8bit 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. Reviewed-by: Louis Chauvet 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 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 *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, @@ -333,8 +341,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 == '#') @@ -350,7 +358,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, @@ -622,7 +630,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