Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1543225rwp; Thu, 13 Jul 2023 12:28:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlEUDBbpCy04YCiSaSlq/qYD6Hh+u3letP8AP/kenmgxB3GjOJ5BA9bBqN2xQ7qCNrkgyeAW X-Received: by 2002:a05:6358:9184:b0:134:c37f:4b64 with SMTP id j4-20020a056358918400b00134c37f4b64mr3431813rwa.30.1689276510123; Thu, 13 Jul 2023 12:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689276510; cv=none; d=google.com; s=arc-20160816; b=YONBBWOGIA7yy4lZlWwIDEcMA/vsWfm0e6gSGo/OcbmeZKSiZUNRujiy9ZG+cUrZ3M y6lMreC9g1llhEXCBOOTJzsUNAJhHfzFFZTc5yBL7zXO1LhSw9EM/03aowVq5P/+Msi1 vCc8kZJhfaAbZXSRBtZUrGn3WPdAaNsIPg4IvT0pyKXWRZe+re4C30kmo9dgLBw4l4PR prvmzQOQCTMVj4qzL3o8o+GgzB0ZRGMwyS7mSKEKYN6u2tKUb2iBvzVvYaoaeSGJEn8D 3NQzgLRT0PNGL98dOr16+86LMZ5wvZTg0RiqG//3E7IIQhdGIzSF6j7mlGZA+tYA3f4i h5jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=SlWSwhHe+t/+5CD+8qzJLYQdlCsQhw+Uh2KGkPXB6kM=; fh=LWBT+iVL2vPklsHLs1sGaE3MsmYrDhWeTawGjHZBPtw=; b=NdEqHw4+dp3S2ju6ioiSEMYmz5wc4QDlJfoaXrA3dmwF9x7lgPyQp0/FudWSnSB1dd uNpWwsOnuROWSpS+46DGEXqngOg8rZRb0LFTpTc/WIywrfLSKoa5IbL31PP5XT+btvy/ Nd3dkE0/TBe+faWUWE92sWLE9HntJSGtPG/GBlQEA1TkiFpFJX1nk1nVakUMWvAG78oP FncnFKibiTfIz3VlTL1SnmXeuOScDIJwzF81ozxxOHCmFGb8o1nf/zfMJg0mIvS0ETsX sy51XGtUZZuqUJRuKCJJjHA3xkTeb/mVdtiRRz2bX7knOk+smovNh74thx6UDUk6O0bZ jr7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=vg3XLPJF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w67-20020a636246000000b0053fb7d14255si5670153pgb.0.2023.07.13.12.28.13; Thu, 13 Jul 2023 12:28:30 -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=@infradead.org header.s=bombadil.20210309 header.b=vg3XLPJF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232854AbjGMTNy (ORCPT + 99 others); Thu, 13 Jul 2023 15:13:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbjGMTNx (ORCPT ); Thu, 13 Jul 2023 15:13:53 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 216EB2D6B for ; Thu, 13 Jul 2023 12:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=SlWSwhHe+t/+5CD+8qzJLYQdlCsQhw+Uh2KGkPXB6kM=; b=vg3XLPJFrNw3vBwRCjiW5YxOq2 J7z60gNJOjveg32CLIuJ85nynYH5q14lwRsCJUluPBYOWCNDwUUPmAzN1bbzgN4io1hrdAbNn+bet LvHAEgJAI3o+TolSH/sGJ6361Hl5rgpW0e7WaGYCAX2Jmm6BKgnZf+Xvchn5LU/nzwqptkUtfZPrg RIUS2TMNeUwzQXngfHeIGUDygAngNJiGYqLfhn/ym9A0WNBTTT/Qqyl22ZXC/vOOrpOxsQ0i3H5Ne RShtljbjCUdcWFxd8DVqFRYbU1479QbYMDVCzwsl/nd+vfJEiyINMToaackbPhBPrWaqhPUhfEKOJ iAesR+Yw==; Received: from [2601:1c2:980:9ec0::2764] by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qK1l4-004DOL-2N; Thu, 13 Jul 2023 19:13:46 +0000 Message-ID: <76995421-a529-ac25-c306-2e4ac2844602@infradead.org> Date: Thu, 13 Jul 2023 12:13:45 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v4 21/21] dyndbg-doc: add classmap info to howto Content-Language: en-US To: Jim Cromie , 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 References: <20230713163626.31338-1-jim.cromie@gmail.com> <20230713163626.31338-22-jim.cromie@gmail.com> From: Randy Dunlap In-Reply-To: <20230713163626.31338-22-jim.cromie@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,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 On 7/13/23 09:36, Jim Cromie wrote: > Add some basic info on classmap usage and api > > Signed-off-by: Jim Cromie > --- > .../admin-guide/dynamic-debug-howto.rst | 64 ++++++++++++++++++- > 1 file changed, 63 insertions(+), 1 deletion(-) > > diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst > index 8dc668cc1216..878750ce8c1d 100644 > --- a/Documentation/admin-guide/dynamic-debug-howto.rst > +++ b/Documentation/admin-guide/dynamic-debug-howto.rst > @@ -374,3 +373,66 @@ just a shortcut for ``print_hex_dump(KERN_DEBUG)``. > For ``print_hex_dump_debug()``/``print_hex_dump_bytes()``, format string is > its ``prefix_str`` argument, if it is constant string; or ``hexdump`` > in case ``prefix_str`` is built dynamically. > + > +Dynamic Debug classmaps > +======================= > + > +Dyndbg generally selects *prdbg* callsites using structural info: > +module, file, function, line. Using classmaps, user modules can > +organize/select pr_debug()s as they like. > + > +- classes coordinates/spans multiple modules > +- complements the mod,file,func attrs > +- keeps pr_debug's 0-off-cost JUMP_LABEL goodness > +- isolates from other class'd and un-class'd pr_debugs() > + (one doesnt mix 2 clients bank accounts) doesn't > + > + # IOW this doesn't change DRM.debug settings > + #> echo -p > /proc/dynamic_debug/control > + > + # change the classes by naming them explicitly (no wildcard here) > + #> echo class DRM_UT_CORE +p > /proc/dynamic_debug/control > + > +To support DRM.debug (/sys/module/drm/parameters/debug), dyndbg > +provides DYNDBG_CLASSMAP_PARAM*. It maps the categories/classes: > +DRM_UT_CORE.. to bits 0..N, allowing to set all classes at once. > + > +Dynamic Debug Classmap API > +========================== > + > +DYNDBG_CLASSMAP_DEFINE - modules create CLASSMAPs, naming the classes > +and type, and mapping the class-names to consecutive _class_ids. By > +doing so, they tell dyndbg that they are using those class_ids, and > +authorize dyndbg to manipulate the callsites by their class-names. > + > +Its expected that client modules will follow the DRM.debug model: > +1. define their debug-classes using an enum type, where the enum > +symbol and its integer value define both the classnames and class-ids. > +2. use or macro-wrap __pr_debug_cls(ENUM_VAL, "hello world\n") > + > +There are 2 types of classmaps: > + > + DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, ala DRM.debug a la or just like > + DD_CLASS_TYPE_LEVEL_NUM: classes are relative (Verbose3 > Verbose2) > + > +Both these classmap-types use the class-names/ENUM_VALs to validate > +commands into >control. > + > +DYNDBG_CLASSMAP_PARAM - refs a DEFINEd classmap, exposing the set of Is this: refers to a ? > +defined classes to manipulation as a group. This interface enforces > +the relatedness of classes of DD_CLASS_TYPE_LEVEL_NUM typed classmaps; > +all classes are independent in the >control parser itself. > + > +DYNDBG_CLASSMAP_USE - drm drivers use the CLASSMAP that drm DEFINEs. > +This shares the classmap defn, and authorizes coordinated changes definition, > +amongst the CLASSMAP DEFINEr and multiple USErs. > + > +Modules or module-groups (drm & drivers) can define multiple > +classmaps, as long as they share the limited 0..62 per-module-group > +_class_id range, without overlap. > + > +``#define DEBUG`` will enable all pr_debugs in scope, including any > +class'd ones (__pr_debug_cls(id,fmt..)). This won't be reflected in > +the PARAM readback value, but the pr_debug callsites can be toggled > +into agreement with the param. > + thanks. -- ~Randy