Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3943933rdg; Wed, 18 Oct 2023 10:08:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1+iCuXvjc+dpvBPngq1H5hnXldLOjeXnHa6MEn4fqlLIQ2JVUTbnheACtUNv7Q6aBO412 X-Received: by 2002:a17:903:23c7:b0:1c9:e229:f5e2 with SMTP id o7-20020a17090323c700b001c9e229f5e2mr4948020plh.34.1697648929505; Wed, 18 Oct 2023 10:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697648929; cv=none; d=google.com; s=arc-20160816; b=reUW1cC/Btw732kpfEMNpa1WtgAqGeBghk2AT7x2wSt0kBV6/2BzXIyXXD2XdfWSK3 dbaGJYpa12LqCudNS6Xa2+exDjcvxJbvQShPUup4le7DrT6+qNQ5o7kf+SAtNfLsTSLy VwjUkK+t+mvjRgrZcEw+X8oCgSfFa85CT3EpE4jVpoWlF2oiHta3lPaFoFpe2c+6TNFa 86dVfXRg35ZgCXRRyW4su3M9PqDIrGIZYskH5UXF4FaQPlXIy/FOshQK4/1AkH2YmZPW tirHWhO18zn83/UxtPZonlZSLsQtV8ypSiMTMeue1w/HXIoMxNXCa0PreBooIeJu6Hl7 5RLg== 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=dD4hpA3+YqlszWEwFTO+ADczjyhU7P27niWnWgZXhCU=; b=pLuHZtVh8C7gQ4Pr9HPErI/AZU30VHpVCjgClYxFwPFMYZfNPCl+hW1BAvCTaX2hG9 /LjjxDxFi80w/Fh/8Y32eJXhS32XvzBiLbfxwnlHpOBBBP5cXp4s1Eetn1cRe62j+wsi 5DLXruPkGik1Yko4TMDp39BN/IXBJgAjeD8MJ6tzp4qzgUIRdD7L4fFf1dNzUBXRfafZ 7k+xNDqBD/ohcK4TAkCBT6wbyr5rocR0yd9JAturut/E8BN2lx+8oa0FxpyQ7/zZFKA0 USaV+K572zc+hJmkEGKoJ5n6S8KanmzqB5kCRQMl3lWHeUs2c75TmHe1zxwzELrAMswA nxdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gq345b2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id i16-20020a17090332d000b001c0c86a541asi264956plr.375.2023.10.18.10.08.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 10:08:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gq345b2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id EA7FB8031D0D; Wed, 18 Oct 2023 10:08:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235197AbjJRRHu (ORCPT + 99 others); Wed, 18 Oct 2023 13:07:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbjJRRHG (ORCPT ); Wed, 18 Oct 2023 13:07:06 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 547DF11D; Wed, 18 Oct 2023 10:06:31 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-7a6830df017so2349639f.3; Wed, 18 Oct 2023 10:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697648790; x=1698253590; 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=gq345b2jFUpjeCTNSAl30lor2QeQk2Id7/B422PCrkR1uopAPLk5Wcj9bfaaYxpYST 9LcSHu9OM6zSgkig+sk7i6hclRkXLVBe2qaq4Q7ZhgkNs6VIn6joKkQmZ3xakAE46WIs 2bmNvLYItYvQ+ftM3vXYFiht69gPShva7EpbZBDxmDSnv3PTj7tuno7bUA8qtxEIEws7 QXLcjEVLy84qAEOzt8vmWN5kTUeqfQT0tQsOs8HbZJInk8xHWu9kd6m72AnS/F2C27Jw zWHhu9aiMRA2NdjK70fWaYzwtQUfGsLz+XgucZA1MbzzgrvG/CK22PjFXMdafkcRoa0g Q/zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697648790; x=1698253590; 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=U0RNLwCrHwkimgYrUwQNGnmTIKSoSrJpbnDTY8zCsApHefNZtYwANxuYRDU2loWo3o X9B+lvnVk+ryGP/h4InOBt+pWwkGK5BcQvL0slXIYBAIoe5J5HO/tEZqZys6pCwsCxhq /wXanb9JhpO5sS4THGWpGkVSQtKBE59TJOijkYIIuR61xM566rOkcGravRAstub1xf9S pvbhtpROdpqVNsA42jBMM5Q5GmaS5QhHWVR29OlYlDg2koyV1Kl49tEqIpf98zpV7FiN KQV7O3TC0bUxLwYT0OzMIG7L9jnh50oxNiJA1DjlNBT1NVWRuqQR6Vplw5302VYbVv2G 0g4A== X-Gm-Message-State: AOJu0YwkPpA/L3JFQhntUsGXVtrjRtNRyjAszsGA1+mXXxNM4CtmkXTf 5aJE8+IlY88G1bts+D6JhMQEbWmaEwYaQA== X-Received: by 2002:a05:6602:154a:b0:79f:b2c5:e8b with SMTP id h10-20020a056602154a00b0079fb2c50e8bmr6681430iow.20.1697648790252; Wed, 18 Oct 2023 10:06:30 -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 n4-20020a5d8244000000b0079fa1a7cd36sm1228944ioo.30.2023.10.18.10.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 10:06:29 -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, rostedt@goodmis.org, linux-doc@vger.kernel.org, Jim Cromie Subject: [PATCH v7c 17/24] dyndbg-doc: add classmap info to howto Date: Wed, 18 Oct 2023 11:05:57 -0600 Message-ID: <20231018170604.569042-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018170604.569042-1-jim.cromie@gmail.com> References: <20231018170604.569042-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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Wed, 18 Oct 2023 10:08:36 -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