From patchwork Thu Jul 13 16:36:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 120049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1964635vqm; Thu, 13 Jul 2023 10:08:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlE1z8CRScSH07+pTBbeWUyW84QnjInRzb5D/Zs/NDquYUtV0+EGyxhRDCrcJdUwO1aUX1aU X-Received: by 2002:a05:6402:b1c:b0:51c:c03c:d72f with SMTP id bm28-20020a0564020b1c00b0051cc03cd72fmr2229068edb.20.1689268082503; Thu, 13 Jul 2023 10:08:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689268082; cv=none; d=google.com; s=arc-20160816; b=nquLoQhso8q2PB+GhomS402SGe/xljZrtfyLWMyjkhz/jHY24uYWiSwAdnHU27lFMI +mU9izFNVC/EgWCDHvb40ieAmOb/6L/j8Rw++ztj/ZXTuvO7xJFuvDSTLXAUCS29hLCE 2iJTW2V40fP43TdqG3pmZsDmXSjFvKUBXQyy9Eiwq/uhD4DyFsNYdaWXlznA0gFS0n65 3rda2HjCLIxnPoT6pMplfJnet0MEKODeafYYJeau6MkCp9sSTtq0PMk+xpTRhi2vm0Z9 L1oGejHzaYhXQ6mcFox6ToK7SHD+1iGzmOcw+cHRL6dnqzE2jqKzufIfhnbjsNdTri/9 UcaQ== 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=1Ad3KO712dvatMNJgTE1b1pUBswB4LDwoWCb3mLq7M4=; fh=/CYHsJHkAPOgOy4IDXYU5w+VojxE3561vOD18ijZg9Q=; b=s6S+VT07gvaFmWmab6QBEEh9+whBLU2xeRhDERXiQmFmJZ2/uzknpnppbaS3ZJ9jBT asydv3gWszN0DW+iILAA7CrPivIkFDcAJw9Txei7bSBBC1OyAjoTPDnRLo5VCPfWnXCI Ubqj0eT0VOX54wrCEX/V3cCyw6ho8tUijZ2xmrW47wKFLa6F7cjsEqY2lm4IONRYoFl7 z27HjvaHbpieInP5gwFQLzvYPnA2Cn30pMJvdtj8Op4ZLacnz7rMQqSDGLTI/pzqcEbB UVJGUqcx6ZYskOCFVBEUJIeuhQqGkWB6OybkEVqP1kopgD47sTnjPEYVP62YFUkkgEiF xf3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=IQppnCc2; 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 j16-20020aa7c0d0000000b0051ddbb1e3besi7249307edp.422.2023.07.13.10.07.33; Thu, 13 Jul 2023 10:08:02 -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=IQppnCc2; 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 S234527AbjGMQhm (ORCPT + 99 others); Thu, 13 Jul 2023 12:37:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233378AbjGMQhQ (ORCPT ); Thu, 13 Jul 2023 12:37:16 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4EA435A9 for ; Thu, 13 Jul 2023 09:36:53 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-34642952736so3817005ab.3 for ; Thu, 13 Jul 2023 09:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689266211; x=1691858211; 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=1Ad3KO712dvatMNJgTE1b1pUBswB4LDwoWCb3mLq7M4=; b=IQppnCc2bwhNhpaNx3A2BOCtrbsFFAIpVgycUeA6zfnK0gMfAv56EGJDl5oKzWYbhT RTRtt1e+jLzqrTBDJNbNfPxNVsxQvS5mow14GA4KwquwEj9OR9PoR6nzGgrU/81gWcC3 x4Yr9BtEKACgJQTamjxKieDvlPv8zHkUD1VTB0+x8CeJBJiiJ6EEasJhUsa6JLVMET6L wYOrDIuhRsKkLd5GyynPrgHvM7aiBp6FMmw/LPjpCiurfFcmItdKcgTAahtUKNfAZBLU ukImJRZfQNOmymJyEE15Vztic1U9dPXCNbhySxtfXyKpYssHo+GpMpbBXlNItaY9uxyr Q2Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266211; x=1691858211; 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=1Ad3KO712dvatMNJgTE1b1pUBswB4LDwoWCb3mLq7M4=; b=h2vo0rCsuHST9IogibMWHA+PjO8XPWhTnAA3cn6rU7I3/URqSdGWJsmCSm28yrrKXF P4CUM4Z/DgAGFxgFYpvw5AitoFzYH7RW/4VWnBJk33bhMdi91c1pUmA9/vYBmQCEM8JS gBz081w6v4Ko0Cl+VZ+q/joT0AjUvAKu3El/kbHkki3JgbjwjdR/dsh89KIkrAH2SsDb V2SyG/WjH71JA3sB8LpJ2HQ0xLSN7swUd0xn1DbnLdNUqQx3WxORMA1GlaozNoEmD8Qd SHWo1f9VpC+JUNc/pOQdd3d+bgRbFEgj84AdNbSipy0gYNhUenaTQi7nywtJbjnz5vS3 IDTw== X-Gm-Message-State: ABy/qLb3Kdv0b0S6TPT1jxz1z8ZsSKtP0blWn4FWZ8aavu7sxoYyFTtF hAOXjNNFK+2J3Hr4WfmtcwN9IjBPkyevEA== X-Received: by 2002:a92:6b09:0:b0:347:714c:aeb4 with SMTP id g9-20020a926b09000000b00347714caeb4mr1689488ilc.11.1689266211673; Thu, 13 Jul 2023 09:36:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:36:51 -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 06/21] dyndbg: split param_set_dyndbg_classes to module/wrapper fns Date: Thu, 13 Jul 2023 10:36:11 -0600 Message-ID: <20230713163626.31338-7-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: 1771325968843445101 X-GMAIL-MSGID: 1771325968843445101 rename param_set_dyndbg_classes: add _module_ name & arg, old name is wrapper to new. New arg allows caller to specify that only one module is affected by a prdbgs update. Outer fn preserves kernel_param interface, passing NULL to inner fn. This selectivity will be used later to narrow the scope of changes made. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index d875c4fa5335..6070d37c24ac 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -707,18 +707,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 *modnm) { const struct ddebug_class_param *dcp = kp->arg; const struct ddebug_class_map *map = dcp->map; @@ -755,8 +746,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, NULL); + v2pr_info("bits:0x%lx > %s.%s\n", inrep, modnm ?: "*", KP_NAME(kp)); + totct += ddebug_apply_class_bitmap(dcp, &inrep, dcp->bits, modnm); *dcp->bits = inrep; break; case DD_CLASS_TYPE_LEVEL_NUM: @@ -769,7 +760,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, NULL); + totct += ddebug_apply_class_bitmap(dcp, &new_bits, &old_bits, modnm); *dcp->lvl = inrep; break; default: @@ -778,6 +769,21 @@ 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 - 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) +{ + return param_set_dyndbg_module_classes(instr, kp, NULL); +} EXPORT_SYMBOL(param_set_dyndbg_classes); /**