From patchwork Thu Jul 13 16:36:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120034 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1962867vqm; Thu, 13 Jul 2023 10:05:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlGo14038Jnv5TTA0H1m8SfvnI1wFG+Mn+tGrMuj0DgOjUWMGGsiHc9RB17TqXui622f6vmK X-Received: by 2002:a17:906:2487:b0:992:9d41:875b with SMTP id e7-20020a170906248700b009929d41875bmr1715053ejb.32.1689267931292; Thu, 13 Jul 2023 10:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689267931; cv=none; d=google.com; s=arc-20160816; b=hctqjE9VsqqOiSx1PuRAUojGXRrEAbrg1scCXDrZltoMGq+0f6C0H/TpZ7oenVWcjV 5oBrYFpkgbpEaVlr4UBUiVV4yBrdBRviPSk4EowFp/KVn9xOT95+Z56H7y3FAiqxsDra RlRp37xkezAeqV/QaEbD32ljUL5KmC7e2vLUKz8HkSF5bUYJkH5QEd1RA7yOLbWr2I4K PyXkEXnfpG5UdOm/B1stRvVfOSefVpj8eqi813vH5Jj/Q0H9J0lSa6C9mQVOBrgRV/Ud q14osRN2HoQ1ESWHnvZ1mFl+Q9w4j7ZdP5dNwlCW1rTGPI+jn04RdwFI7wnb5ZCzZUwG La1g== 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=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=Br0JXCEvurPb3HAkOVTapEDZqUE9Gm5HTE+CfNlCE/3ilRTRLwQR8aSmqTTdnockiG rfGdcceZlhX8UITq3xpVt6397N75XmkHtxNsB+pqs8CTcv+Hzuk1MnuNxRs/mn8sIzHr b7H7AJ03VKBLy9NBiennprlf56E/aeVMluutgnKDPl1pygNTaSU7pH+rz6nId9rgKco0 WP9dGTAdeWfuGczjHOhwz0hXwewiBCUs/ndngjKJ0GCAtQsTx6l8Z1U3CIpKdFEioEH0 XlSaWKn+NwIOVpEGZkz+kkez0h7aWjadQKgoa2BjFKVmKrc8JWhzQV9+JZY+1Qv/xrZx Q18A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=AuwGBuwl; 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 o1-20020a1709061b0100b00988994251edsi36944ejg.258.2023.07.13.10.05.03; Thu, 13 Jul 2023 10:05:31 -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=AuwGBuwl; 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 S234213AbjGMQhi (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230411AbjGMQhP (ORCPT ); Thu, 13 Jul 2023 12:37:15 -0400 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08DDD2D43 for ; Thu, 13 Jul 2023 09:36:53 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-3463dd0bd4eso4079085ab.1 for ; Thu, 13 Jul 2023 09:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266210; x=1691858210; 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=AuwGBuwlrrLu40acW99jFlLtkUWhTCHFk3fJ+7F3MWNB8VBjHSt7TmnOumYE9qj/eR Fck6YBny/40AxU3NbabNLYmsb48gPhibIqjkyWjOUOoEvjgZ2uWZKLXL/4xRYAj871/S 3wenPmiIkh1vK5Ys39I1m/Ppvtzz3X3/POF5kMUQqfNZ6Pf3oWrwhUMdDri4eJ/eyaGu ZdqbBVb9xq+s0x6ym4yitwGUAd04K0wJaeVpj8d2Gm+HrhJYrf35snAfmTSKRFr6aD4v yzj3LwqquyZM5UNvir1xdaqQOGY7YK2HOTdU12yl7q1tge1c+RZwmkr6fy2OjbvNwh36 m6SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266210; x=1691858210; 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=UC0EfLSfvDySXTGTBrRhuMUDP1KlEIele7mERiQCV6NVZXyiHWh7qSfkjLzVcalo0o GNDMVzNUc9uQBPZQNjYlRZL+Xo3hqPQaQOkBTJQggL+kr+s3X7HWOc/uHeYqWWBUvryZ Cj4Z5Lrsrpkge7IRE7aYt2r5ErPP0/PlnmD4N//DU4JFWWfeqEsuYkmqJebqStaQXfrH h7tctFcSzI4HB8fEyLGUNLK8oSNKh5qZgk4VlZKFI8oFREJLXMZYJegF/TWusvFdR5me hmQtwLMnrjBpEFzB1+Mp/X+ac+CIsyz6JluCjfYToB+mD4Pg5um/dFE+oT+I0I1mfmIF Kg4A== X-Gm-Message-State: ABy/qLbl9WEfJelEXW10/h7mO0szZyaPxKgT32WoVH/NH1Yj7BnEkfXZ 6VOlTBYejMw9YaIhZc39cls= X-Received: by 2002:a92:d1c2:0:b0:346:c04e:9a86 with SMTP id u2-20020a92d1c2000000b00346c04e9a86mr1959108ilg.0.1689266210662; Thu, 13 Jul 2023 09:36:50 -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 s7-20020a92d907000000b00345950d7e94sm2147571iln.20.2023.07.13.09.36.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:50 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, daniel.vetter@ffwll.ch, 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: jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, gregkh@linuxfoundation.org, Jim Cromie Subject: [PATCH v4 05/21] dyndbg: ddebug_apply_class_bitmap - add module arg, select on it Date: Thu, 13 Jul 2023 10:36:10 -0600 Message-ID: <20230713163626.31338-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713163626.31338-1-jim.cromie@gmail.com> References: <20230713163626.31338-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: 1771325810246104414 X-GMAIL-MSGID: 1771325810246104414 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: