From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: stable@vger.kernel.org, John Ogness <john.ogness@linutronix.de>,
Petr Mladek <pmladek@suse.com>
Subject: Re: [PATCH 5.10.y] printk: declare printk_deferred_{enter,safe}() in include/linux/printk.h
Date: Mon, 15 May 2023 14:56:43 +0200 [thread overview]
Message-ID: <2023051537-embargo-scouting-a849@gregkh> (raw)
In-Reply-To: <767ab028-d946-98d5-4a13-d6ed6df77763@I-love.SAKURA.ne.jp>
On Sun, May 14, 2023 at 01:41:27PM +0900, Tetsuo Handa wrote:
> commit 85e3e7fbbb720b9897fba9a99659e31cbd1c082e upstream.
>
> [This patch implements subset of original commit 85e3e7fbbb72 ("printk:
> remove NMI tracking") where commit 1007843a9190 ("mm/page_alloc: fix
> potential deadlock on zonelist_update_seq seqlock") depends on, for
> commit 3d36424b3b58 ("mm/page_alloc: fix race condition between
> build_all_zonelists and page allocation") was backported to stable.]
>
> All NMI contexts are handled the same as the safe context: store the
> message and defer printing. There is no need to have special NMI
> context tracking for this. Using in_nmi() is enough.
>
> There are several parts of the kernel that are manually calling into
> the printk NMI context tracking in order to cause general printk
> deferred printing:
>
> arch/arm/kernel/smp.c
> arch/powerpc/kexec/crash.c
> kernel/trace/trace.c
>
> For arm/kernel/smp.c and powerpc/kexec/crash.c, provide a new
> function pair printk_deferred_enter/exit that explicitly achieves the
> same objective.
>
> For ftrace, remove the printk context manipulation completely. It was
> added in commit 03fc7f9c99c1 ("printk/nmi: Prevent deadlock when
> accessing the main log buffer in NMI"). The purpose was to enforce
> storing messages directly into the ring buffer even in NMI context.
> It really should have only modified the behavior in NMI context.
> There is no need for a special behavior any longer. All messages are
> always stored directly now. The console deferring is handled
> transparently in vprintk().
>
> Signed-off-by: John Ogness <john.ogness@linutronix.de>
> [pmladek@suse.com: Remove special handling in ftrace.c completely.
> Signed-off-by: Petr Mladek <pmladek@suse.com>
> Link: https://lore.kernel.org/r/20210715193359.25946-5-john.ogness@linutronix.de
> [penguin-kernel: Copy only printk_deferred_{enter,safe}() definition ]
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
> include/linux/printk.h | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index fe7eb2351610..344f6da3d4c3 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -623,4 +623,23 @@ static inline void print_hex_dump_debug(const char *prefix_str, int prefix_type,
> #define print_hex_dump_bytes(prefix_str, prefix_type, buf, len) \
> print_hex_dump_debug(prefix_str, prefix_type, 16, 1, buf, len, true)
>
> +#ifdef CONFIG_PRINTK
> +extern void __printk_safe_enter(void);
> +extern void __printk_safe_exit(void);
> +/*
> + * The printk_deferred_enter/exit macros are available only as a hack for
> + * some code paths that need to defer all printk console printing. Interrupts
> + * must be disabled for the deferred duration.
> + */
> +#define printk_deferred_enter __printk_safe_enter
> +#define printk_deferred_exit __printk_safe_exit
> +#else
> +static inline void printk_deferred_enter(void)
> +{
> +}
> +static inline void printk_deferred_exit(void)
> +{
> +}
> +#endif
> +
> #endif
> --
> 2.34.1
>
>
All now queued up, thanks.
greg k-h
next prev parent reply other threads:[~2023-05-15 12:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-24 7:05 FAILED: patch "[PATCH] mm/page_alloc: fix potential deadlock on zonelist_update_seq" failed to apply to 5.10-stable tree gregkh
2023-05-14 4:41 ` [PATCH 5.10.y] printk: declare printk_deferred_{enter,safe}() in include/linux/printk.h Tetsuo Handa
2023-05-15 12:56 ` Greg Kroah-Hartman [this message]
2023-05-15 13:11 ` Tetsuo Handa
2023-05-15 16:06 ` Greg Kroah-Hartman
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=2023051537-embargo-scouting-a849@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=john.ogness@linutronix.de \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=pmladek@suse.com \
--cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.