From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.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 01BD737D107 for ; Thu, 29 Jan 2026 07:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769671891; cv=none; b=rdysDvH1O7elZirZ2MfKgfugW+iWA1jm8alNUu6z4HaswXzkeNk2g+qJ5thBohWhlinZgocsFSM1NzioXf/CEbezyvi/jdrnGrG/kPccL+8gIHjSz10WWfQ89WsWPS1FhvOA52f+HOeGMea07PnsfAIaLI1z+wZm/rMoafp9StE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769671891; c=relaxed/simple; bh=WNFHUnqzgDML2E8fRvJfrbHub3FCLJsfaV2ZvzZdIWM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HoayFP59+IWo8tuoYjK/i4fychaa0xGa1zoXgg8NKSXxvrdyrWjCsz3BwoMHArmph+djizKG/eZKYZS2JCY736V5J2HOTqz8usoc/HVR/qMUNEglBrx2gDqN8Oc6eomLyleVIpNczQwf5MCnUSHRLSZ67cQtdpkXGjhQlkqF4rE= 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=DX1ts97A; arc=none smtp.client-ip=209.85.210.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="DX1ts97A" Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-7d148dd3421so229505a34.0 for ; Wed, 28 Jan 2026 23:31:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769671888; x=1770276688; 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=gLnXo5yx7jTU6//VujJhbrPBDy69yZ4QLqb7zkkpO0o=; b=DX1ts97A/9R3vpSi70MXm7i2OixQQwsFz326Knk7/qJ27YFQoxW1RJ7ZCq/Qwhw/6l YTkkHVZJBup9qOxhKzik+1b17dORTSmCHIQij83p8Y9lzS+AMh2gxixOzp+ijBEyC2J9 U9dC0THYWcqQivEXmVnEhF7lIlsyzwbWPX3xYKfAJ/0APnD8qr0PZ40S+6j8eOGeqnS0 xCNhe035ltLrWHJVb701apCS8Maya39rHi8cterSGPgz6Qo9CZnDnjW6D3bwswzeqdWr 2215kvifiBSwysfuSTszfEwoPG1wz/IgG6K2+yuRN5Q0nQaB1VN1tNX7D1k5/spZBgpA qmuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769671888; x=1770276688; 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=gLnXo5yx7jTU6//VujJhbrPBDy69yZ4QLqb7zkkpO0o=; b=IKRkHP3i/0oDUS8KdjYrAlEToqI2RvDt51kF0Xxxw9CeSQTnt0VZxrWgau3iHBA50m yhhTCmo+ZParolCUXqE8x2m0FuDCsFSqrvjmmnP4ff7gNCL4qXgHgEFVqkxfeL7nYjJ1 o24F3CCWXWtyzXOyEHTloJTdhPypmICpUmezYavEHDfGVwBQUP3SfTo972ALjqK56WHn lJ7A2kSixeTYE3pv2Yam7+5sFO3PHEJS4pt1GHJLWlb1a/Ma3+xXtHfNq3XPB/i/b8qL TPhLVLR7wzR0mw1p8twzwAmoiAsF+0dtnSCMVbcwcRKhndnBC2pZWVUmj4HX521rES/Q H/Hg== X-Forwarded-Encrypted: i=1; AJvYcCWv6j2usm9OFA0LZ3keu16nDvQwxFe5Spp9mbfJIWyLuHERGN14dUM0P9wczgztkNqRBSlWoe6aofl5aQk=@vger.kernel.org X-Gm-Message-State: AOJu0YyG6N5XizK8sX6wzb2PK2jfM5zoSVSFLO3a/BlZ4aExwH/1ggDn fSt/smGa0RPXcLfdSVVmTSN/X21kgu37f70hnoctjxRC3xq3260onCrU X-Gm-Gg: AZuq6aLvmjnoReYwRvvCEbQV9xjBd5oJuViKOieaJWV4mnHyfoRtmy1Xu8SRxe2iosy cVeuCl5kT0+iAa3YmqFiYL3QqYUM9Hmg2RS6FCglvanT9gQuQMgMHKc66PunzOdZyjEIqIagmTg aVaVXjQsKG2nIpV8RKwwFZ6g8KkmFoaCkoirMyeCAEhQQfOMxnE73zlOCu9Z1wyJ4TXt+hJTMhe dreTvkMZ4K3tjHCPmORfAGxxgqHFjegjOgR9p+xszcdKCShxYU63mhTMws+sVB1VnrJ5CKPAj+6 S4915bqOAqMgnjmHMf+l0K6594AcRoRhwasEOwoqsriHoQKW19hu4ZITdROWrlfTqH+yQiW4uxQ 9MnZ/63FQfqPCNMxelFi35dxnukK48GRkGggDGj3ZxtspiLfWt2E2OAYJLTUrWioNlq5ayLWOH8 eu3fuDNUTkZ9z6GB3dPhX4zSmGMufc4ITjpnAfulxm X-Received: by 2002:a05:6820:1c8b:b0:65f:698e:d5ba with SMTP id 006d021491bc7-662f20344d9mr4152211eaf.17.1769671887783; Wed, 28 Jan 2026 23:31:27 -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-4095752ef7bsm3344155fac.16.2026.01.28.23.31.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jan 2026 23:31:27 -0800 (PST) From: Jim Cromie To: gregkh@linuxfoundation.org Cc: Jim Cromie , Jason Baron , =?UTF-8?q?=C5=81ukasz=20Bartosik?= , Louis Chauvet , Bagas Sanjaya , Dave Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org, Petr Mladek , Shuah Khan , linux-doc@vger.kernel.org, Jonathan Corbet , Andrew Morton , Shuah Khan , Ye Bin , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v9 27/32] dyndbg: treat comma as a token separator Date: Thu, 29 Jan 2026 00:29:13 -0700 Message-ID: <20260129072932.2190803-28-jim.cromie@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260129072932.2190803-1-jim.cromie@gmail.com> References: <20260129072932.2190803-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. 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.52.0