From patchwork Tue Aug 1 17:02:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129407 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2847896vqg; Tue, 1 Aug 2023 11:13:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlG0Hu24WEeTHhutgwq0s+193lgv+YLwkOTfZW3R+6E2VYeeRE+1Wz02H8mMBYe5MIFu2ZxR X-Received: by 2002:a05:6a20:12c5:b0:137:3c67:85d7 with SMTP id v5-20020a056a2012c500b001373c6785d7mr15232338pzg.16.1690913631283; Tue, 01 Aug 2023 11:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690913631; cv=none; d=google.com; s=arc-20160816; b=pvKRM3OAyJhz1hSBb5nIdYDZ3AfFtt5ZSH/6uKOp5uz/I8L9XunkwrvAWK2JuuX9z8 OjMj6hnfpGK0M/FucnKj/hvKv2TwVLZWyrKLTNoUuacJW5XWMXCQ6WJrlhKBvtNag20C qLI1glzz8enIgEqllo6lx0ZZjqzLnnjyVQe+buY5I0gXoeo9yavjQ+XAe8ofi8a3k9RJ jOAceRDNPPKu6maueN22+mBSRKnB3hYkaYkoggcHwRRNWlkC83+0ro3zsuxnLyyZ2S1K 0By0lhw3yyBeqU5+nPdE0Cu2QwOpcwI6UEPVxzbVGbgKssV86CNpKODqaIl/qz25D0pV B2NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K8UwYEhXGvMOm9hJtDT9yME4JurF5Y1Dv5ly2jFMGr8=; fh=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=RT99Ks2133eFJK4fN/K8exKAwkycH2Zz155rKIllpN6cB6CM02atJBaBW1FgbwWHow vRfdyTEYMqhLQKYn5Y+J+BLBI5LsUCoyu5QezeFDCvCC6/qUSJTqDqFgoxYPtVpYUnqg Gi4lCc8ABY1smOQe9erKZ84O2IO9oZ59/7SFQvxd6Ducca3hjXcOCtts6JiR0QMyO52X 6ileEv5wVOz8JSBLQWxz2x34OVKKsI1PSi6U8A8TW4+Aozn/hsIzKYs5SK1uunSqj1k+ 2c5jnc++czQZiXzNa81MW710BUnBoBICu5pF1EyxDDtHxdUDq9p8R5RCXyvvlAzwoc/M PGgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HjGZKDSb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i65-20020a636d44000000b00553caa0c899si1514036pgc.771.2023.08.01.11.13.36; Tue, 01 Aug 2023 11:13:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HjGZKDSb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234196AbjHARDe (ORCPT + 99 others); Tue, 1 Aug 2023 13:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233970AbjHARDX (ORCPT ); Tue, 1 Aug 2023 13:03:23 -0400 Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44F5B26A1 for ; Tue, 1 Aug 2023 10:03:19 -0700 (PDT) Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-1bc479cc815so2495480fac.1 for ; Tue, 01 Aug 2023 10:03:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909398; x=1691514198; 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=K8UwYEhXGvMOm9hJtDT9yME4JurF5Y1Dv5ly2jFMGr8=; b=HjGZKDSbMbpsnEvtJKmORkbhymh+5w+8w9Qb9gOwtWq3hAh1CvP9bpz2RuOPGiW3AC RXBOyBCYtVUbzPG1nkx3S2bKIjZbTcWGWWh17GxpJ0WvwCcknqodhJshYgEnUg81G4of 1dt8hjuRzApX9ExwC7nrZeWaFxILtLSGbcutJBc22B2irQIno+CPaD91UL1XHGHk5VCK S8ax8Y3F7cBjQVziVMXdOD6vZMC9qb0Bv7xvKSO2qRIoz3XVh6zqLkNhX81oQhYSUwY1 VYpUVmurffbOdR9kZWuNC5hLf2Y7pLTyr4pNxh4PFxNqd2dkU6ppS/DIa8dAZwva7Udy 1r4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909398; x=1691514198; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K8UwYEhXGvMOm9hJtDT9yME4JurF5Y1Dv5ly2jFMGr8=; b=hqNiD0EWEqiMG7YkulNxhb5SteLqdSAJl5aFMk4ob/DwHqEqAzt2W9lI6o1dfoqJvO aKiay5wFzFbIP/NAAX2bXKrylMSkoDZpq/wBekfyvlSS4iH5GnRVaHkqO1CpqtT6tr08 7TdXyVgmYKK+WjmEMjOpIXrzq0Mz4Ttp1965U9Ax33k5qq1GfL6udE9KtfJ6VEA2i3ef fhZE6+ZDG5+iZEQeDX2cOh2g+LRamSwF4sSlvxr+Id4SmKTVtwK6N6Wh8DzI0xeciwGZ jabD8WERhAsXLwyZpXAp1ywZViYWcg+zKCmEsNhklgg12Ruz5cY1ILzDk9jvsuLmPCFp 8Dwg== X-Gm-Message-State: ABy/qLbslUGNYlWGA+O/oJiZoqFfZguYzlecGHpJE1mOvnMn46Xdk1zt JzDmiVYaL3waRgbP7vyAVC0= X-Received: by 2002:a05:6870:c685:b0:1b7:4655:2ac9 with SMTP id cv5-20020a056870c68500b001b746552ac9mr16125728oab.6.1690909398089; Tue, 01 Aug 2023 10:03:18 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id o20-20020a02c6b4000000b0042b144abf71sm3768577jan.179.2023.08.01.10.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:17 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, daniel@ffwll.ch, jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: linux@rasmusvillemoes.dk, joe@perches.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, Jim Cromie Subject: [PATCH v5 05/22] dyndbg: ddebug_apply_class_bitmap - add module arg, select on it Date: Tue, 1 Aug 2023 11:02:37 -0600 Message-ID: <20230801170255.163237-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801170255.163237-1-jim.cromie@gmail.com> References: <20230801170255.163237-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773051452041299324 X-GMAIL-MSGID: 1773051452041299324 Add query_module param to ddebug_apply_class_bitmap(). This allows its caller to update just one module, or all (as currently). We'll use this later to propagate drm.debug to each USEr as they're modprobed. No functional change. Signed-off-by: Jim Cromie --- after `modprobe i915`, heres the module dependencies, though not all on drm.debug. bash-5.2# lsmod Module Size Used by i915 3133440 0 drm_buddy 20480 1 i915 ttm 90112 1 i915 i2c_algo_bit 16384 1 i915 video 61440 1 i915 wmi 32768 1 video drm_display_helper 200704 1 i915 drm_kms_helper 208896 2 drm_display_helper,i915 drm 606208 5 drm_kms_helper,drm_display_helper,drm_buddy,i915,ttm cec 57344 2 drm_display_helper,i915 --- lib/dynamic_debug.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index b4b6c5111315..d875c4fa5335 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -600,7 +600,8 @@ static int ddebug_exec_queries(char *query, const char *modname) /* apply a new bitmap to the sys-knob's current bit-state */ 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]; @@ -608,7 +609,8 @@ 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); + 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)) @@ -617,12 +619,15 @@ 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); } + v2pr_info("applied bitmap: 0x%lx to: 0x%lx for %s\n", *new_bits, *old_bits, + query_modname ?: ""); + return matches; } @@ -678,7 +683,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]); @@ -688,7 +693,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); @@ -751,7 +756,7 @@ int param_set_dyndbg_classes(const char *instr, const struct kernel_param *kp) inrep &= CLASSMAP_BITMASK(map->length); } v2pr_info("bits:%lx > %s\n", inrep, KP_NAME(kp)); - totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits); + totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, NULL); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -764,7 +769,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, NULL); *dcp->lvl = inrep; break; default: