From: Andrew Morton <akpm@linux-foundation.org>
To: Mathias Krause <minipli@googlemail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Joe Perches <joe@perches.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/8] printk: Provide pi_<level> / pe_<level> macros for __init / __exit code
Date: Tue, 15 Jul 2014 16:23:30 -0700 [thread overview]
Message-ID: <20140715162330.f9b18b79c0f32b84cb7a9071@linux-foundation.org> (raw)
In-Reply-To: <1405176212-12175-3-git-send-email-minipli@googlemail.com>
On Sat, 12 Jul 2014 16:43:26 +0200 Mathias Krause <minipli@googlemail.com> wrote:
> The memory used for functions marked with __init will be released after
> initialization, albeit static data referenced by such code will not, if
> not explicitly marked this way, too. This is especially true for format
> strings used in messages printed by such code. Those are not marked and
> therefore will survive the __init cleanup -- dangling in memory without
> ever being referenced again.
>
> Ideally we would like the compiler to automatically recognise such
> constructs but it does not and it's not as simple as it might sound, as
> strings used in initialization code might latter still be used, e.g. as
> a slab cache name. Therefore we need to explicitly mark the strings we
> want to release together with the function itself.
>
> For a seamless integration of the necessary __init_str() / __exit_str()
> macros to mark the format strings, this patch provides new variants of
> the well known pr_<level>() macros as pi_<level>() for __init code and
> pe_<level>() for __exit code. Changing existing code should thereby be
> as simple as changing a single letter.
>
> For code that cannot be changed to use the pi_<level>() / pe_<level>()
> macros printk_init() and printk_exit() macros are provided, too.
>
> One remark, though: We cannot provide appropriate p[ie]_debug() macros
> for the CONFIG_DYNAMIC_DEBUG case as there is (currently) no way to
> remove entries from dyndbg after initialization. But supporting that
> scenario would require more work (and code), therefore not necessarily
> justifying the memory savings.
I assume that if a programmer gets this wrong,
CONFIG_DEBUG_SECTION_MISMATCH will detect and report the error?
Please thoroughly test this if you have not done so.
next prev parent reply other threads:[~2014-07-15 23:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-12 14:43 [PATCH v2 0/8] Mark literal strings in " Mathias Krause
2014-07-12 14:43 ` [PATCH v2 1/8] init.h: Add __init_str / __exit_str macros Mathias Krause
2014-07-12 14:43 ` [PATCH v2 2/8] printk: Provide pi_<level> / pe_<level> macros for __init / __exit code Mathias Krause
2014-07-15 23:23 ` Andrew Morton [this message]
2014-07-16 6:29 ` Mathias Krause
2014-07-12 14:43 ` [PATCH v2 3/8] x86, acpi: Mark __init strings as such Mathias Krause
2014-07-12 14:43 ` [PATCH v2 4/8] x86, mm: Make x86_init.memory_setup() return a const char * Mathias Krause
2014-07-12 14:43 ` [PATCH v2 5/8] x86, mm: early_panic() - pass on the message as string Mathias Krause
2014-07-12 14:43 ` [PATCH v2 6/8] x86, mm: e820 - mark __init strings as such Mathias Krause
2014-07-12 14:43 ` [PATCH v2 7/8] x86: setup " Mathias Krause
2014-07-12 14:43 ` [PATCH v2 8/8] kallsyms: exclude pseudo symbols for __init / __exit strings Mathias Krause
2014-07-15 23:26 ` [PATCH v2 0/8] Mark literal strings in __init / __exit code Andrew Morton
2014-07-16 6:30 ` Mathias Krause
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=20140715162330.f9b18b79c0f32b84cb7a9071@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=mingo@redhat.com \
--cc=minipli@googlemail.com \
--cc=tglx@linutronix.de \
/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®