linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jim Cromie <jim.cromie@gmail.com>
To: jbaron@akamai.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org
Cc: Jim Cromie <jim.cromie@gmail.com>
Subject: [RFC PATCH v2 16/19] dyndbg: ddebug_site_get/put api commentary
Date: Fri, 25 Dec 2020 13:19:41 -0700	[thread overview]
Message-ID: <20201225201944.3701590-17-jim.cromie@gmail.com> (raw)
In-Reply-To: <20201225201944.3701590-1-jim.cromie@gmail.com>

Paths forward: (not mutually exclusive)

A: !site -> fill from backing store

1st try at this is/was using zram.  At init, it copied each callsite
into a zs-allocation, and all site-> refs afterward went thru
_get/_put to zs-map on demand, and zs-unmap the site info.  This
worked until I tried to keep callsites mapped while they're enabled.

Another approach is to compress the new linker section, using some
algo thats good at indexed decompression.  I tried to test this a bit,
using objcopy, unsuccessfully:

   objcopy --dump-section __dyndbg_callsites=dd_callsites vmlinux.o

From vmlinux.o it was mostly empty, vmlinux didnt have the section.

B: callsite as a set of property vectors, indexed by 'N'

We know dp is in a vector, either in the builtin __dyndbg_callsite
linker section, or the same from a modprobed one.  The builtin section
has all builtin module sub-sections catenated dogether.

At init, we iterate over the section, and "parse it" by creating a
ddebug_table for each module with prdebugs.  ddebug_table.num_debugs
remembers the size of each modules' vector of prdebugs.

We need a few things:

- _ddebug.index field, which knows offset to start of this sub-vector.
  this new field will be "free" because the struct has padding.
  it can be initialized during init, then RO.

- a back-pointer at the beginning of the sub-vector, to the
  ddebug_table "owning" (but not containing) this sub-vector of
  prdebugs.

If we had both, we could get from the ddebug element to its vector
root, back up to the owning ddebug_table, then down to the _callsite
vector, and index to the right element.  While slower than a pointer
deref, this is a cold path, and it allows elimination of the
per-callsite pointer member, thus greater density of the sections, and
still can support sparse site info.

That back-pointer feels tricky.  It needs to be 1st in the sub-vector

is to reserve the 0th slot

ing its spot at the
front of

each module's ddebug sub-vector.

getting space in the
section for it.  Initializing it is easy.

prdebugs are added to section when DECLARE_DYAMIC_DEBUG_METADATA is
compiled; its unclear whether they are intrinsically sorted during
compile, or whether thats a linker thing.

Ideally, a MODULE-mumble declaration can be coaxed into declaring a
module singleton in the section(s), either naturally at the top (or
bottom) or sorted into place.

If that doesn't work, a "preload if module is different" strategy
could maybe work, but I dont know how to do that in macros.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 lib/dynamic_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 25f49515c235..ec28c113a361 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -146,7 +146,7 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg)
 
 static struct _ddebug_callsite *ddebug_site_get(struct _ddebug *dp)
 {
-	return dp->site;
+	return dp->site; /* passthru abstraction */
 }
 static inline void ddebug_site_put(struct _ddebug *dp)
 {
-- 
2.29.2


  parent reply	other threads:[~2020-12-25 20:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-25 20:19 [RFC PATCH v2 00/19] dynamic debug diet plan Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 01/19] dyndbg: fix use before null check Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 02/19] dyndbg: split struct _ddebug, move display fields to new _ddebug_callsite Jim Cromie
2020-12-31  2:34   ` [dyndbg] e83b4a5011: leaking-addresses.proc.__dyndbg_callsites kernel test robot
2020-12-25 20:19 ` [RFC PATCH v2 03/19] dyndbg: refactor part of ddebug_change to ddebug_match_site Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 04/19] dyndbg: accept null site in ddebug_match_site Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 05/19] dyndbg: hoist ->site out of ddebug_match_site Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 06/19] dyndbg: accept null site in ddebug_change Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 07/19] dyndbg: accept null site in dynamic_emit_prefix Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 08/19] dyndbg: accept null site in ddebug_proc_show Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 09/19] dyndbg: optimize ddebug_emit_prefix Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 10/19] dyndbg: avoid calling dyndbg_emit_prefix when it has no work Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 11/19] dyndbg: refactor ddebug_alter_site out of ddebug_change Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 12/19] dyndbg: allow deleting site info via control interface Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 13/19] dyndbg: verify __dyndbg & __dyndbg_callsite invariant Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 14/19] dyndbg+module: expose ddebug_callsites to modules Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 15/19] dyndbg: add ddebug_site_get/put api with pass-thru impl Jim Cromie
2020-12-25 20:19 ` Jim Cromie [this message]
2020-12-25 20:19 ` [RFC PATCH v2 17/19] dyndbg: rearrange struct ddebug_callsites Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 18/19] dyndbg: add module_index to struct _ddebug Jim Cromie
2020-12-25 20:19 ` [RFC PATCH v2 19/19] dyndbg: try DEFINE_DYNAMIC_DEBUG_TABLE Jim Cromie
2020-12-29 18:56 ` [RFC PATCH v2 00/19] dynamic debug diet plan Joe Perches
2021-01-06 17:50   ` jim.cromie

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=20201225201944.3701590-17-jim.cromie@gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jbaron@akamai.com \
    --cc=linux-kernel@vger.kernel.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).