lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250803035816.603405-32-jim.cromie@gmail.com>
Date: Sat,  2 Aug 2025 21:57:49 -0600
From: Jim Cromie <jim.cromie@...il.com>
To: linux-kernel@...r.kernel.org,
	jbaron@...mai.com,
	gregkh@...uxfoundation.org,
	ukaszb@...omium.org,
	louis.chauvet@...tlin.com
Cc: dri-devel@...ts.freedesktop.org,
	amd-gfx@...ts.freedesktop.org,
	intel-gvt-dev@...ts.freedesktop.org,
	intel-gfx@...ts.freedesktop.org,
	daniel.vetter@...ll.ch,
	tvrtko.ursulin@...ux.intel.com,
	jani.nikula@...el.com,
	ville.syrjala@...ux.intel.com,
	seanpaul@...omium.org,
	robdclark@...il.com,
	groeck@...gle.com,
	yanivt@...gle.com,
	bleung@...gle.com,
	quic_saipraka@...cinc.com,
	will@...nel.org,
	catalin.marinas@....com,
	quic_psodagud@...cinc.com,
	maz@...nel.org,
	arnd@...db.de,
	linux-arm-kernel@...ts.infradead.org,
	linux-arm-msm@...r.kernel.org,
	mingo@...hat.com,
	jim.cromie@...il.com
Subject: [PATCH v4 31/58] dyndbg: add _DPRINTK_FLAGS_INCL_LOOKUP for +mfsl flags

dyndbg's dynamic prefixing can get expensive; each enabled callsite's
prefix is sprintf'd into stack-mem, every time a pr_debug is called.

A cache would help, if callsites mark _DPRINTK_FLAGS_PREFIX_CACHED
after saving the prefix string.  But not just yet.

_DPRINTK_FLAGS_INCL_LOOKUP distinguishes from _DPRINTK_FLAGS_INCL_ANY
by selecting *only* module,file,function fields to compose the
cacheable part of the (+tmfsl) dynamic prefix:

-t  thread-id. not part of the "callsite" info, its from current.
    doesn't belong in the cache. it would spoil it.
    do it in outer: dynamic_emit_prefix()

-mfs  module, function, source-file
    they are "lookups", currently to struct _ddebug fields.
    could be accessor macros to "compressed" tables.
    then they might be worth caching, ready for reuse.

-l  line
    this info could go either way.
    I elected to include it in LOOKUP, so in cache/inner fn.
    this makes cache larger but avoids sprintf %d each time.
    smaller cache needs smarter key.

All enabled together, they compose a prefix string like:

  # outer -----inner----------------------
  "[tid] module:function:sourcfile:line: "

So this patch extracts _DPRINTK_FLAGS_INCL_LOOKUP flags-combo out of
_DPRINTK_FLAGS_INCL_ANY, then redefs latter.

Next re-refactor dynamic_emit_prefix inner/outer fns accordingly.

Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
 include/linux/dynamic_debug.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 0f7476456614e..d64f13a7a7394 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -40,10 +40,11 @@ struct _ddebug {
 #define _DPRINTK_FLAGS_INCL_SOURCENAME	(1<<5)
 #define _DPRINTK_FLAGS_PREFIX_CACHED	(1<<7)
 
-#define _DPRINTK_FLAGS_INCL_ANY		\
-	(_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\
-	 _DPRINTK_FLAGS_INCL_LINENO  | _DPRINTK_FLAGS_INCL_TID |\
-	 _DPRINTK_FLAGS_INCL_SOURCENAME)
+#define _DPRINTK_FLAGS_INCL_LOOKUP					\
+	(_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |	\
+	 _DPRINTK_FLAGS_INCL_SOURCENAME | _DPRINTK_FLAGS_INCL_LINENO)
+#define _DPRINTK_FLAGS_INCL_ANY						\
+	(_DPRINTK_FLAGS_INCL_TID | _DPRINTK_FLAGS_INCL_LOOKUP)
 
 #if defined DEBUG
 #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
-- 
2.50.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ