[RFC PATCH v2 00/19] dynamic debug diet plan
From: Jim Cromie
Date: Fri Dec 25 2020 - 15:21:48 EST
Well, we're mostly overeating, but we can all look forward to a diet
in January. And more exersize.
dyndbg's compiled-in data-table currently uses 56 bytes per prdebug;
this includes 3 pointers to hierarchical "decorator" data, which is
primarily for adding "module:function:line:" prefixes to prdebug
messages, and for enabling and modifying those prdebugs selectively.
This patchset decouples "decorator" data, and makes it optional, and
disposable. By separating that data, it opens up possiblities to
compress it, swap it out, map it selectively, etc.
In more detail, patchset does:
1- split struct _ddebug in 2, move "decorator" fields to _ddebug_callsites.
while this adds a pointer per site to memory footprint, it allows:
a- dropping decorations and storage, for some use cases.
this could include DRM:
- want to save calls to drm_debug_enabled()
- use distinct categories, can map to format-prefixes, ex: "drm:kms:"
- don't need "module:function:line" dynamic prefixes.
- dont mind loss of info/context in /proc/dynamic_debug/control
b- ddebug_callsites[] contents are hierarchical, compressible.
c- ddebug_callsites[] in separate section is compressible as a block.
d- for just enabled prdebugs, could allocate callsites and fill from zblock.
2- make ddebug_callsites optional internally.
This lets us drop them outright, for any reason, perhaps memory pressure.
3- allow dropping callsites by those users.
echo module drm +D > /proc/dynamic_debug/control
this doesnt currently recover __dyndbg_callsites storage
4- drop _ddebug.site, convert to _ddebug[N].property<x> lookup.
RFC is mostly here.
rev1: https://lore.kernel.org/lkml/20201125194855.2267337-1-jim.cromie@xxxxxxxxx/
rev2 differs by dropping zram attempt, making callsite data optional, etc.
Jim Cromie (19): against v5.10
dyndbg: fix use before null check
1 dyndbg: split struct _ddebug, move display fields to new
_ddebug_callsite
2 dyndbg: refactor part of ddebug_change to ddebug_match_site
dyndbg: accept null site in ddebug_match_site
dyndbg: hoist ->site out of ddebug_match_site
dyndbg: accept null site in ddebug_change
dyndbg: accept null site in dynamic_emit_prefix
dyndbg: accept null site in ddebug_proc_show
dyndbg: optimize ddebug_emit_prefix
dyndbg: avoid calling dyndbg_emit_prefix when it has no work
3 dyndbg: refactor ddebug_alter_site out of ddebug_change
dyndbg: allow deleting site info via control interface
4 dyndbg: verify __dyndbg & __dyndbg_callsite invariant
dyndbg+module: expose dyndbg_callsites to modules
dyndbg: add ddebug_site_get/put api with pass-thru impl
dyndbg: ddebug_site_get/put api commentary
dyndbg: rearrange struct ddebug_callsites
dyndbg: add module_index to struct _ddebug
dyndbg: try DEFINE_DYNAMIC_DEBUG_TABLE
drivers/gpu/drm/i915/i915_drv.c | 3 +
include/asm-generic/vmlinux.lds.h | 4 +
include/linux/dynamic_debug.h | 97 ++++++++---
kernel/module-internal.h | 1 +
kernel/module.c | 9 +-
lib/dynamic_debug.c | 271 +++++++++++++++++++++---------
6 files changed, 283 insertions(+), 102 deletions(-)
--
2.29.2