From mboxrd@z Thu Jan 1 00:00:00 1970 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 shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 D77E1C3DA49 for ; Tue, 16 Jul 2024 19:07:51 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.97.1) (envelope-from ) id 1sTnWg-000000000Jh-2ame; Tue, 16 Jul 2024 15:07:50 -0400 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.97.1) (envelope-from ) id 1sTnOF-000000000XM-20rh for kernelnewbies@kernelnewbies.org; Tue, 16 Jul 2024 14:59:07 -0400 Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-8063553b837so3999939f.1 for ; Tue, 16 Jul 2024 11:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721156328; x=1721761128; darn=kernelnewbies.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=gkFYDr1/VaUp9nR5GtDe+QedLaRcp6UcXGPB2Rd9f4k=; b=QLo/x96SlEsxx2BR/yskByhntEznE+69JQUW1/ZHapLHce/+Cun3Wr2HTK9BVWkE7i k3674x9PNJ5RF5kajjctSBv4AHh1Q3ADxG2jQkSsFp5P0jZziIjtr2q5QnmaaQ6QROeD U2ghUm+obWcPgQZ71SMz76JyE7n+YOgmYHXby1/AmmDa3v+X5QRHBsNTkRqW8Ln7hOmL fXAxWR42chy9gfEXe5urChdKKhrLeZED3xkdI8Bkh+CkdTsRsHrsb74aMUkgZMsp/EEf 0zMXyTJvgo88vwvIZJ2xToHL7T/QlGvxutBte8EKhJTAV6Itqz74vt/CxSWTeizvssQK 2YRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721156328; x=1721761128; 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=gkFYDr1/VaUp9nR5GtDe+QedLaRcp6UcXGPB2Rd9f4k=; b=PZ07a8G7kvQ9Pm5WTw7AeARgS7z7mBzLk1/qlY8c3XYGhxikNOzXN2NhpOC28GtjMn pKksMgqX6jqw2INnaad1E7Jw+WtmTzohOC9rs9MYk/arQGeRtHljojeUAPWtuy3CuPBe aZ4PJl0m8jQkxigWYDesde6ri3jTVucYf6yd9l3sAUYbPET2Vjsx6n8xu1La1EPdN90F NiW8TGIjVlMs9b5/2HinPW83Ud//6UWzujHWDYtVbtuftyb7smn3jXwOEtH3g2EPLtTL +UAI5sQc18cugdeGaknhmMSC1IAFABhURClqTNboH47xCLwLmpcqFEPmkjkQcpuHEo3p 0A8Q== X-Forwarded-Encrypted: i=1; AJvYcCXfDRhodBOYZAXCGUWuQnw4Cu3TNFXszYgC/txCelkJkgdwyQ9UrawTh4+gZCAAQQyiJylBDfTmoxHuDUG9CGApPjgfoRC1lLlj8D5SqkFt X-Gm-Message-State: AOJu0YzpHoAezoKnac/Sbur/4+VKnq6Kfn0MFY83JE7c/uB0GfA7suBV 0xxgmRPkWqZsh6p88lj1kmGiSGjvP9QWnjTZ70bJwTSyx4EJW0jx X-Google-Smtp-Source: AGHT+IEDXU829hTYXjpQpLIXYUbB2ymJ2g2HpirLkcPY0d/I9d3Q+7hGqbny6/SZBNd7qQlx61Y+GQ== X-Received: by 2002:a05:6602:154a:b0:804:c529:8601 with SMTP id ca18e2360f4ac-816c2dfb0e5mr47126939f.3.1721156328275; Tue, 16 Jul 2024 11:58:48 -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 8926c6da1cb9f-4c210f23f1csm75301173.102.2024.07.16.11.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 11:58:47 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org, jbaron@akamai.com, gregkh@linuxfoundation.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH v9-resend 18/54] dyndbg-doc: add classmap info to howto Date: Tue, 16 Jul 2024 12:57:30 -0600 Message-ID: <20240716185806.1572048-19-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240716185806.1572048-1-jim.cromie@gmail.com> References: <20240716185806.1572048-1-jim.cromie@gmail.com> MIME-Version: 1.0 Cc: groeck@google.com, linux-doc@vger.kernel.org, Jim Cromie , yanivt@google.com, intel-gfx@lists.freedesktop.org, kernelnewbies@kernelnewbies.org, linux@rasmusvillemoes.dk, robdclark@gmail.com, dri-devel@lists.freedesktop.org, mcgrof@kernel.org, seanpaul@chromium.org, amd-gfx@lists.freedesktop.org, joe@perches.com, bleung@google.com, intel-gvt-dev@lists.freedesktop.org, ukaszb@chromium.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org Describe the 3 API macros providing dynamic_debug's classmaps DYNDBG_CLASSMAP_DEFINE - create, exports a module's classmap DYNDBG_CLASSMAP_USE - refer to exported map DYNDBG_CLASSMAP_PARAM - bind control param to the classmap DYNDBG_CLASSMAP_PARAM_REF + use module's storage - __drm_debug cc: linux-doc@vger.kernel.org Signed-off-by: Jim Cromie --- v5 adjustments per Randy Dunlap v7 checkpatch fixes v8 more --- .../admin-guide/dynamic-debug-howto.rst | 63 ++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/dynamic-debug-howto.rst b/Documentation/admin-guide/dynamic-debug-howto.rst index 6a8ce5a34382..742eb4230c6e 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,65 @@ 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 have prdbgs with those +class_ids, and they authorize dyndbg to accept "class FOO" for the +module defining the classmap, and its contained classnames. + +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. + +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 - modelled after module_param_cb, it refers to a +DEFINEd classmap, and associates it to the param's data-store. This +state is then applied to DEFINEr and USEr modules when they're modprobed. + +This interface also enforces the DD_CLASS_TYPE_LEVEL_NUM relation +amongst the contained classnames; all classes are independent in the +control parser itself. + +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 class'd pr_debug callsites can be forced off by toggling the +classmap-kparam all-on then all-off. -- 2.45.2 _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies