From patchwork Mon Sep 11 23:08:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 138421 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp657565vqx; Tue, 12 Sep 2023 13:18:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHR36aOaXRp8eR2xs6Q/d0gfM6wosSArFHL72SotgPNTC2PFzgm75rcuhR0x7hY01Sb9YsZ X-Received: by 2002:a17:902:c38c:b0:1c3:1c74:5d0a with SMTP id g12-20020a170902c38c00b001c31c745d0amr851329plg.34.1694549909317; Tue, 12 Sep 2023 13:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694549909; cv=none; d=google.com; s=arc-20160816; b=DtHJsdossQN2X4+42iyvK7QgiCQJCCAH7rWbH1gQZFCOSeT04Ayaetfv5kTBR/UScT oOptFsjDUM5BAuTGYCWhOhNcDde6cotL7JT3LC/BVNEnGb7q7A/484BeSFOeEZ7IFAUM 3dA3W4WxYlOAFkNbbRh/b7ydtL8GQOdutmaHkLR0zUxKsrua7ZAFZsAuK6QyzVV0ZrJz Hxo6ZnW3f/WGXgYjLjrY2VkUdg8/Jajntzk0LDDfj+yOfEF413wxz3fOXJ95SKALcyuU nrtsBSSPtsEG9Q+klX1uV9FJKoPkWxLRu+CvfuXh31dE+5VYPF6NNzE5WjJ2I2L4JjaD oPWg== 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=6OB8bUmBTX5kKvQ4ZxUIAC9aMicC4lfL3UKEwiwbQF4=; fh=lxaKKEVRHc4DKNzSwZQ1vuzFBPp/LFY0Le4b1Q6OMeE=; b=ekybv5zGAUe4JoplGRoHMfpKfk++OExZfBfnHOkuJBDY9aiZrcP8Oo3fIkmUBE+rnN tPX/g+ASlHkXRIdct12EUaSk18gccmGkPOPIKbe3sQoyAeU7oM6hVJbb3M9e4PF3Muxc gIR/igYs23PIBQq9/GbYa0tvftb4mAl3dM4qMeNf+qEPejvGb36yO3N3ZAOpqUWY/92D ap2tk3Cns2h1nx0VVUcuiL7rLgNH+8RxC8TMYCiLjTwy3/KWKcyDOMOiSUnjo8QE9Hwk c/3AlDo4YO3y3BGS9yOst4FP32isyIS7f3wOHH6Lzo2gnFMbfp2r80Xtz9j3yuVPymqQ 6dYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=rE9iSlm2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ij8-20020a170902ab4800b001bb9d6794d3si8489881plb.72.2023.09.12.13.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 13:18:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=rE9iSlm2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 83DE9835D816; Mon, 11 Sep 2023 21:46:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241577AbjILDOw (ORCPT + 40 others); Mon, 11 Sep 2023 23:14:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241437AbjILDOj (ORCPT ); Mon, 11 Sep 2023 23:14:39 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0F77B08DB; Mon, 11 Sep 2023 16:15:42 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-573e0d471ceso3311869a12.2; Mon, 11 Sep 2023 16:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694474057; x=1695078857; darn=vger.kernel.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=6OB8bUmBTX5kKvQ4ZxUIAC9aMicC4lfL3UKEwiwbQF4=; b=rE9iSlm2Nb9YbjQHS4uwWrj59RCV69nGqI9G6NclZ5b3Ee1rUnIwUBrI923eQZvKZW zHk+qN1C9y6eN60t5Tcyf3D1xufdV0iz2HREnC3N0GLR6io+e+/CMy+OeD536TaFnJ6f rQEPgRh4/+GoPGBuChUl23TZDISi8M6grkTzXF8RQWwn2wQb3KBsv+LmRR6DfdPhLnM1 8/08mtKWW2JHO9XzdA0Nu6cdBPoH05unlkSnFFcZOTEdYfX1+iPGQyLcXm0QFOaHEZb/ NRiPI4p+p888qX/NZvWeQjbShqUaoGZ/XNWr1SabB/kSVOmx9plLrRXXo0FIn1LM3KDm Iqxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694474057; x=1695078857; 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=6OB8bUmBTX5kKvQ4ZxUIAC9aMicC4lfL3UKEwiwbQF4=; b=KrVjtIvXX9VRpNsk4Hj8KYhLVzAyVGgaitZHslJW0nELxld1MxRXc4nD7EnZ00/DDO A/mcBIeA3behx7GbseEDQwvyu4x2M55l2cCnN3joComRgBRRAO3mfRu7pUMWYL9GgsZ2 iRJ447UrQvkiMmpIxNp7LiZKc7LvKSGhwuRPmrGEi85hFsDWc71M797EdRT9DeoN0GuS HWs7k8dO0vnTHabmUSj3QntehRpoc3BRgtBBIwo5EFrSvTQC32uw8VqnGo/+9yUOSCzs LMK6VCark1TVJSuld19RMZf6TQc5uIaWtkXjM0snI621PuS5nZRu0I24VbWzd1rgHga9 IHHw== X-Gm-Message-State: AOJu0YzzF8zPviYgUFsu++LiFVWRvstfOsn+he7QwH2E8DIJA7yB3Bkf avdPodKOswIkhlbp4nVPTwja4iQYit6epQ== X-Received: by 2002:a5d:9d18:0:b0:794:eaef:f43e with SMTP id j24-20020a5d9d18000000b00794eaeff43emr13191253ioj.1.1694473728918; Mon, 11 Sep 2023 16:08:48 -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 z4-20020a029f04000000b00423240c7296sm2512607jal.69.2023.09.11.16.08.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 16:08:48 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, mcgrof@kernel.org, daniel.vetter@ffwll.ch Cc: 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, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v6 05/22] dyndbg: split param_set_dyndbg_classes to module/wrapper fns Date: Mon, 11 Sep 2023 17:08:21 -0600 Message-ID: <20230911230838.14461-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911230838.14461-1-jim.cromie@gmail.com> References: <20230911230838.14461-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_BLOCKED,SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 11 Sep 2023 21:46:57 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776864365413822784 X-GMAIL-MSGID: 1776864365413822784 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 | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 592a700adcb8..153e02c3af45 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -708,18 +708,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; @@ -756,8 +747,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: @@ -770,7 +761,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: @@ -779,6 +770,22 @@ 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); /**