Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp2348453rwn; Fri, 9 Sep 2022 12:13:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR476JbePbdKXoW5cb31X+ojC3IUBkuQKtOc0ZZA29D15+Soe8HNd5jKUhoBtBOjbCRglBE2 X-Received: by 2002:a17:90b:3811:b0:202:9e26:bc00 with SMTP id mq17-20020a17090b381100b002029e26bc00mr1171519pjb.223.1662750797424; Fri, 09 Sep 2022 12:13:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662750797; cv=none; d=google.com; s=arc-20160816; b=gsH7ZvbZOjt9rQOFr/75CXIIcJC95b4N6WnDfNl0/gvG0mdUbBx/YE9x1ubS6LgFLw DvrhsTZJEsrydxdA7V3KZkZcs0eq0UXs9O9i9F60orsN0r+VM4wyV3UqEl3wmC/bxRoN g+oQwjF9K/VPPCf3Ah9Rwi0rRs6TV4+dZVzci9SrYAn2NCwqCYK5C97UpdiiPxLr/dWK ApDQii02XufX1HVnVBJPbXRAYNfn87GJxcTq3AOG7ZLIGRlImzgkwKAkgmXdNCb5KGbi 9oYPS0P0MM0P2RMnRqa2mU88+mPaj3SFSyz6f6BgMOLh9EjD1B6p94ibyye4j19bh2O0 EfOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ahr14h6KjlyOLxYXPAD4hS0TZjmkL0paFuUiYdgkD0s=; b=QGYR4vMVB1rd8EWUfY2a3Hnz3sQptOKZnJ7LGNShQlvPLunvBRYzFhLmvitTZufdOP azpEkfFB2FpfZ5bB9qriWdZndq1sVFVevTd8fvvRQdD7J1KdTBzyZ/8H394oLcHmYc72 BCTPBCA2c5/OAtdjVKuP+rY0G/sP33D/1DHJTxZlB4t9Bf5Glc3MN7HxYObZbIQU1gXE 5xXlP2VfGnhvOzLGMVu04a4iJH2fHscGB3CPVL8Q9rMTyKTG79/WkEmeRQ8doPWhCd7p B2t5hIolpW2lq0KXiYNEAKL0628CDl7ag2hAyUevrpmrjSuGZljTUKLdc8W+6xtU4ExE 5Alg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="iX5Xydo/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k62-20020a638441000000b0042c7b672365si1341001pgd.416.2022.09.09.12.13.05; Fri, 09 Sep 2022 12:13:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="iX5Xydo/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229486AbiIITHB (ORCPT + 99 others); Fri, 9 Sep 2022 15:07:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbiIITG4 (ORCPT ); Fri, 9 Sep 2022 15:06:56 -0400 Received: from mail-vs1-xe34.google.com (mail-vs1-xe34.google.com [IPv6:2607:f8b0:4864:20::e34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23AD51365DA for ; Fri, 9 Sep 2022 12:06:54 -0700 (PDT) Received: by mail-vs1-xe34.google.com with SMTP id k2so2684525vsk.8 for ; Fri, 09 Sep 2022 12:06:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=ahr14h6KjlyOLxYXPAD4hS0TZjmkL0paFuUiYdgkD0s=; b=iX5Xydo/Hc2RaWqEtFNZ+b8pT3uTmTNTwMis8W63WAkrjmv1dj3TO26rpoSDowHb8X Ea6o5nkPc8osXBO+eDUg4r5vJw14F6/BzM1PuR0ji5eNWTZ01z+b1onwv2skwetzPieg 6KKZ8Ku0AhQ4Ma/R52Z0QfbcVAfXRkR+ALPNFw9N/2ZfZTnKBfgry+CHI4KV3t4PS6OR KO1/RWZSobotWZfzVHJm2urieXjAX6iRkGk+6zmjxZnNXEqkUOi7DfAQI3AWWdlHlbU8 jLaw+SGWegoHDigXkzejk1HDQfnhiaqkkQPQjzoxBrTZphEQtJvY0Dg+aQKK7iO5OQ9q /nFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=ahr14h6KjlyOLxYXPAD4hS0TZjmkL0paFuUiYdgkD0s=; b=I/HozR6FnaKtam5NPiWS+As9HjelTofu52Mur5EpePC2IdgwLVO4a8Ir/23J+2OdUk ybb1FAnkLCJFE32IPxDUQZDX+xIbGC1UbEkxEQrNz7k80h66Y3lcXHmJ/8Ub89AhYb3R l/An7isAzuyYGR4NB+YOvlTEUAn+trK//Dz1IzrSltyLv0M0RNDZjWe2Uz97pzqdhrV1 cuoZ37DYNpiUyz7sjPKKRPUynSoXZgaiGxDST7h035Zi2KfNqF3WT8CSHMGfxL5THRFw x86SqsAQD3SEFKP9njVJ1qn7G5u1SiKtM49Ggd4vVTRRJ/W+mQK6zgt430W4koUKO+R+ XZkw== X-Gm-Message-State: ACgBeo1FmbxNi3z0tJDIgfVKn2UAr9s19OuTOy6+huKS0YB4GUCIprS1 3y+nE7Gh2C4lGsgW1THBy7o9/ZCPUT2cFCQDBSo= X-Received: by 2002:a05:6102:538:b0:398:2ca3:bec2 with SMTP id m24-20020a056102053800b003982ca3bec2mr4860540vsa.56.1662750413144; Fri, 09 Sep 2022 12:06:53 -0700 (PDT) MIME-Version: 1.0 References: <20220904214134.408619-1-jim.cromie@gmail.com> <20220904214134.408619-24-jim.cromie@gmail.com> In-Reply-To: From: jim.cromie@gmail.com Date: Fri, 9 Sep 2022 13:06:27 -0600 Message-ID: Subject: Re: [PATCH v6 23/57] drm: POC drm on dyndbg - use in core, 2 helpers, 3 drivers. To: Jim Cromie , Jason Baron , Greg KH , dri-devel , amd-gfx mailing list , intel-gvt-dev@lists.freedesktop.org, Intel Graphics Development , LKML , Sean Paul , robdclark@gmail.com, Rasmus Villemoes , Joe Perches Cc: Daniel Vetter Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 7, 2022 at 12:13 AM Daniel Vetter wrote: > > On Sun, Sep 04, 2022 at 03:41:00PM -0600, Jim Cromie wrote: > > Use DECLARE_DYNDBG_CLASSMAP across DRM: > > > > - in .c files, since macro defines/initializes a record > > > > - in drivers, $mod_{drv,drm,param}.c > > ie where param setup is done, since a classmap is param related > > > > - in drm/drm_print.c > > since existing __drm_debug param is defined there, > > and we ifdef it, and provide an elaborated alternative. > > > > - in drm_*_helper modules: > > dp/drm_dp - 1st item in makefile target > > drivers/gpu/drm/drm_crtc_helper.c - random pick iirc. > > > > Since these modules all use identical CLASSMAP declarations (ie: names > > and .class_id's) they will all respond together to "class DRM_UT_*" > > query-commands: > > > > :#> echo class DRM_UT_KMS +p > /proc/dynamic_debug/control > > > > NOTES: > > > > This changes __drm_debug from int to ulong, so BIT() is usable on it. > > > > DRM's enum drm_debug_category values need to sync with the index of > > their respective class-names here. Then .class_id == category, and > > dyndbg's class FOO mechanisms will enable drm_dbg(DRM_UT_KMS, ...). > > > > Though DRM needs consistent categories across all modules, thats not > > generally needed; modules X and Y could define FOO differently (ie a > > different NAME => class_id mapping), changes are made according to > > each module's private class-map. > > > > No callsites are actually selected by this patch, since none are > > class'd yet. > > > > Signed-off-by: Jim Cromie > > So maybe I should just try, but what happens if a drm module doesn't have > these classbits declared? You simply have to use the raw number instead? without the classnames declared via macro, dyndbg has no names by which to validate the query. raw class numbers are not usable into >control. This is what privatizes the module's class-id space. If the macro is missing, the drm_dbg()s ( after conversion to reside atop dyndbg) will do this in `cat control` seq_printf(m, " class unknown, _id:%d", dp->class_id); > > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 +++++++++++++ > > drivers/gpu/drm/display/drm_dp_helper.c | 13 ++++++++++++ > > drivers/gpu/drm/drm_crtc_helper.c | 13 ++++++++++++ > > drivers/gpu/drm/drm_print.c | 27 +++++++++++++++++++++++-- > > drivers/gpu/drm/i915/i915_params.c | 12 +++++++++++ > > drivers/gpu/drm/nouveau/nouveau_drm.c | 13 ++++++++++++ > > include/drm/drm_print.h | 3 ++- > > 7 files changed, 92 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > index de7144b06e93..97e184f44a52 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > @@ -38,6 +38,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > > > #include "amdgpu.h" > > #include "amdgpu_irq.h" > > @@ -185,6 +187,18 @@ int amdgpu_vcnfw_log; > > > > static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); > > > > +DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, > > Iirc we've talked about maybe some kbuild trickery so that any module > under drivers/gpu/drm gets these by default. I don't think we need to have > this for the first cut, but a macro to avoid the copypaste mistakes would > be really good here. It *may be* that theres a perfect place to declare it once, for everyone. For me thats exploratory, error prone. Proving that the sub-optimal worked seemed a good place to stop. that said, theres a macro in test-dynamic-debug that is a candidate for wider availability - it needs a better name #define DD_SYS_WRAP(_model, _flags) \ static unsigned long bits_##_model; \ static struct ddebug_class_param _flags##_model = { \ .bits = &bits_##_model, \ .flags = #_flags, \ .map = &map_##_model, \ }; \ module_param_cb(_flags##_##_model, ¶m_ops_dyndbg_classes, &_flags##_model, 0600)