linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jim.cromie@gmail.com
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Jason Baron <jbaron@akamai.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	amd-gfx mailing list <amd-gfx@lists.freedesktop.org>,
	intel-gvt-dev@lists.freedesktop.org,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Sean Paul <seanpaul@chromium.org>, Joe Perches <joe@perches.com>
Subject: Re: [PATCH v7 2/9] drm: POC drm on dyndbg - use in core, 2 helpers, 3 drivers.
Date: Mon, 12 Sep 2022 15:11:05 -0600	[thread overview]
Message-ID: <CAJfuBxy5E0xPFH=bxaaXy2Q8LojBrqgr+su8wGq7rsv3m7_d_g@mail.gmail.com> (raw)
In-Reply-To: <87pmg06g2x.fsf@intel.com>

On Mon, Sep 12, 2022 at 4:29 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> On Sun, 11 Sep 2022, Jim Cromie <jim.cromie@gmail.com> 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:


>
> The commit message could start off by saying each module needs to define
> DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, ...). That is, IIUC.
>

Yes, I see your point.
All the explanations missing here are in preceding commits,
now in GregKHs  driver-core/driver-core-next tree,
so I didnt resend them.


> Where's DECLARE_DYNDBG_CLASSMAP defined? linux-next? What's it do? What
> if multiple modules with that are actually builtin?

The commit that adds the macro is at
https://lore.kernel.org/lkml/20220904214134.408619-15-jim.cromie@gmail.com/

there are many combos of builtin, Ive done at least several:
with caveat that >98% of testing is on virtme (thanks for that tool)

- test_dynamic_debug as module, and builtin.
it has multiple macro uses, showing 1 kind of sharing

- drm as builtin, drivers as modules
that surely pulled in other drm-helpers as builtins

- all loadable modules mostly.


>
> The duplication and requirement that they're identical seems like an
> error prone combo.

I freely acknowledge(d) this is sub-optimal.
There might be a best place for a single declaration that is in-scope
across multiple modules, but I dont know the drm core/driver lifetime
well enough to just drop this into that place.

I may have complicated things by starting with a static struct holding
the classmap, that choice was driven by:

- static declaration into a section solved a problem where the class
definitions
were "registered" (term used in patchset, -v2-3?) too late to be available for
     modprobe i915 dyndbg='class DRM_UT_CORE +p'
but worked afterwards
(also true for builtins and boot-time $mod.dyndbg='class notworking +p')

Another subtlety - the "sharing" is due more to: drm_dbg(DRM_UT_*, "")
Im not sure precisely how this might matter.

I also had an "incompleteness" argument circling in my head - something like;
you cant simultaneously allow a drm-wanna-be module to declare "DRM_UT_CORE"
but disallow "DRM_UT_ILL_CONSIDERED".   I kind-of stopped there.

Theres also an issue where multiple declarations in a module must
avoid range overlap.
I had no idea how to put that into a BUILD_BUG_ON.
Its done manually, with commentary, in test-dynamic-debug.

Maybe both issues can be improved somewhat by changing the macro
to expect real ENUM symbols, (and stringify _VA_ARGS_ to init the classnames),
not the quoted "DRM_UT_*"s it gets now.  That would also obsolete the _base,
since its the value of DRM_UT_CORE (the 1st enum val).
But that still leaves the enum vals enumerated, with possibility of
omission or mixup,
which unlike a spelling error wouldnt get caught, and would be wrong.

I fiddled with the 1st part of that for a while, I lack the macro-fu,
and punted.

Im happy to try an alternative approach, particularly with elaborated
suggestions.


>
> Finally, the choice of placement in e.g. i915_params.c seems completely
> arbitrary, and makes you wonder "what here requires this, nothing?".

acknowledged - I put it there because the access to it is via a parameter,
namely one that already affects it from a distance:
   /sys/module/drm/parameters/debug - ie drm.dbg

And its not even i915's parameter.

>
> BR,
> Jani.
>

thanks,

>
> >
> > Signed-off-by: Jim Cromie <jim.cromie@gmail.com>

  reply	other threads:[~2022-09-12 21:11 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12  5:28 [PATCH v7 0/9] dyndbg: drm.debug adaptation Jim Cromie
2022-09-12  5:28 ` [PATCH v7 1/9] drm_print: condense enum drm_debug_category Jim Cromie
2022-09-12 10:17   ` Jani Nikula
2022-09-13 15:57     ` jim.cromie
2022-09-12  5:28 ` [PATCH v7 2/9] drm: POC drm on dyndbg - use in core, 2 helpers, 3 drivers Jim Cromie
2022-09-12 10:29   ` Jani Nikula
2022-09-12 21:11     ` jim.cromie [this message]
2022-09-12  5:28 ` [PATCH v7 3/9] drm_print: interpose drm_*dbg with forwarding macros Jim Cromie
2022-09-12  5:28 ` [PATCH v7 4/9] drm_print: wrap drm_*_dbg in dyndbg descriptor factory macro Jim Cromie
2022-09-12  5:28 ` [PATCH v7 5/9] drm-print.h: include dyndbg header Jim Cromie
2022-09-12  5:28 ` [PATCH v7 6/9] drm-print: add drm_dbg_driver to improve namespace symmetry Jim Cromie
2022-09-12  5:28 ` [PATCH v7 7/9] drm_print: optimize drm_debug_enabled for jump-label Jim Cromie
2022-09-12  5:28 ` [PATCH v7 8/9] drm_print: prefer bare printk KERN_DEBUG on generic fn Jim Cromie
2022-09-12  5:28 ` [PATCH v7 9/9] drm_print: add _ddebug descriptor to drm_*dbg prototypes Jim Cromie
2022-09-24 13:02 ` [PATCH v7 0/9] dyndbg: drm.debug adaptation Greg KH
2022-10-20 16:09   ` Ville Syrjälä
2022-10-21  9:18     ` [Intel-gfx] " Jani Nikula
2022-10-27 15:08       ` Jason Baron
2022-10-27 15:37         ` jim.cromie
2022-10-27 15:58           ` Ville Syrjälä
2022-10-27 19:55             ` jim.cromie
2022-10-27 20:09               ` Ville Syrjälä
2022-10-30 14:42                 ` jim.cromie
2022-10-31 13:07                   ` Ville Syrjälä
2022-10-31 22:11                     ` jim.cromie
2022-11-01  0:20                       ` Jason Baron
2022-11-01  8:52                         ` Ville Syrjälä
2022-11-01 13:09                           ` jim.cromie
2022-11-11 22:17 ` [PATCH 0/7] DYNAMIC_DEBUG fixups for rc Jim Cromie
2022-11-11 22:17   ` [PATCH 1/7] drm: mark drm.debug-on-dyndbg as BROKEN for now Jim Cromie
2022-11-14 12:20     ` [Intel-gfx] " Ville Syrjälä
2022-11-17  6:29     ` Greg KH
2022-11-11 22:17   ` [PATCH 2/7] drm_print: fixup improve stale comment Jim Cromie
2022-11-11 22:17   ` [PATCH 3/7] test-dyndbg: fixup CLASSMAP usage error Jim Cromie
2022-11-11 22:17   ` [PATCH 4/7] test-dyndbg: show that DEBUG enables prdbgs at compiletime Jim Cromie
2022-11-11 22:17   ` [PATCH 5/7] dyndbg: fix readback value on LEVEL_NAMES interfaces Jim Cromie
2022-11-11 22:17   ` [PATCH 6/7] dyndbg: clone DECLARE_DYNDBG_CLASSMAP to REFERENCE_DYNDBG_CLASSMAP Jim Cromie
2022-11-11 22:17   ` [PATCH 7/7] dyndbg: replace classmap list with a vector Jim Cromie
2022-11-17  6:29   ` [PATCH 0/7] DYNAMIC_DEBUG fixups for rc Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJfuBxy5E0xPFH=bxaaXy2Q8LojBrqgr+su8wGq7rsv3m7_d_g@mail.gmail.com' \
    --to=jim.cromie@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jbaron@akamai.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=seanpaul@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).