Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp600278rdb; Tue, 31 Oct 2023 17:27:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFkLYGOi2XWNW5bdkJhN1WCj9CG6/+NfDfYxiUFfE/7aTeYWIXyplB1WgIdsTBVxpfIdlY X-Received: by 2002:a05:6359:2c88:b0:168:d3b4:2dd8 with SMTP id qw8-20020a0563592c8800b00168d3b42dd8mr11159338rwb.10.1698798467342; Tue, 31 Oct 2023 17:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698798467; cv=none; d=google.com; s=arc-20160816; b=SowDphK2E1ViGZJvu4uNNqVr5Rl1aQl+BBBMWUlc0pZpHuQSftynYCjx92XdaygXFs EmfQ6QoQbIALI093xLF+kIPL1S3vvpV+4Bts435Q+qBixFWfLv5RucTY6GAWJPktW2Ko RQOfYIp2wKaUr+3c7zjvVqZHWrFOXwaX+NSxCz+ztg9mcPYYaDdvybZZynrERAb+qjK4 8HBV0E60A545ixYBxwgXwcKjGFGYnerMFqhddkMw22RqFhDUM9HCnbfjrrBNhXkWXYPd GjJAd3v4VajZtIkUrsmMfX1fiEmZUvZ9vCc953/S/bBi+Etyz4UPKQw0FELAoysR4sv8 sfjA== 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=Xt5GYS9mXBsgXWCKjkvZOfiO8j43yK6Z0bFknFJi+ls=; fh=LGQr+SO/7OmyUHhH/RK8Es07u6g66MsKKa5McGg6VX4=; b=D6S6dxtd0snPiwPVP7LDt6I0drJr3Oyhp4o6X6xBXEGPeJOkqNqQxULYqtkw5smsVp wYFBIhv5hgU1ChfHULzbqTZ2uijrtpPkwZUNvM6hZXDJcXzPX5g0ot9As6/QWxn6QHVN 8fQzyUeAkPQoJrc/9mw9FkAGoEK9t4v0gV58yu4QIy3IeP35ShzixFxo93s6AOwT8MoH ubRF+csp7IHDXFvERJXJfwc+oUkbx8B2MDyYorEwFz0YmKhdSMoQp/20w4Mk/p4wZX8G a1LliljoNXedC4y5+WazDbtfEdxSiVE9zDgHaRu1exVKq0PIocKwrTsOG8h/J51fEL4w 0xaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FdGmgbiP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id u75-20020a63794e000000b005ad8009e304si1888837pgc.784.2023.10.31.17.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:27:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FdGmgbiP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id C9DEE802B3FF; Tue, 31 Oct 2023 17:27:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377022AbjKAA1V (ORCPT + 99 others); Tue, 31 Oct 2023 20:27:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376981AbjKAA1I (ORCPT ); Tue, 31 Oct 2023 20:27:08 -0400 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7F86130; Tue, 31 Oct 2023 17:26:42 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-3580b94ac2eso22573265ab.0; Tue, 31 Oct 2023 17:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698798401; x=1699403201; 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=Xt5GYS9mXBsgXWCKjkvZOfiO8j43yK6Z0bFknFJi+ls=; b=FdGmgbiPu1n/xVx95iUIi1mm5AkHUoLCsYLrbzP/O694jVV2TlvwUDqTVJ711Ix/68 qbqK0i+B87q0Pd+HV6d2CQ4FlL4h1aCZk0MZFo0uvVSUWRnlIqjcM2EGJldZnAMNWjf2 LLnTim1h+g1jUwqhJh9AdWuiCcuHBNsMcxJZFYOY2FefTp4dqWpSxgLm39yIm5ve7s1h 3ge62EOyB72Qqspwyle5PGBrYmyYxZgEEBbXsPREYQzlUbVGXVCCPa/pozOAItmEgpik KS/7an2THNQtk9nJpDtqfziq9RXPPzLAN8N40a7pSpfQmFpBHu05GuYSEI2wmAtHjNDt vNGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698798401; x=1699403201; 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=Xt5GYS9mXBsgXWCKjkvZOfiO8j43yK6Z0bFknFJi+ls=; b=AmpZobwCBOG84Q7FBVs2IGXI1cxlrg0jNVazy9NqesMDQQ2fsp5ipDvd7mSoPtZioF 0D6ySDbzbWPP90To66+H8mBBIcKstPGzTfjSWlE9Y0GUo8dnBJFRpW8obwrXV73mQuz0 y6GIkMfREZ4mIfVMI+6O+fgKmd3L5DvJH2uhc6EwqxpnSO86xJ2kQzVmA9GPFCxDPObl KwvIecAReWDnmVPEA/TrnszfFSDB3dag4RDUJdfHe6Ufoo5REgWs0L4Cd4VtnEc4tm2S 7hKt7OT9jIM91TP8D90L+lZgf7V9cdTS25OMAi1pQW1fhhY53Va7VupzOALv7HQAaCE+ j1Uw== X-Gm-Message-State: AOJu0YzBqRSqbwTUz/DFEnhywDTucV7v0ERL/rywNhV6SmORZylD6bMc ql/6BlPbneo4jqJN5R1fxD1FZB50QCbmTQ== X-Received: by 2002:a92:cdaf:0:b0:357:faae:ae38 with SMTP id g15-20020a92cdaf000000b00357faaeae38mr19570135ild.29.1698798401538; Tue, 31 Oct 2023 17:26:41 -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 t1-20020a92c901000000b00357cc8df1d5sm141701ilp.68.2023.10.31.17.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 17:26:41 -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: lb@semihalf.com, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, 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, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v7d 17/23] dyndbg-doc: add classmap info to howto Date: Tue, 31 Oct 2023 18:26:03 -0600 Message-ID: <20231101002609.3533731-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231101002609.3533731-1-jim.cromie@gmail.com> References: <20231101002609.3533731-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Tue, 31 Oct 2023 17:27:45 -0700 (PDT) Add some basic info on classmap usage and api cc: linux-doc@vger.kernel.org Signed-off-by: Jim Cromie --- v5- adjustments per Randy Dunlap, me v7b- checkpatch fixes --- .../admin-guide/dynamic-debug-howto.rst | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index 0b3d39c610d9..028c2cb5b4c5 100644 --- a/Documentation/admin-guide/dynamic-debug-howto.rst +++ b/Documentation/admin-guide/dynamic-debug-howto.rst @@ -225,7 +225,6 @@ the ``p`` flag has meaning, other flags are ignored. Note the regexp ``^[-+=][fslmpt_]+$`` matches a flags specification. To clear all flags at once, use ``=_`` or ``-fslmpt``. - Debug messages during Boot Process ================================== @@ -375,3 +374,62 @@ 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 allows selection/grouping of *prdbg* callsites using structural +info: module, file, function, line. Classmaps allow authors to add +their own domain-oriented groupings using class-names. Classmaps are +exported, so they referencable from other modules. + + # enable classes individually + :#> ddcmd class DRM_UT_CORE +p + :#> ddcmd class DRM_UT_KMS +p + # or more selectively + :#> ddcmd class DRM_UT_CORE module drm +p + +The "class FOO" syntax protects class'd prdbgs from generic overwrite:: + + # IOW this doesn't wipe any DRM.debug settings + :#> ddcmd -p + +To support the DRM.debug parameter, DYNDBG_CLASSMAP_PARAM* updates all +classes in a classmap, mapping param-bits 0..N onto the classes: +DRM_UT_<*> for the DRM use-case. + +Dynamic Debug Classmap API +========================== + +DYNDBG_CLASSMAP_DEFINE - modules use this to create classmaps, naming +each of the classes (stringified enum-symbols: "DRM_UT_<*>"), and +type, and mapping the class-names to consecutive _class_ids. + +By doing so, modules tell dyndbg that they are have prdbgs with those +class_ids, and they authorize dyndbg to accept "class FOO" for the +module defining that classname. + +There are 2 types of classmaps: + + DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, like DRM.debug + DD_CLASS_TYPE_LEVEL_NUM: classes are relative, ordered (V3 > V2) + +DYNDBG_CLASSMAP_PARAM - refers to a DEFINEd classmap, exposing the set +of 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 invoke this to ref the CLASSMAP that +drm DEFINEs. This shares the classmap definition, and authorizes +dyndbg to apply changes to the user module's class'd pr_debugs. It +also tells dyndbg how to initialize the user's prdbgs at modprobe, +based upon the current setting of the parent's controlling param. + +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. This won't be reflected in the PARAM readback value, +but the pr_debug callsites can be toggled into agreement with the +param. -- 2.41.0