Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3028607lqo; Tue, 21 May 2024 05:01:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUn84cfrAZ3dNNYNdNuDBMl7mcIsr+MOfCcHV6DyVCbLs15Buz/wr7n12GXCMeduPRSvFx+Eft8pDvQwYMXZ6mPKFMipk/nOZcoJiM/vw== X-Google-Smtp-Source: AGHT+IE9Mc0W77ZU+KszpqubqSPUyhEvnuuf4n5OzPnqiLdPS8iSeI5Mvtcym3cti4vL7G5+RGMX X-Received: by 2002:a17:90b:3e81:b0:2bd:92d9:e44b with SMTP id 98e67ed59e1d1-2bd92d9e4a3mr2279622a91.8.1716292900547; Tue, 21 May 2024 05:01:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716292900; cv=pass; d=google.com; s=arc-20160816; b=Os664M7b9BXNi0BJ2R7B1SswNBa1CnMMl3icbT7dLKL0YGERc6BZmhWRJue6G2xIdD qO61nwfPxpZFwQ269PgBX0XelEdXHzAt+RErMWlKxEfG4sqa8+WeCYCjCUO9EVu6AGBF TGhYHbY3hQpbq4mCXWDn6reXq8Agl7pCCcL55snraO1e2yYKWuQjqAlW+p5ejILmFIE2 +DGHQEmC1agVBWXVtV7xZYpNVhk576KDbaesz9rOx2jgrmL7qZVP6IDOb4Y3JYhS3qmj ebIlp/QuSoEOofbAmbQ1cruMUR0O4vyNQ4+eECCwApIOoZLdcHc89b5tahrCzCs0WZ5m RUlA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Md6P1tR1u5fc1z/ZbkZnU+iRNw88rkv2FOhweb3h/ZA=; fh=CDN20b7aSlI/zOrgQgkI11CfBhMCDwEdHMjvhcFfqGY=; b=fyoVP3XVNh7Ol1tHoZPMldt0N/1BtJyWiHD8A06WXu+/qlerWwPqPjmGFpgojvSQM+ OA7nFMv29Xch3gzp2AgAvZf2hKjC4Nhd9dvAJ0lJyBg+CDTnmwg5W3dLOYs0B4s73/21 8OXEMAFnxV0+thevfvBnesMSN/x/zWgersBeIldRpZRV2hynAFSqXk6MrIi6/vynGk6l YATMnLR7ICNlw9CKDW8vPEtu9QnNGHD+vzjLav67F1qgUjoYYnngL526dg/cSLifcJxp nx5BbBzOrEtyy8k18Y9LNyfVo+AJEA2YlJOh9D/2G67hRD2fUIBjJ9iNJECzFYKh5Z25 7Reg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WqDMMX7J; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-184918-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184918-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b97cb35330si4025782a91.122.2024.05.21.05.01.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 05:01:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184918-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WqDMMX7J; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-184918-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184918-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B9D66B2051A for ; Tue, 21 May 2024 11:58:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B259762E0; Tue, 21 May 2024 11:57:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WqDMMX7J" Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E458763E2 for ; Tue, 21 May 2024 11:57:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716292674; cv=none; b=YSLssouUxXX7xgLozen/87zg9MRznZ2Yj5XhpGMWaHFwBmU0m5i6jVUPM4+At8krFix/p1g00vSCQFn9iCeF7MyaRSFy/wpHTkspaNu/HRfLW6j+G78cvQrB7lClzEdLV86PGPmBjA8yLs40PJM/3j/iq7MZS6kXTltCs7AVZYM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716292674; c=relaxed/simple; bh=q9fIW/kokRy/aqoKrTmpSlBLPOxD6/t6kfcGLcryXr8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=I7iIriq04xPvIbJlfLQAkRCSqIhVeBOhEIh3LMo0xyMSAoRIlauu+7m2cAWmFZJRV6xBY/K78fnS8hUl4+5alQntORvDMaqiuPK+Gj2quRyJHmeYiE3fxKemqKwwIGbununZH0K5O5oT4OvLyDRKbFXtTNRBI9D/RVydBengYzQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=WqDMMX7J; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-5206a5854adso4341553e87.0 for ; Tue, 21 May 2024 04:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1716292670; x=1716897470; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Md6P1tR1u5fc1z/ZbkZnU+iRNw88rkv2FOhweb3h/ZA=; b=WqDMMX7JyoXxig871PgfKzwjhu8LeEIg8tBUq5kK9MuHzstczsirhuahm2NgWH+nR5 WtS73pdIN0796DFRjuLY6KVQnmoVeVEEbjzxw6kDXa7Nsut+pDcGRI3LwNQhQN9h9A/8 Tn3hBPjsEHIouWgCmgt/1Pdgf3GmQuijdYs1I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716292670; x=1716897470; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Md6P1tR1u5fc1z/ZbkZnU+iRNw88rkv2FOhweb3h/ZA=; b=m2gx59pdHR1OFWMRr/vMn+zE/779hjQfrzoelvOHePryWitRHZKWcppKJkLq2fBh6W /VXwNnoaHEU8Hlju8V/fLxtIiFlkPdLjamDUro2cR25yGWD2HHxn8ssPzIwwom0QB2jx i9cAYu/BvHIFTVI860X4vhV8EylhDCfpeYaMBFi6ER685xJZqpo3B+0+9aP52Ok1uqx5 eljPoPkib2EkjUrYRLZa0HK5f2eD2wO3wVFaTmOQMVh/HgBiYuOe6QIhLHmFk7qB1MS3 fcsjN/NbVF+oAr9Jicn2bRhgGGESEebojA1kkQGb+WL+2WPmHVaZqr7M8HnJF2MNQFa6 ZXCA== X-Forwarded-Encrypted: i=1; AJvYcCV1O8sHXJm1lMi1l9S4M9X7nCZ2PiiPIIh/HvDwmYVAlpvw/VYg3b9koyLvn2/iZ7dtHXVNwGQlrzo3CS8nZHdkmb6lJznG2LjHa5Ya X-Gm-Message-State: AOJu0Yy51BjGiw0zhxGXxlnFDBaJ4fqEbWpKS4fSWpxKNmkl/aOPzwbD aDeRzcVzWi7QxIdSxz8Lr5Cgn0Yox2jdBUEu2fdOTmSd8DJsMNaKKO/UqVegcptb3b01c9xUpvO Jivg5D3nYIECZQ4V5PZrvtPc5eNFbmUeAFqM= X-Received: by 2002:a19:641c:0:b0:517:87ba:aff3 with SMTP id 2adb3069b0e04-523573cfdd1mr14170012e87.43.1716292670481; Tue, 21 May 2024 04:57:50 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240516174357.26755-1-jim.cromie@gmail.com> <20240516174357.26755-20-jim.cromie@gmail.com> In-Reply-To: <20240516174357.26755-20-jim.cromie@gmail.com> From: =?UTF-8?Q?=C5=81ukasz_Bartosik?= Date: Tue, 21 May 2024 13:57:38 +0200 Message-ID: Subject: Re: [PATCH v8-RESEND 19/33] dyndbg-doc: add classmap info to howto To: Jim Cromie Cc: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 16, 2024 at 7:45=E2=80=AFPM Jim Cromie w= rote: > > Describe the 3 API macros providing dynamic_debug's classmaps > > DYNDBG_CLASSMAP_DEFINE - create, exports a module's classmap create, exports a module's classmap - > creates and exports a module's clas= smap > DYNDBG_CLASSMAP_USE - refer to exported map DYNDBG_CLASSMAP_USE - refers to exported map > DYNDBG_CLASSMAP_PARAM - bind control param to the classmap bind -> binds > DYNDBG_CLASSMAP_PARAM_REF + use module's storage - __drm_debug > + use module's storage - __drm_debug -> - uses module's storage (for example __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/Document= ation/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 ``^[-+=3D][fslmpt_]+$`` matches a flags specification. > To clear all flags at once, use ``=3D_`` or ``-fslmpt``. > > - > Debug messages during Boot Process > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > @@ -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 > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +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. Typo referencable -> are referenceable > + > + # 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 > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D > + > +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.0 >