From nobody Mon Feb 9 10:27:47 2026 Received: from mail-oi1-f193.google.com (mail-oi1-f193.google.com [209.85.167.193]) (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 26EBD2F618B for ; Wed, 14 Jan 2026 01:59:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768355972; cv=none; b=GpAdG9gL5TatySPUip6UY6FMiDI0mKeV2Grh5lpgrGemEFAXB8emYaP3LZNw5L70kYMeXrWECrg2enh5qmw/Qh6rTnJ9oxm3BMJJSx5yQCbRoWviko+TwL1Kf+/JSYmpi4tAof9tcoaFL8la/rA4SWvK5VFGZjuos+8z74Wz3hE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768355972; c=relaxed/simple; bh=vg63sy7QbWL0kibdt/FXOXuPKUSSpfXUoQuv+kiBi1A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vlrf6kiLXu66vO+hZp21OH3lT7JanaP5hk4pJtemcJDRfx/5KeN5qLmyPfzALU85ZN3BcDu4NhMXMNsbRt5jwkLC1VG0NEUxDPum9hGFqOdJRsPLcFD5uH+KHcyeSpXsxJiCjf6doFR159erKjzsGodivBW0BWEJACTc5k3M21M= 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=nV8P/HuE; arc=none smtp.client-ip=209.85.167.193 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="nV8P/HuE" Received: by mail-oi1-f193.google.com with SMTP id 5614622812f47-450be85b7d9so5310217b6e.0 for ; Tue, 13 Jan 2026 17:59:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768355968; x=1768960768; 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=esuoUN/X0OUOWwx+QdeV/Q9GgUdfEO6lTOhgSGNn33g=; b=nV8P/HuEzqcknIiO04Fujy7Q72VeDGf4pTNBZewXSMlLb+bn0eRzCPbQgpLv+PnwhA cmN5FzimgYsKh/I2zzHzLhvibhz5wFJYRIzHBOCQ2+7aJ3WZMbEab7pzZ8vZhHDLqIkb mZIhyXiQpv7RFtf9VlhmbYuDXZnUhONhtvgpr4FzELqd0A18HcP/U9iEF3j96w6emytf nXYPE4nTDrcy0TFDNRHOZaf+I0mGxIxmLMr2WpjF4o8L/+SyDDoC4dYd2FR5xS0kXkdw 9dn/D3IRj5+yUgYrFkLwaUWXb63ST2D0N2QXDpb6ePaQ53G7fdys3DUKLZQXEGjrgRtw Vz4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768355968; x=1768960768; 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=esuoUN/X0OUOWwx+QdeV/Q9GgUdfEO6lTOhgSGNn33g=; b=gkN1JBoJHX7XDeWFV/WOY4URkzZ3PjgYiFIikYndsym7VbVv3M30hb0f3wyiTwQ/st jC9pfpHXhwUoZLSYaf+tkUjzkgSpWPWgZt02j2SOzN3CB8u/6VG8WU2Slm32CVOcLv7U RK5wyrxj/8Y0i4BPq6+qCrcqX/xRqiYrxZQOTTSQjR4KPvemhPh++LJ8p8bmCLSyOJ1V qwc7a9NAla6SCi0AYTzHt2bCfKH09xtiIOQXl8pSX29xuimhQwHMhO590qsm5x6hyGRq 1yf011tZFNsQkIp5TGGNYqqw22A1vBgpr9FvBkAgHc/36LE+AVVRiOU/Gu0fYidcR9M0 rLSA== X-Forwarded-Encrypted: i=1; AJvYcCUClNZqSCDjgXdS6QJPGkokfcsr/izPy81WrqpF3ZUWG3vMgnN4lH5/SjBz0brkwanpvvP8Dju2gr+ogVo=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9dpiEU7o4JkB/2GFinMSzjCiNAV1yJOkmFhYyqdcBpWJlb6Xh EPqmUIXsCeBqIi5XTnBNycFkm0QRA5hndDytarUn2a8/4nfT8FXhwgWS X-Gm-Gg: AY/fxX4lX5Nn1k7d3TgYD7lBao8p6ilRG3f+KimN/7gblFTSalMbrq8+6DMAUkjXkSX Jj8p7fysUjJeN64ltyGrJ5yo0ziZbkGoTTer96KAvfDjyrVccJ2anCcd+ZGC7ms0q7a/mTks4cu p3KH9GXQpmB35ot5OezXlAYgWmh7ytk6vYy7zZrRaiWUdpLts2cpzB8QWWfwzPPqMLrK8zQ9cvp CYDG8DVCmqpTUAGRhKv3jlhBTUiK2Al3ADFDIvgPO5mUYGntYhpOBshV699DX1QAo2LiLurH+is TikDoky5Gz1q1LM19fFhn09y1IWOv5sESI9OvNbW58emeftHDmU2baP0Es4yvlrA7XyOQtPC9y3 NYpDUE0PrCkmqxzo8QPN5mxMVklPzebPyx18cEVFALSfLcY5jf/VyGKFdIj3NpwzuzF9irFyLu7 BG4Bs/NxybWl/K1Om9C17+W3h+XK/Qb4Oe7Qk7 X-Received: by 2002:a05:6808:d52:b0:459:9358:ab70 with SMTP id 5614622812f47-45c714f27d6mr642429b6e.31.1768355967898; Tue, 13 Jan 2026 17:59:27 -0800 (PST) Received: from frodo (c-98-38-17-99.hsd1.co.comcast.net. [98.38.17.99]) by smtp.googlemail.com with ESMTPSA id 586e51a60fabf-3ffa4de539bsm14995190fac.4.2026.01.13.17.59.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jan 2026 17:59:27 -0800 (PST) From: Jim Cromie To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.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, Steven Rostedt , "Liam R. Howlett" Subject: [PATCH v8 11/31] dyndbg: refactor param_set_dyndbg_classes and below Date: Tue, 13 Jan 2026 18:57:27 -0700 Message-ID: <20260114015815.1565725-12-jim.cromie@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114015815.1565725-1-jim.cromie@gmail.com> References: <20260114015815.1565725-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Refactor callchain below param_set_dyndbg_classes(1) to allow mod-name specific settings. Split (1) into upper/lower fns, adding modname param to lower, and passing NULL in from upper. Below that, add the same param to ddebug_apply_class_bitmap(), and pass it thru to _ddebug_queries(), replacing NULL with the param. This allows the callchain to update the classmap in just one module, vs just all as currently done. While the sysfs param is unlikely to ever update just one module, the callchain will be used for modprobe handling, which should update only that just-probed module. In ddebug_apply_class_bitmap(), also check for actual changes to the bits before announcing them, to declutter logs. No functional change. Reviewed-by: Louis Chauvet Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 65 ++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 1db2f627237a..64d69f5cba1b 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -604,9 +604,10 @@ static int ddebug_exec_queries(char *query, const char= *modname) return nfound; } =20 -/* apply a new bitmap to the sys-knob's current bit-state */ +/* apply a new class-param setting */ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, - unsigned long *new_bits, unsigned long *old_bits) + unsigned long *new_bits, unsigned long *old_bits, + const char *query_modname) { #define QUERY_SIZE 128 char query[QUERY_SIZE]; @@ -614,7 +615,9 @@ static int ddebug_apply_class_bitmap(const struct ddebu= g_class_param *dcp, int matches =3D 0; int bi, ct; =20 - v2pr_info("apply: 0x%lx to: 0x%lx\n", *new_bits, *old_bits); + if (*new_bits !=3D *old_bits) + v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); =20 for (bi =3D 0; bi < map->length; bi++) { if (test_bit(bi, new_bits) =3D=3D test_bit(bi, old_bits)) @@ -623,12 +626,16 @@ static int ddebug_apply_class_bitmap(const struct dde= bug_class_param *dcp, snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], test_bit(bi, new_bits) ? '+' : '-', dcp->flags); =20 - ct =3D ddebug_exec_queries(query, NULL); + ct =3D ddebug_exec_queries(query, query_modname); matches +=3D ct; =20 v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, ct, map->class_names[bi], *new_bits); } + if (*new_bits !=3D *old_bits) + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); + return matches; } =20 @@ -683,7 +690,7 @@ static int param_set_dyndbg_classnames(const char *inst= r, const struct kernel_pa continue; } curr_bits ^=3D BIT(cls_id); - totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits); + totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits, NULL); *dcp->bits =3D curr_bits; v2pr_info("%s: changed bit %d:%s\n", KP_NAME(kp), cls_id, map->class_names[cls_id]); @@ -693,7 +700,7 @@ static int param_set_dyndbg_classnames(const char *inst= r, const struct kernel_pa old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); curr_bits =3D CLASSMAP_BITMASK(cls_id + (wanted ? 1 : 0 )); =20 - totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits); + totct +=3D ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits, NULL); *dcp->lvl =3D (cls_id + (wanted ? 1 : 0)); v2pr_info("%s: changed bit-%d: \"%s\" %lx->%lx\n", KP_NAME(kp), cls_id, map->class_names[cls_id], old_bits, curr_bits); @@ -707,18 +714,9 @@ static int param_set_dyndbg_classnames(const char *ins= tr, const struct kernel_pa return 0; } =20 -/** - * param_set_dyndbg_classes - class FOO >control - * @instr: string echo>d to sysfs, input depends on map_type - * @kp: kp->arg has state: bits/lvl, map, map_type - * - * Enable/disable prdbgs by their class, as given in the arguments to - * DECLARE_DYNDBG_CLASSMAP. For LEVEL map-types, enforce relative - * levels by bitpos. - * - * Returns: 0 or <0 if error. - */ -int param_set_dyndbg_classes(const char *instr, const struct kernel_param = *kp) +static int param_set_dyndbg_module_classes(const char *instr, + const struct kernel_param *kp, + const char *mod_name) { const struct ddebug_class_param *dcp =3D kp->arg; const struct ddebug_class_map *map =3D dcp->map; @@ -755,8 +753,8 @@ int param_set_dyndbg_classes(const char *instr, const s= truct kernel_param *kp) KP_NAME(kp), inrep, CLASSMAP_BITMASK(map->length)); inrep &=3D CLASSMAP_BITMASK(map->length); } - v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits); + v2pr_info("bits:0x%lx > %s.%s\n", inrep, mod_name ?: "*", KP_NAME(kp)); + totct +=3D ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, mod_name); *dcp->bits =3D inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -769,7 +767,7 @@ int param_set_dyndbg_classes(const char *instr, const s= truct kernel_param *kp) old_bits =3D CLASSMAP_BITMASK(*dcp->lvl); new_bits =3D CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); - totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits); + totct +=3D ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, mod_name= ); *dcp->lvl =3D inrep; break; default: @@ -778,16 +776,33 @@ int param_set_dyndbg_classes(const char *instr, const= struct kernel_param *kp) vpr_info("%s: total matches: %d\n", KP_NAME(kp), totct); return 0; } + +/** + * param_set_dyndbg_classes - classmap kparam setter + * @instr: string echo>d to sysfs, input depends on map_type + * @kp: kp->arg has state: bits/lvl, map, map_type + * + * enable/disable all class'd pr_debugs in the classmap. For LEVEL + * map-types, enforce * relative levels by bitpos. + * + * Returns: 0 or <0 if error. + */ +int param_set_dyndbg_classes(const char *instr, const struct kernel_param = *kp) +{ + return param_set_dyndbg_module_classes(instr, kp, NULL); +} EXPORT_SYMBOL(param_set_dyndbg_classes); =20 /** - * param_get_dyndbg_classes - classes reader + * param_get_dyndbg_classes - classmap kparam getter * @buffer: string description of controlled bits -> classes * @kp: kp->arg has state: bits, map * - * Reads last written state, underlying prdbg state may have been - * altered by direct >control. Displays 0x for DISJOINT, 0-N for - * LEVEL Returns: #chars written or <0 on error + * Reads last written state, underlying pr_debug states may have been + * altered by direct >control. Displays 0x for DISJOINT classmap + * types, 0-N for LEVEL types. + * + * Returns: ct of chars written or <0 on error */ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp) { --=20 2.52.0