From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1ACFBECD6F9 for ; Thu, 12 Feb 2026 00:14:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 79D7410E675; Thu, 12 Feb 2026 00:14:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="eP2ll5Ma"; dkim-atps=neutral Received: from mail-oa1-f68.google.com (mail-oa1-f68.google.com [209.85.160.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1AD5410E674 for ; Thu, 12 Feb 2026 00:14:26 +0000 (UTC) Received: by mail-oa1-f68.google.com with SMTP id 586e51a60fabf-3f9ebb269c3so3492435fac.3 for ; Wed, 11 Feb 2026 16:14:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770855265; x=1771460065; darn=lists.freedesktop.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=v93TTTW57AikWbJXv/QxFh+heUPvPvKb06L6QAirCj0=; b=eP2ll5MaR0RKR0g9raE73v9d/J2l7ZmKS3Nb4RY8IMwcjPHSqNbqPScvrPFpNm91NC 3neskWcl19Wwp3kdX47yTQZR3mndf/Az5OWcMZlXBiRBv9UTpjLJ32ufGK3mikLxxN9j iJZr0PEfJWGgfds0d/Nd2FaRtbTl3/TVj4+H3GldRFjVCFRg+OwUjx/2dRU9YnxHxFOU KgABDsGP/7Z/KjwRHwvb8PqzZ4PUPmfXJJ96eEmduBTqR+9R6SrTbArEBNYtVBS6Du0n HByl5okhieRpRqMV5/FGcFwMbL/Oe/0lHE8qwyzQClsrUgmNgXcqygC8k97FsKLjop/l qE9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770855265; x=1771460065; 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=v93TTTW57AikWbJXv/QxFh+heUPvPvKb06L6QAirCj0=; b=NTVM71U1EptutcepiIuTgDAqNhf9kAF5qwSrN+LVCGlsx8kvGaOL9FAWqaMEPzGChB 4kzMjBKUiehdJ7NeKGrz0p+kqmZ4kI/BlZQxXHStTBVE/O7eTODXNduNxGMagEccGRDK Bw9YzmxTPeOZglyqUBJhyDTkmgU4qBboaZuUIvdZrSb4eEpzslhk4/DOriR8cL5IsOJl TpC9prO0wvxQbeVc6JiFK4glmGedXX+vdiXF9inIbbB0qgAk+XisHFmKVZjor7Vfmwsc Q5WMrwMheo7HPOdbCV1wLvdokRNnc3Er4pZqaMHqbKEvNc0I69XRZrdnosOiZW/HpXaD Pjpw== X-Gm-Message-State: AOJu0YxBacoLEO9pQMpC1h0BekzjuTe9HMj5oSWKTvh78N/X1wP1UdPo nOgaD1hZwkWpJ6GObEPr7n94dQBl6DHgt47X6WodEFIExK9BLYIiyS16wyoFz1/n X-Gm-Gg: AZuq6aJshr/xKTlGS5UHoRp0bEZL1VBI+QbV16eZk+eDZGKoCkvPtRLAtGsfuX7KYLd 8wXS8f5nYhuVtmXjoJadCIsqPYQdw/o8qnYQbggCf2VJpDWG8kpsq3Ody3P65a0E2q9HQVn2uM3 OQLVmrczQD0/kMHeQrwobHgfgbFAp4FxQb52vQLguidZG68E5LOKJ37YiVpS3b35qEr4OGduiTW bw9ppuyfws0n8LRuRfGRImxUCQT4e9n/tsyCvejtdB5LRbJyWZoT8qsFfdqHK3cvQVl05Ez6Huq Pg+voFNW3WMIejwfM9b+8V8+K9qA0vachXV7RS+6hTi/XyghOP+6GgOmZXnicVYwjLeJ1xfBioS Nn8pLlu7FeNoMYwgL1gdr0Qe8yao+aiuwJ4a5gIB71myeQjTkmoQpc1jnsvqE5HX6IVSHivz8lB L8eBIMl+Brrx6saDVGtOkz+IaIk0g6zYsGs42RfKKS197LqWh7b5Xd X-Received: by 2002:a05:6870:2c45:b0:3f5:d9b0:567e with SMTP id 586e51a60fabf-40ec6f3c212mr679239fac.14.1770855265075; Wed, 11 Feb 2026 16:14:25 -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-40eaf1062ffsm2331939fac.13.2026.02.11.16.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Feb 2026 16:14:24 -0800 (PST) From: Jim Cromie To: dri-devel@lists.freedesktop.org, intel-gfx-trybot@lists.freedesktop.org Cc: Jim Cromie , Louis Chauvet Subject: [PATCH 12/61] dyndbg: refactor param_set_dyndbg_classes and below Date: Wed, 11 Feb 2026 17:13:07 -0700 Message-ID: <20260212001359.97296-13-jim.cromie@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260212001359.97296-12-jim.cromie@gmail.com> References: <20260212001359.97296-1-jim.cromie@gmail.com> <20260212001359.97296-2-jim.cromie@gmail.com> <20260212001359.97296-3-jim.cromie@gmail.com> <20260212001359.97296-4-jim.cromie@gmail.com> <20260212001359.97296-5-jim.cromie@gmail.com> <20260212001359.97296-6-jim.cromie@gmail.com> <20260212001359.97296-7-jim.cromie@gmail.com> <20260212001359.97296-8-jim.cromie@gmail.com> <20260212001359.97296-9-jim.cromie@gmail.com> <20260212001359.97296-10-jim.cromie@gmail.com> <20260212001359.97296-11-jim.cromie@gmail.com> <20260212001359.97296-12-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 b5a3184288b0..b6ee4d9cad86 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -605,9 +605,10 @@ static int ddebug_exec_queries(char *query, const char *modname) return nfound; } -/* 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]; @@ -615,7 +616,9 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, int matches = 0; int bi, ct; - v2pr_info("apply: 0x%lx to: 0x%lx\n", *new_bits, *old_bits); + if (*new_bits != *old_bits) + v2pr_info("apply bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); for (bi = 0; bi < map->length; bi++) { if (test_bit(bi, new_bits) == test_bit(bi, old_bits)) @@ -624,12 +627,16 @@ static int ddebug_apply_class_bitmap(const struct ddebug_class_param *dcp, snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi], test_bit(bi, new_bits) ? '+' : '-', dcp->flags); - ct = ddebug_exec_queries(query, NULL); + ct = ddebug_exec_queries(query, query_modname); matches += ct; v2pr_info("bit_%d: %d matches on class: %s -> 0x%lx\n", bi, ct, map->class_names[bi], *new_bits); } + if (*new_bits != *old_bits) + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, + *old_bits, query_modname ?: "'*'"); + return matches; } @@ -684,7 +691,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa continue; } curr_bits ^= BIT(cls_id); - totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits); + totct += ddebug_apply_class_bitmap(dcp, &curr_bits, dcp->bits, NULL); *dcp->bits = curr_bits; v2pr_info("%s: changed bit %d:%s\n", KP_NAME(kp), cls_id, map->class_names[cls_id]); @@ -694,7 +701,7 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa old_bits = CLASSMAP_BITMASK(*dcp->lvl); curr_bits = CLASSMAP_BITMASK(cls_id + (wanted ? 1 : 0 )); - totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits); + totct += ddebug_apply_class_bitmap(dcp, &curr_bits, &old_bits, NULL); *dcp->lvl = (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); @@ -708,18 +715,9 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa return 0; } -/** - * 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 = kp->arg; const struct ddebug_class_map *map = dcp->map; @@ -756,8 +754,8 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) KP_NAME(kp), inrep, CLASSMAP_BITMASK(map->length)); inrep &= CLASSMAP_BITMASK(map->length); } - v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits); + v2pr_info("bits:0x%lx > %s.%s\n", inrep, mod_name ?: "*", KP_NAME(kp)); + totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, mod_name); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -770,7 +768,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) old_bits = CLASSMAP_BITMASK(*dcp->lvl); new_bits = CLASSMAP_BITMASK(inrep); v2pr_info("lvl:%ld bits:0x%lx > %s\n", inrep, new_bits, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits); + totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, mod_name); *dcp->lvl = inrep; break; default: @@ -779,16 +777,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); /** - * 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) { -- 2.53.0