stable-rt.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rt: printk: create bogus deferred print functions
@ 2023-05-23 23:01 Luis Claudio R. Goncalves
  2023-05-25  2:14 ` rt: printk: create bogus deferred print functions (V2) Luis Claudio R. Goncalves
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Claudio R. Goncalves @ 2023-05-23 23:01 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, Steven Rostedt, stable-rt

Hello,

While working on v5.10.180-rt I stumbled over two commits from stable that
were related to deferred printing. That broke the kernel-rt builds for
v5.10-rt. I added the workaround below to the v5.10-rt-next[1] branch that
I pushed to kernelci.

My question is whether I should use the workaround or something like
what Clark did in v5.15-rt:

    449f5e1c4ddef Revert "printk: remove deferred printing"

Which brings back all of deferred printing. I do hope, for my sanity, that
the answer is "workaround", but whatever you suggest is good for me :)

[1] https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git/commit/?h=v5.10-rt-next&id=c14d0593588daa7d53f66bf1e787f982daf8cc98


Best, Luis


===

commit c14d0593588daa7d53f66bf1e787f982daf8cc98
Author: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Date:   Tue May 23 19:17:23 2023 -0300

    rt: printk: create bogus deferred print functions
    
    Since v5.10-rc1-rt1 we carry this change:
    
        commit 9153e3c5cb0c96242fa85ab151b9b29647634c9a
        Author: John Ogness <john.ogness@linutronix.de>
        Date:   Mon Oct 19 22:53:30 2020 +0206
    
            printk: remove deferred printing
    
            Since printing occurs either atomically or from the printing
            kthread, there is no need for any deferring or tracking possible
            recursion paths. Remove all printk context tracking.
    
    But with the recent v5.10.180 stable update these two commits were added:
    
        32232bcd4e530 printk: declare printk_deferred_{enter,safe}() in include/linux/printk.h
        a992c387b4118 mm/page_alloc: fix potential deadlock on zonelist_update_seq seqlock
    
    And they break the kernel-rt builds because they depend on the nonexistent
    __printk_safe_enter() and __printk_safe_exit() pair of functions.
    
    In order to work around that problem, while minimizing the code delta, make
    the two related functions, printk_deferred_enter() and printk_deferred_exit()
    into no-ops.
    
    Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>

diff --git a/include/linux/printk.h b/include/linux/printk.h
index 83c7734e98025..92e0656841128 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -609,7 +609,7 @@ 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
+#if defined(CONFIG_PRINTK) && !defined(CONFIG_PREEMPT_RT)
 extern void __printk_safe_enter(void);
 extern void __printk_safe_exit(void);
 /*
@@ -619,7 +619,7 @@ extern void __printk_safe_exit(void);
  */
 #define printk_deferred_enter __printk_safe_enter
 #define printk_deferred_exit __printk_safe_exit
-#else
+#else /* defined(CONFIG_PRINTK) && !defined(CONFIG_PREEMPT_RT) */
 static inline void printk_deferred_enter(void)
 {
 }


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: rt: printk: create bogus deferred print functions (V2)
  2023-05-23 23:01 rt: printk: create bogus deferred print functions Luis Claudio R. Goncalves
@ 2023-05-25  2:14 ` Luis Claudio R. Goncalves
  2023-06-06  9:53   ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Claudio R. Goncalves @ 2023-05-25  2:14 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, Steven Rostedt, stable-rt

On Tue, May 23, 2023 at 08:01:39PM -0300, Luis Claudio R. Goncalves wrote:
> Hello,
> 
> While working on v5.10.180-rt I stumbled over two commits from stable that
> were related to deferred printing. That broke the kernel-rt builds for
> v5.10-rt. I added the workaround below to the v5.10-rt-next[1] branch that
> I pushed to kernelci.
> 
> My question is whether I should use the workaround or something like
> what Clark did in v5.15-rt:
> 
>     449f5e1c4ddef Revert "printk: remove deferred printing"
> 
> Which brings back all of deferred printing. I do hope, for my sanity, that
> the answer is "workaround", but whatever you suggest is good for me :)

The original patch failed on aarch64. So I expanded the patch a bit and
changed description, making it an extension of the deferred printing
removal already in tree. The question remains the same. :)

================

rt: printk: remove new references to deferred printing

The support for deferred printing was removed in v5.10-rc1-rt1 by commit
9153e3c5cb0c9 ("printk: remove deferred printing") because:

        Since printing occurs either atomically or from the printing
        kthread, there is no need for any deferring or tracking possible
        recursion paths. Remove all printk context tracking.

But with the recent v5.10.180 stable update these two commits were added:

    32232bcd4e530 printk: declare printk_deferred_{enter,safe}() in include/linux/printk.h
    a992c387b4118 mm/page_alloc: fix potential deadlock on zonelist_update_seq seqlock

And they break the kernel-rt builds because they depend on the nonexistent
deferred printing __printk_safe_enter() and __printk_safe_exit() pair of
functions and their higher level companions printk_deferred_enter() and
printk_deferred_exit().

In order to work around this problem, remove the printk_deferred_*
calls from mm/page_alloc.c and force the empty definitions of these
functions if PREEMPT_RT is enabled.

Fixes: 9153e3c5cb0c9 ("printk: remove deferred printing")
Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
---

diff --git a/include/linux/printk.h b/include/linux/printk.h
index 83c7734e98025..92e0656841128 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -609,7 +609,7 @@ 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
+#if defined(CONFIG_PRINTK) && !defined(CONFIG_PREEMPT_RT)
 extern void __printk_safe_enter(void);
 extern void __printk_safe_exit(void);
 /*
@@ -619,7 +619,7 @@ extern void __printk_safe_exit(void);
  */
 #define printk_deferred_enter __printk_safe_enter
 #define printk_deferred_exit __printk_safe_exit
-#else
+#else /* defined(CONFIG_PRINTK) && !defined(CONFIG_PREEMPT_RT) */
 static inline void printk_deferred_enter(void)
 {
 }
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5f1c50a6bebc5..7e65e3ef16e3a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6057,7 +6057,6 @@ static void __build_all_zonelists(void *data)
 	 * tty_insert_flip_string_and_push_buffer() on other CPU might be
 	 * calling kmalloc(GFP_ATOMIC | __GFP_NOWARN) with port->lock held.
 	 */
-	printk_deferred_enter();
 	write_seqlock(&zonelist_update_seq);
 
 #ifdef CONFIG_NUMA
@@ -6092,7 +6091,6 @@ static void __build_all_zonelists(void *data)
 	}
 
 	write_sequnlock(&zonelist_update_seq);
-	printk_deferred_exit();
 	local_irq_restore(flags);
 }
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: rt: printk: create bogus deferred print functions (V2)
  2023-05-25  2:14 ` rt: printk: create bogus deferred print functions (V2) Luis Claudio R. Goncalves
@ 2023-06-06  9:53   ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2023-06-06  9:53 UTC (permalink / raw)
  To: Luis Claudio R. Goncalves, Clark Williams; +Cc: Steven Rostedt, stable-rt

On 2023-05-24 23:14:17 [-0300], Luis Claudio R. Goncalves wrote:
> > My question is whether I should use the workaround or something like
> > what Clark did in v5.15-rt:
> > 
> >     449f5e1c4ddef Revert "printk: remove deferred printing"
> > 
> > Which brings back all of deferred printing. I do hope, for my sanity, that
> > the answer is "workaround", but whatever you suggest is good for me :)
> 
> The original patch failed on aarch64. So I expanded the patch a bit and
> changed description, making it an extension of the deferred printing
> removal already in tree. The question remains the same. :)

I missed that this got reverted in the v5.15 tree. Please see what I
wrote to your release email. And this deferred thingy needs to go back
into v5.15.

Sebastian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-06  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23 23:01 rt: printk: create bogus deferred print functions Luis Claudio R. Goncalves
2023-05-25  2:14 ` rt: printk: create bogus deferred print functions (V2) Luis Claudio R. Goncalves
2023-06-06  9:53   ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).