The patch titled Subject: lib/dynamic_debug.c: introduce CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS has been added to the -mm tree. Its filename is dynamic_debug-introduce-config_dynamic_debug_relative_pointers.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/dynamic_debug-introduce-config_dynamic_debug_relative_pointers.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/dynamic_debug-introduce-config_dynamic_debug_relative_pointers.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> Subject: lib/dynamic_debug.c: introduce CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS Based on the same idea for struct bug_entry, an architecture can opt-in to use relative pointers in struct _ddebug. It only makes sense for 64 bit architectures, where one saves 16 bytes per entry (out of 40 or 56, depending on CONFIG_JUMP_LABEL). The architecture is responsible for providing a suitable DEFINE_DYNAMIC_DEBUG_METADATA macro in <asm/dynamic_debug.h>. Link: http://lkml.kernel.org/r/20190409212517.7321-7-linux@xxxxxxxxxxxxxxxxxx Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> Acked-by: Jason Baron <jbaron@xxxxxxxxxx> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Christophe Leroy <christophe.leroy@xxxxxx> Cc: David Miller <davem@xxxxxxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Paul Mackerras <paulus@xxxxxxxxx> Cc: Petr Mladek <pmladek@xxxxxxxx> Cc: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/dynamic_debug.h | 14 ++++++++++++++ lib/Kconfig.debug | 3 +++ lib/dynamic_debug.c | 20 ++++++++++++++++++++ 3 files changed, 37 insertions(+) --- a/include/linux/dynamic_debug.h~dynamic_debug-introduce-config_dynamic_debug_relative_pointers +++ a/include/linux/dynamic_debug.h @@ -16,10 +16,17 @@ struct _ddebug { * These fields are used to drive the user interface * for selecting and displaying debug callsites. */ +#ifdef CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS + signed int modname_disp; + signed int function_disp; + signed int filename_disp; + signed int format_disp; +#else const char *modname; const char *function; const char *filename; const char *format; +#endif /* * The flags field controls the behaviour at the callsite. * The bits here are changed dynamically when the user @@ -70,6 +77,12 @@ void __dynamic_netdev_dbg(struct _ddebug const struct net_device *dev, const char *fmt, ...); +#ifdef CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS +#include <asm/dynamic_debug.h> +#ifndef DEFINE_DYNAMIC_DEBUG_METADATA +# error "asm/dynamic_debug.h must provide definition of DEFINE_DYNAMIC_DEBUG_METADATA" +#endif +#else #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ static struct _ddebug __aligned(8) \ __attribute__((section("__verbose"))) name = { \ @@ -80,6 +93,7 @@ void __dynamic_netdev_dbg(struct _ddebug .flags_lineno = _DPRINTK_FLAGS_LINENO_INIT, \ _DPRINTK_KEY_INIT \ } +#endif #ifdef CONFIG_JUMP_LABEL --- a/lib/dynamic_debug.c~dynamic_debug-introduce-config_dynamic_debug_relative_pointers +++ a/lib/dynamic_debug.c @@ -37,6 +37,24 @@ #include <linux/device.h> #include <linux/netdevice.h> +#ifdef CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS +static inline const char *dd_modname(const struct _ddebug *dd) +{ + return (const char *)dd + dd->modname_disp; +} +static inline const char *dd_function(const struct _ddebug *dd) +{ + return (const char *)dd + dd->function_disp; +} +static inline const char *dd_filename(const struct _ddebug *dd) +{ + return (const char *)dd + dd->filename_disp; +} +static inline const char *dd_format(const struct _ddebug *dd) +{ + return (const char *)dd + dd->format_disp; +} +#else static inline const char *dd_modname(const struct _ddebug *dd) { return dd->modname; @@ -53,6 +71,8 @@ static inline const char *dd_format(cons { return dd->format; } +#endif + static inline unsigned dd_lineno(const struct _ddebug *dd) { return dd->flags_lineno >> 8; --- a/lib/Kconfig.debug~dynamic_debug-introduce-config_dynamic_debug_relative_pointers +++ a/lib/Kconfig.debug @@ -163,6 +163,9 @@ config DYNAMIC_DEBUG See Documentation/admin-guide/dynamic-debug-howto.rst for additional information. +config DYNAMIC_DEBUG_RELATIVE_POINTERS + bool + endmenu # "printk and dmesg options" menu "Compile-time checks and compiler options" _ Patches currently in -mm which might be from linux@xxxxxxxxxxxxxxxxxx are linux-deviceh-use-unique-identifier-for-each-struct-_ddebug.patch linux-neth-use-unique-identifier-for-each-struct-_ddebug.patch linux-printkh-use-unique-identifier-for-each-struct-_ddebug.patch dynamic_debug-introduce-accessors-for-string-members-of-struct-_ddebug.patch dynamic_debug-drop-use-of-bitfields-in-struct-_ddebug.patch dynamic_debug-introduce-config_dynamic_debug_relative_pointers.patch dynamic_debug-add-asm-generic-implementation-for-dynamic_debug_relative_pointers.patch x86-64-select-dynamic_debug_relative_pointers.patch arm64-select-dynamic_debug_relative_pointers.patch powerpc-select-dynamic_debug_relative_pointers-for-ppc64.patch lib-bitmapc-remove-unused-export_symbols.patch lib-bitmapc-guard-exotic-bitmap-functions-by-config_numa.patch bitopsh-sanitize-rotate-primitives.patch