From patchwork Thu Oct 12 17:21:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 152067 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1388276vqb; Thu, 12 Oct 2023 10:22:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4MEhIQsXxMK7brY5xFlpH8wRKtImJTQuAeghO/uUtrGAA1Bb6pALQtEQt/WkcAcaS9qH5 X-Received: by 2002:a05:6358:f17:b0:14d:8792:1cec with SMTP id b23-20020a0563580f1700b0014d87921cecmr16660428rwj.1.1697131351840; Thu, 12 Oct 2023 10:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131351; cv=none; d=google.com; s=arc-20160816; b=Uy7ZQOt9CvyjXb1iVHEMoVoLtgVTOgFLCLYBU/zFp0bdMpTcejZmVUy110vOD6fVM2 nuXH4aZ7pbJu5CPb5ki15Scd8F8LL/EZ7LkOxMH9PWVoVFUEYvNHwXFBOqUT9/AiGgbm 2uTr9nqaR+aaRss6ewojB7wGlB7tfT5B/cCmVHEXYYtkuFUYMYe2RP8MGxDaR90CLZqZ VmFG0uz7J1ZNld8mDO75Zj99FyMfzwxneawjZYgIy274c038R/MauIY8bbJ6oDHZ/pUG hPsST1+SbYNIriw80/4T0uTJ2P3EfImOWj+u62nPgE4RtIO0HuxtJbqoYk66yv2NSmbx j6kQ== 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=X+YoaYP9Btr77N0brD8AfqI/lJY3W3ao1Z4fzgsncX4=; fh=iMt9mR7tPHpILUTScbdc/cv5Bu8Y4MLmy8xlWClXVSw=; b=bVZYQHPx2049iz5Q3X3QJrknQ/M3VTLng/yGAX5tZHrWF4lT/kD7vA1iPqczCofJ3t ypAGItAH9JuKtYN3/TjPxKbcp2bbgV8MCML2gWiRhh+rLDFIO2omaYxQKM5jElmv4MYS JUIRLTRt1moZvdeVesh8sOliM8r6Na+0FcoEWTD7iWf+OhoPiUFvbhNcJ7yyEmYnrXZO 0bBfLRuURPZ6GUoigNuwFXZMJBooeWnFmFah7vENP0D4/JZOdDveVArytT0ApxkuUq1o eLq35OEhdNQNyePYxDD0HlYisY0+sVTVnQPsRtlBxf54O9IaxW83r1/soMiwpWCQb5VD Mwmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VnAwK5J0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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. [23.128.96.37]) by mx.google.com with ESMTPS id cl3-20020a056a0032c300b0068e3fe64a03si14736640pfb.308.2023.10.12.10.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:22:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VnAwK5J0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 23D7F82663DB; Thu, 12 Oct 2023 10:22:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441819AbjJLRWZ (ORCPT + 19 others); Thu, 12 Oct 2023 13:22:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379633AbjJLRWH (ORCPT ); Thu, 12 Oct 2023 13:22:07 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41B13101; Thu, 12 Oct 2023 10:21:54 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-35749556444so6043785ab.1; Thu, 12 Oct 2023 10:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697131313; x=1697736113; 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=X+YoaYP9Btr77N0brD8AfqI/lJY3W3ao1Z4fzgsncX4=; b=VnAwK5J0rveKf+Jbc8zkR6GtO/XYcOQxvWxUssOPiFxtSmV40zIKFNmTJ0gXQohaPS eIQCW7ZRb2MPO7qTl7/2Y0EV7zOtY61VdjMlhIEE4hriaAmwjqMJB6iGbGHqQGlArsmI nTiKzPcEsYaT047V0DdQ/L50RxC50NBUpeYIk4s+MMi8c5NAGvRfUtmKKpj2gEfYPTYa 3tC++Yz8Ly0OPuCjyBcmp4OocfqOvS1FEQ+e0BtcB4H3FNprOKUc9gMBmtix6yWUCLgs pMV5a5UJj/PHe0qIaUyZ4dcnntKYrghFKM/YVoSHsbYKjWroauopLj7EK+ANmUQgUV5q qQCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131313; x=1697736113; 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=X+YoaYP9Btr77N0brD8AfqI/lJY3W3ao1Z4fzgsncX4=; b=GzWFspgz2Uxp6icRrc0+F0ymTHWFOTX55XdXWA1R+zqlEOvaEgyoxJUPTuaiL6MpSf Qj+SSrnjlrZ5HlGUpKcyFUJ2eHrNP7/68fMpfHY7wpHQ0ZVYVlw1W+fz0xAPFuGfDhG0 4YZB1ruODDoq+pzSwl4IlyLxsClj/ongil/2xXHYoGsIW/uC9BtH4ZcSVOh6QQ6f+Txe ep5M0TSN79seaw3MZaC0qBzsSORh4NBMm3E3pl2JekkqgoOFCwm/QcSZJvgX6a/T8HF2 rR2/2Zzd8PPcyhEkr4OLZ88kZGJBFIPSWyyz/xcX1D1qN946zCLyj9Dm+0Cx/nmGzdHe aoLA== X-Gm-Message-State: AOJu0YxEcgUvKEh5xNfXDUCjwYe1jW+/jKPsrgj79/LMoM26NWKRNoA/ bKofB6HftJAWkbfA6KgcZpMtbIuO6pbj4w== X-Received: by 2002:a05:6e02:20ed:b0:351:3546:dabe with SMTP id q13-20020a056e0220ed00b003513546dabemr20726974ilv.0.1697131313252; Thu, 12 Oct 2023 10:21:53 -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 r25-20020a028819000000b0043cef0711c1sm3992211jai.158.2023.10.12.10.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:21:52 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: daniel.vetter@ffwll.ch, jani.nikula@intel.com, ville.syrjala@linux.intel.com, seanpaul@chromium.org, robdclark@gmail.com, groeck@google.com, yanivt@google.com, bleung@google.com, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7 06/25] dyndbg: split param_set_dyndbg_classes to module/wrapper fns Date: Thu, 12 Oct 2023 11:21:17 -0600 Message-ID: <20231012172137.3286566-7-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012172137.3286566-1-jim.cromie@gmail.com> References: <20231012172137.3286566-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]); Thu, 12 Oct 2023 10:22:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779571204586519667 X-GMAIL-MSGID: 1779571204586519667 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 ba41fdeaaf98..b67c9b137447 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); /**