From patchwork Wed Nov 1 00:26:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 13442439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 407B9C05020 for ; Wed, 1 Nov 2023 00:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H4ynkGT7GE2YtlGo3qeP9jp4WxZxj/iz6E9yFp7pyGE=; b=YSx41HI8t1ZrdU LpNS9E9d9eZR2/zkP7CU7d3SwhSHchz9zxRzV9dwSGwQV5uuibmpLSolLbTDdjT0ov789pL8YKzXj 6r553G7RJLIpDyns3i2Q0pRHuTQBJEptDbJQflzUBkXx4UlRNnLLe0RXF/tXOpQk90sgBJAqmMcM/ 4hGVu8TtP424qQRZ1y3TA1rc3Aa9VSe7qvD8BWBZI9xRPNBHGO8dzdWt0mT90dhypfvXsNdPsyeNh QCXJqDCCUF2/Nsy2fhczF4DW0PU2QP1XlhEpBE49f+hMURRHZxcY023Q37GhAeBTTxi1px4OzHmTT ddrsnfow4AsJBnGHzqzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4a-006Oze-2s; Wed, 01 Nov 2023 00:27:04 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxz4E-006OZ2-0T for linux-arm-kernel@lists.infradead.org; Wed, 01 Nov 2023 00:26:45 +0000 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-3580b94ac2eso22573205ab.0 for ; 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=lists.infradead.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=kC8aLp/fG5Vmzz0o+jWhu7QxwwxwZjWBeihgAbF+N7iZOfVz37qG0SHrXu/JGlzh6n QkOpZx1kLmTjpX3Ut06169ZvVlZSU+WR6+oflLo8n8mhAPTvkLYgs4t2wp40ROggVFNw iNX4youXFZBkgcAJOzJwVhl96kOLlx4E/0MxidpoN7TYhqYDnXQ3AhhxNca0wiGEbvF4 3uulirDN4kzrJbojLUOyIenOWKoI9BiZhQvl6xha9ouLolCdMM70R4pBwE18XqCCUQ7+ YZKEV8z2TYtdJbG+oM1xY9QBkO0wcnV8V7fBk2Rl1z6W5kMg/13x6PzsePmBOLYj934h 3NTQ== 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=HcDf1d/zkI4pNM6Zj6Hhf1s1n3MinRzaSL/yJ/9Zgs8gxYRViBlgAMc8NxRbZPvlis 9bteHC16K4kaxF5nY0Ydn/XeeyvL4LUzAJvB201mnE3IZywnU5MM1H0cRLzsL7YNWfmO +WuSsXqpgOrEWk/xyw8aO3g6y0rljmxDoAAQummH0zPrqymZUJggwMZmZD1WQLZXZlEN ss5tyjL7F42THNxGT3QFpS8Zsgc29icGZbuTjxwpKXGFuXCZPX6ShSb3xmC3ybVHRzKN OBk+fozIj5Vgeabal7IuvZOlhdVOt4o4dMBd1JpFnYyVYVSEKCU0nrLZswZeeZ0C4a0X nOWw== X-Gm-Message-State: AOJu0YxK5qoTbeMKvPG4wB1Q22F1m4vPKhV7H7GklRvYf3BZ0jc72orw WkTJO27oSrCZ4e1vYdMFnBs= X-Google-Smtp-Source: AGHT+IEnq6yilvS523bKlSj7hFpIHWcTVw7hccWlP46IsJgWdtPP6IzKyLzgXeN5+1LH7kZInFgtRw== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_172642_219739_A2366564 X-CRM114-Status: GOOD ( 15.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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.