From patchwork Tue Aug 1 17:02:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 129412 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2855287vqg; Tue, 1 Aug 2023 11:28:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlGgKRwOwVCvHXlSR02jAEbP0LmzVYdfyLlc0o0uNJ5fK3gt/u8e5fJF9+MnzB911xIX3q/q X-Received: by 2002:a05:6871:28a:b0:1bf:304f:80cd with SMTP id i10-20020a056871028a00b001bf304f80cdmr151793oae.51.1690914507147; Tue, 01 Aug 2023 11:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690914507; cv=none; d=google.com; s=arc-20160816; b=cn1bl6J0WT2PVXp8qPrLCK3GW0wVu03YUyYamb6urT64GeqfsEEijuu0t9zuBMppI7 J8VEGiAsQqHcxsUc/UUo3GROm4Lfm0h6U679rDMjMwN3kziWlWLBDxh0DC0yY+wv7QN5 sbAPfZHzCb7Dd0q+VeJLfrnwa2wuhe/T5UIqT4nEQ3Rq1QS5yVpHlUydUkJNfQ8Pvqgz uCUQiDCsdGukapeIrgZYrRbQTnbZ86gDu0UWbkOCbH2b5gGk7qew6miiJmyNOHIAZfXd BHWTYJNEXErS7PDg6+q3PzFnb9v0jvAhy00r/pv9yE+Xco33kv3YDlzr8yfGi3IH+LXw cM0Q== 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=u5vE1TE1dJB7o4IGsVvua16vnF8dhcoUHNlJ2pbkr7c=; b=DcDVeuCBlMJt8t4RUCAtQDja3tv5Rcg9B67PyaBqRJJ2R8R+dLMJSg2lCFURU40MCV GSV4lAwXS0qGz7dxjskNbhp473LkH5Xhr8n46jg/GIqMVroPZZqvH7Yh9oeFbV4NjNLq X0/NDfe6U68lAFnU+S11OGMddqw4761zAwjQ6pX0WpLUXmBJT/eLOAw5FBqI6RPcAjbr mtpyzLf4yuoVCi9y0isMgJfg8MGVPRW/5MwTzQQQG/1WouyJKk9a+uvo56wjOqtE2loH 9UbkcQVeQApP3cipo9FY8HnQg1IH92xTYFtLoQWIRvLwr8SHzkYUiSzHGUqSNQx9eEJd MjxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=GpWYj+Tc; 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 p12-20020a17090a748c00b0024e47fae466si5525770pjk.180.2023.08.01.11.28.13; Tue, 01 Aug 2023 11:28:27 -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=GpWYj+Tc; 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 S234075AbjHARD6 (ORCPT + 99 others); Tue, 1 Aug 2023 13:03:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234043AbjHARDc (ORCPT ); Tue, 1 Aug 2023 13:03:32 -0400 Received: from mail-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4873A273B for ; Tue, 1 Aug 2023 10:03:26 -0700 (PDT) Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-56cc461f34fso1529836eaf.0 for ; Tue, 01 Aug 2023 10:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909404; x=1691514204; 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=GpWYj+TcglspG+d0ZI/uULQ3U4TF8SMQruCxH2UvBCB1TxVSQWZKVOPW/14MGYRgjL MkVO5hGv//Ou/0lnyr8bBjBbWLs6bekJLJcUfNL4XTHpwQvR2j8koRnAPcfZlvD6l/RM LkSgbjkPqTlH4DXHdb0wXpIW2/gSbgaP6MxFUk1rvz3PxT/8yZGQ26IyIXPRYjjjJzfU ZtUrDcM4mHGpyi7/yAhYbxwrfQ2fw2F8/5rnKGk+GmExAzWxVuiK81YnptQdMPW5Azqx 35dBF4HlN/KxxFvMLr1Y+M3HnHHX7Oo50OVxoWBTVx2jTrfIaYrOp8uGvQW2SMgdNPum 42rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909404; x=1691514204; 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=h5nnT/VYBi1kcX4xwIxYybr6ECAkWFedjRKnKesDDF4a/1LgN/X64jzGKceFnaj+fk RvWtFUt1kZh6YfRml3zWcvpXLOBkfyr5O2Zm8qspVjrUY9OEVZFhkKv1xKIparwGqcV1 ufwVVCQEjlNtyQiaQc0bO60gJBaXOc8JJcp09CH1HSGNTltAmpTOHbYKfVJw8eBXgl2M lc6unl0n/ivSRF9EPX+XH8+d9oP66oYP8X9T1NTq7sjF3C+0rILD6iAdBfS/j6WOWYA1 A0KFReAfL131mYzVaAkOqjJEQxeDWbRux3zC4/C5D3PPvzY8YzwwZLspqW/xJ+zVkWX+ XVfA== X-Gm-Message-State: ABy/qLb1Y+RrmiE9eP/t+nw4VAdq238/S4S/qdQ92Y9QNTZoIPuXQNZY zaWevAfVQBgkG7nPE/nZzUo= X-Received: by 2002:a05:6871:81:b0:1ba:dbad:e70 with SMTP id u1-20020a056871008100b001badbad0e70mr14860984oaa.21.1690909404257; Tue, 01 Aug 2023 10:03:24 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 10:03:23 -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 06/22] dyndbg: split param_set_dyndbg_classes to module/wrapper fns Date: Tue, 1 Aug 2023 11:02:38 -0600 Message-ID: <20230801170255.163237-7-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: 1773052370148917590 X-GMAIL-MSGID: 1773052370148917590 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); /**