From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Jason Baron <jbaron@akamai.com>,
Nathan Chancellor <natechancellor@gmail.com>,
Nick Desaulniers <ndesaulniers@google.com>,
linux-kernel@vger.kernel.org,
Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: [PATCH v6 0/8] implement DYNAMIC_DEBUG_RELATIVE_POINTERS
Date: Tue, 18 Jun 2019 00:20:26 +0200 [thread overview]
Message-ID: <20190617222034.10799-1-linux@rasmusvillemoes.dk> (raw)
Similar to CONFIG_GENERIC_BUG_RELATIVE_POINTERS that replaces (8 byte)
const char* members by (4 byte) signed offsets from the bug_entry,
this implements the similar thing for struct _ddebug, the descriptors
underlying pr_debug() and friends in a CONFIG_DYNAMIC_DEBUG kernel.
Since struct _ddebug has four string members, we save 16 byte per
instance. The total savings seem to be comparable to what is saved by
an architecture selecting GENERIC_BUG_RELATIVE_POINTERS (see patch 8
for some numbers for a common distro config).
While refreshing these patches, which were orignally just targeted at
x86-64, it occured to me that despite the implementation relying on
inline asm, there's nothing x86 specific about it, and indeed it seems
to work out-of-the-box for ppc64 and arm64 as well, but those have
only been compile-tested.
The first 6 patches are rather pedestrian preparations. The fun stuff
is in patch 7, and the last patch is just the minimal boilerplate to
hook up the asm-generic header and selecting
HAVE_DYNAMIC_DEBUG_RELATIVE_POINTERS on x86-64. Doing arm64 and ppc64
would be similar 2-line patches.
Unfortunately, the "fun stuff" includes some magic that breaks the
build in some corner cases with older gcc (and some not-so-magic that
clang only supports since version 9 for non-x86 targets). So in this
v6, the config option DYNAMIC_DEBUG_RELATIVE_POINTERS has been made
opt-in, depending on the arch-selected
HAVE_DYNAMIC_DEBUG_RELATIVE_POINTERS, instead of the arch selecting it
directly. Also, I've set a lower bound for the gcc and clang versions,
so that hopefully nobody should be able to select the option and have
the build break.
Rasmus Villemoes (8):
linux/device.h: use unique identifier for each struct _ddebug
linux/net.h: use unique identifier for each struct _ddebug
linux/printk.h: use unique identifier for each struct _ddebug
dynamic_debug: introduce accessors for string members of struct
_ddebug
dynamic_debug: drop use of bitfields in struct _ddebug
dynamic_debug: introduce CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS
dynamic_debug: add asm-generic implementation for
DYNAMIC_DEBUG_RELATIVE_POINTERS
x86-64: select HAVE_DYNAMIC_DEBUG_RELATIVE_POINTERS
arch/x86/Kconfig | 1 +
arch/x86/entry/vdso/vdso32/vclock_gettime.c | 1 +
arch/x86/include/asm/Kbuild | 1 +
include/asm-generic/dynamic_debug.h | 116 ++++++++++++++++++++
include/linux/device.h | 4 +-
include/linux/dynamic_debug.h | 26 +++--
include/linux/jump_label.h | 2 +
include/linux/net.h | 4 +-
include/linux/printk.h | 4 +-
lib/Kconfig.debug | 16 +++
lib/dynamic_debug.c | 111 ++++++++++++++-----
11 files changed, 246 insertions(+), 40 deletions(-)
create mode 100644 include/asm-generic/dynamic_debug.h
--
2.20.1
next reply other threads:[~2019-06-17 22:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 22:20 Rasmus Villemoes [this message]
2019-06-17 22:20 ` [PATCH v6 1/8] linux/device.h: use unique identifier for each struct _ddebug Rasmus Villemoes
2019-06-17 22:20 ` [PATCH v6 2/8] linux/net.h: " Rasmus Villemoes
2019-06-17 23:08 ` David Miller
2019-06-17 22:20 ` [PATCH v6 3/8] linux/printk.h: " Rasmus Villemoes
2019-06-17 22:20 ` [PATCH v6 4/8] dynamic_debug: introduce accessors for string members of " Rasmus Villemoes
2019-06-17 22:20 ` [PATCH v6 5/8] dynamic_debug: drop use of bitfields in " Rasmus Villemoes
2019-06-17 22:20 ` [PATCH v6 6/8] dynamic_debug: introduce CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
2019-06-17 22:20 ` [PATCH v6 7/8] dynamic_debug: add asm-generic implementation for DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
2019-06-17 22:35 ` Nick Desaulniers
2019-06-20 20:46 ` Rasmus Villemoes
2019-06-24 21:53 ` Nick Desaulniers
2019-06-25 6:35 ` Rasmus Villemoes
2019-06-25 22:18 ` Nick Desaulniers
2019-06-26 23:16 ` Nick Desaulniers
2019-06-26 23:52 ` Rasmus Villemoes
2019-06-27 18:03 ` Nick Desaulniers
2019-06-17 22:20 ` [PATCH v6 8/8] x86-64: select HAVE_DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
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=20190617222034.10799-1-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=akpm@linux-foundation.org \
--cc=jbaron@akamai.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
/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
all inboxes | Powered by JetHome®