diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2022-01-27 15:41:01 +0100 |
---|---|---|
committer | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2022-01-27 15:41:01 +0100 |
commit | 9383fbe3afce85b624e57990885ae0703c499ad1 (patch) | |
tree | 882664288e000eda4fb763ca4f57330699478304 | |
parent | dd833c21fde92e3318e3b43c3a239dc9d0a43a00 (diff) | |
download | linux-rt-9383fbe3afce85b624e57990885ae0703c499ad1.tar.gz |
[ANNOUNCE] v5.17-rc1-rt2v5.17-rc1-rt2-patches
Dear RT folks!
I'm pleased to announce the v5.17-rc1-rt2 patch set.
Changes since v5.17-rc1-rt1:
- Update the printk to the latest version. Patch by John Ogness.
Known issues
- netconsole triggers WARN.
- Valentin Schneider reported a few splats on ARM64, see
https://lkml.kernel.org/r/20210810134127.1394269-1-valentin.schneider@arm.com
The delta patch against v5.17-rc1-rt1 is appended below and can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.17/incr/patch-5.17-rc1-rt1-rt2.patch.xz
You can get this release via the git tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git v5.17-rc1-rt2
The RT patch against v5.17-rc1 can be found here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.17/older/patch-5.17-rc1-rt2.patch.xz
The split quilt queue is available at:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.17/older/patches-5.17-rc1-rt2.tar.xz
Sebastian
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
-rw-r--r-- | patches/0001-printk-rename-cpulock-functions.patch | 2 | ||||
-rw-r--r-- | patches/0002-printk-cpu-sync-always-disable-interrupts.patch | 2 | ||||
-rw-r--r-- | patches/0003-printk-use-percpu-flag-instead-of-cpu_online.patch | 2 | ||||
-rw-r--r-- | patches/0004-printk-get-caller_id-timestamp-after-migration-disab.patch | 2 | ||||
-rw-r--r-- | patches/0005-printk-call-boot_delay_msec-in-printk_delay.patch | 36 | ||||
-rw-r--r-- | patches/0006-printk-refactor-and-rework-printing-logic.patch (renamed from patches/0005-printk-refactor-and-rework-printing-logic.patch) | 56 | ||||
-rw-r--r-- | patches/0007-printk-move-buffer-definitions-into-console_emit_nex.patch (renamed from patches/0006-printk-move-buffer-definitions-into-console_emit_nex.patch) | 30 | ||||
-rw-r--r-- | patches/0008-printk-add-pr_flush.patch (renamed from patches/0007-printk-add-pr_flush.patch) | 14 | ||||
-rw-r--r-- | patches/0009-printk-add-kthread-console-printers.patch (renamed from patches/0008-printk-add-kthread-console-printers.patch) | 45 | ||||
-rw-r--r-- | patches/0010-printk-reimplement-console_lock-for-proper-kthread-s.patch (renamed from patches/0009-printk-reimplement-console_lock-for-proper-kthread-s.patch) | 95 | ||||
-rw-r--r-- | patches/0011-printk-remove-console_locked.patch (renamed from patches/0010-printk-remove-console_locked.patch) | 23 | ||||
-rw-r--r-- | patches/0012-console-introduce-CON_MIGHT_SLEEP-for-vt.patch (renamed from patches/0011-console-introduce-CON_MIGHT_SLEEP-for-vt.patch) | 4 | ||||
-rw-r--r-- | patches/0013-printk-add-infrastucture-for-atomic-consoles.patch (renamed from patches/0012-printk-add-infrastucture-for-atomic-consoles.patch) | 74 | ||||
-rw-r--r-- | patches/0014-serial-8250-implement-write_atomic.patch (renamed from patches/0013-serial-8250-implement-write_atomic.patch) | 2 | ||||
-rw-r--r-- | patches/0015-printk-avoid-preempt_disable-for-PREEMPT_RT.patch (renamed from patches/0014-printk-avoid-preempt_disable-for-PREEMPT_RT.patch) | 6 | ||||
-rw-r--r-- | patches/Add_localversion_for_-RT_release.patch | 2 | ||||
-rw-r--r-- | patches/series | 21 |
17 files changed, 250 insertions, 166 deletions
diff --git a/patches/0001-printk-rename-cpulock-functions.patch b/patches/0001-printk-rename-cpulock-functions.patch index 4bd440979c6e..dd16def21bda 100644 --- a/patches/0001-printk-rename-cpulock-functions.patch +++ b/patches/0001-printk-rename-cpulock-functions.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Tue, 28 Sep 2021 11:27:02 +0206 -Subject: [PATCH 01/14] printk: rename cpulock functions +Subject: [PATCH 01/15] printk: rename cpulock functions Since the printk cpulock is CPU-reentrant and since it is used in all contexts, its usage must be carefully considered and diff --git a/patches/0002-printk-cpu-sync-always-disable-interrupts.patch b/patches/0002-printk-cpu-sync-always-disable-interrupts.patch index 0499f8e5ff54..ac4fdc6c1ac5 100644 --- a/patches/0002-printk-cpu-sync-always-disable-interrupts.patch +++ b/patches/0002-printk-cpu-sync-always-disable-interrupts.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Tue, 3 Aug 2021 13:00:00 +0206 -Subject: [PATCH 02/14] printk: cpu sync always disable interrupts +Subject: [PATCH 02/15] printk: cpu sync always disable interrupts The CPU sync functions are a NOP for !CONFIG_SMP. But for !CONFIG_SMP they still need to disable interrupts in order to diff --git a/patches/0003-printk-use-percpu-flag-instead-of-cpu_online.patch b/patches/0003-printk-use-percpu-flag-instead-of-cpu_online.patch index 98c318bca765..6916cbda34f0 100644 --- a/patches/0003-printk-use-percpu-flag-instead-of-cpu_online.patch +++ b/patches/0003-printk-use-percpu-flag-instead-of-cpu_online.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Wed, 10 Nov 2021 17:19:25 +0106 -Subject: [PATCH 03/14] printk: use percpu flag instead of cpu_online() +Subject: [PATCH 03/15] printk: use percpu flag instead of cpu_online() The CON_ANYTIME console flag is used to label consoles that will work correctly before percpu resources are allocated. To check diff --git a/patches/0004-printk-get-caller_id-timestamp-after-migration-disab.patch b/patches/0004-printk-get-caller_id-timestamp-after-migration-disab.patch index 2e9db39cab76..784039a646fb 100644 --- a/patches/0004-printk-get-caller_id-timestamp-after-migration-disab.patch +++ b/patches/0004-printk-get-caller_id-timestamp-after-migration-disab.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Wed, 10 Nov 2021 17:26:21 +0106 -Subject: [PATCH 04/14] printk: get caller_id/timestamp after migration disable +Subject: [PATCH 04/15] printk: get caller_id/timestamp after migration disable Currently the local CPU timestamp and caller_id for the record are collected while migration is enabled. Since this information is diff --git a/patches/0005-printk-call-boot_delay_msec-in-printk_delay.patch b/patches/0005-printk-call-boot_delay_msec-in-printk_delay.patch new file mode 100644 index 000000000000..1502e7b8a998 --- /dev/null +++ b/patches/0005-printk-call-boot_delay_msec-in-printk_delay.patch @@ -0,0 +1,36 @@ +From: John Ogness <john.ogness@linutronix.de> +Date: Mon, 30 Nov 2020 01:42:04 +0106 +Subject: [PATCH 05/15] printk: call boot_delay_msec() in printk_delay() + +boot_delay_msec() is always called immediately before printk_delay() +so just call it from within printk_delay(). + +Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +--- + kernel/printk/printk.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/kernel/printk/printk.c ++++ b/kernel/printk/printk.c +@@ -2003,8 +2003,10 @@ static u8 *__printk_recursion_counter(vo + + int printk_delay_msec __read_mostly; + +-static inline void printk_delay(void) ++static inline void printk_delay(int level) + { ++ boot_delay_msec(level); ++ + if (unlikely(printk_delay_msec)) { + int m = printk_delay_msec; + +@@ -2225,8 +2227,7 @@ asmlinkage int vprintk_emit(int facility + in_sched = true; + } + +- boot_delay_msec(level); +- printk_delay(); ++ printk_delay(level); + + printed_len = vprintk_store(facility, level, dev_info, fmt, args); + diff --git a/patches/0005-printk-refactor-and-rework-printing-logic.patch b/patches/0006-printk-refactor-and-rework-printing-logic.patch index 5cc54477ded0..af9f6e544b85 100644 --- a/patches/0005-printk-refactor-and-rework-printing-logic.patch +++ b/patches/0006-printk-refactor-and-rework-printing-logic.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Tue, 10 Aug 2021 16:32:52 +0206 -Subject: [PATCH 05/14] printk: refactor and rework printing logic +Subject: [PATCH 06/15] printk: refactor and rework printing logic Refactor/rework printing logic in order to prepare for moving to threaded console printing. @@ -12,7 +12,7 @@ console printing. of each console can be tracked individually. - Modify printing logic so that each console independently loads, prepares, - and prints its next record. + prints, and delays its next record. - Remove exclusive_console logic. Since console positions are handled independently, replaying past records occurs naturally. @@ -21,8 +21,8 @@ Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- include/linux/console.h | 2 - kernel/printk/printk.c | 382 ++++++++++++++++++++++++------------------------ - 2 files changed, 196 insertions(+), 188 deletions(-) + kernel/printk/printk.c | 388 ++++++++++++++++++++++++------------------------ + 2 files changed, 198 insertions(+), 192 deletions(-) --- a/include/linux/console.h +++ b/include/linux/console.h @@ -120,17 +120,16 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } /* -@@ -2225,9 +2193,6 @@ asmlinkage int vprintk_emit(int facility +@@ -2227,8 +2195,6 @@ asmlinkage int vprintk_emit(int facility in_sched = true; } -- boot_delay_msec(level); -- printk_delay(); +- printk_delay(level); - printed_len = vprintk_store(facility, level, dev_info, fmt, args); /* If called from the scheduler, we can not call up(). */ -@@ -2279,11 +2244,9 @@ EXPORT_SYMBOL(_printk); +@@ -2280,11 +2246,9 @@ EXPORT_SYMBOL(_printk); #define prb_read_valid(rb, seq, r) false #define prb_first_valid_seq(rb) 0 @@ -143,7 +142,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> static size_t record_print_text(const struct printk_record *r, bool syslog, bool time) -@@ -2300,9 +2263,10 @@ static ssize_t msg_print_ext_body(char * +@@ -2301,9 +2265,9 @@ static ssize_t msg_print_ext_body(char * struct dev_printk_info *dev_info) { return 0; } static void console_lock_spinning_enable(void) { } static int console_lock_spinning_disable_and_check(void) { return 0; } @@ -151,12 +150,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> - const char *text, size_t len) {} +static void call_console_driver(struct console *con, const char *text, size_t len) {} static bool suppress_message_printing(int level) { return false; } -+static inline void boot_delay_msec(int level) { } -+static inline void printk_delay(void) { } ++static void printk_delay(int level) {} #endif /* CONFIG_PRINTK */ -@@ -2560,31 +2524,166 @@ int is_console_locked(void) +@@ -2561,31 +2525,167 @@ int is_console_locked(void) EXPORT_SYMBOL(is_console_locked); /* @@ -207,16 +205,16 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> + * record is the next available record for the given console. + * + * Requires the console_lock. -+ * -+ * Returns false if the given console has no next record to print, otherwise -+ * true. * - * Console drivers may assume that per-cpu resources have been allocated. So - * unless they're explicitly marked as being able to cope (CON_ANYTIME) don't - * call them until per-cpu resources have been allocated. ++ * Returns false if the given console has no next record to print, otherwise ++ * true. ++ * + * @handover will be set to true if a printk waiter has taken over the + * console_lock, in which case the caller is no longer holding the -+ * console_lock. ++ * console_lock. Otherwise it is set to false. */ -static inline int can_use_console(void) +static bool console_emit_next_record(struct console *con, bool *handover) @@ -232,6 +230,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> + + prb_rec_init_rd(&r, &info, text, sizeof(text)); + ++ *handover = false; ++ + if (!prb_read_valid(prb, con->seq, &r)) + return false; + @@ -278,8 +278,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> + *handover = console_lock_spinning_disable_and_check(); + printk_safe_exit_irqrestore(flags); + -+ boot_delay_msec(r.info->level); -+ printk_delay(); ++ printk_delay(r.info->level); +skip: + return true; +} @@ -296,7 +295,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> + * + * @handover will be set to true if a printk waiter has taken over the + * console_lock, in which case the caller is no longer holding the -+ * console_lock. ++ * console_lock. Otherwise it is set to false. + */ +static bool console_flush_all(bool do_cond_resched, u64 *next_seq, bool *handover) +{ @@ -338,7 +337,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } /** -@@ -2603,21 +2702,16 @@ static inline int can_use_console(void) +@@ -2604,21 +2704,16 @@ static inline int can_use_console(void) */ void console_unlock(void) { @@ -364,8 +363,17 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* * Console drivers are called with interrupts disabled, so * @console_may_schedule should be cleared before; however, we may -@@ -2633,110 +2727,27 @@ void console_unlock(void) - * and cleared after the "again" goto label. +@@ -2627,117 +2722,31 @@ void console_unlock(void) + * between lines if allowable. Not doing so can cause a very long + * scheduling stall on a slow console leading to RCU stall and + * softlockup warnings which exacerbate the issue with more +- * messages practically incapacitating the system. +- * +- * console_trylock() is not able to detect the preemptive +- * context reliably. Therefore the value must be stored before +- * and cleared after the "again" goto label. ++ * messages practically incapacitating the system. Therefore, create ++ * a local to use for the printing loop. */ do_cond_resched = console_may_schedule; -again: @@ -488,7 +496,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } EXPORT_SYMBOL(console_unlock); -@@ -2796,8 +2807,14 @@ void console_flush_on_panic(enum con_flu +@@ -2797,8 +2806,14 @@ void console_flush_on_panic(enum con_flu console_trylock(); console_may_schedule = 0; @@ -505,7 +513,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> console_unlock(); } -@@ -3032,26 +3049,15 @@ void register_console(struct console *ne +@@ -3033,26 +3048,15 @@ void register_console(struct console *ne if (newcon->flags & CON_EXTENDED) nr_ext_console_drivers++; diff --git a/patches/0006-printk-move-buffer-definitions-into-console_emit_nex.patch b/patches/0007-printk-move-buffer-definitions-into-console_emit_nex.patch index 59754bf3f0a3..74b33b24834a 100644 --- a/patches/0006-printk-move-buffer-definitions-into-console_emit_nex.patch +++ b/patches/0007-printk-move-buffer-definitions-into-console_emit_nex.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Mon, 22 Nov 2021 17:04:02 +0106 -Subject: [PATCH 06/14] printk: move buffer definitions into +Subject: [PATCH 07/15] printk: move buffer definitions into console_emit_next_record() caller Extended consoles print extended messages and do not print messages about @@ -65,7 +65,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> "** %lu printk messages dropped **\n", con->dropped); con->dropped = 0; -@@ -2240,6 +2243,7 @@ EXPORT_SYMBOL(_printk); +@@ -2242,6 +2245,7 @@ EXPORT_SYMBOL(_printk); #else /* CONFIG_PRINTK */ #define CONSOLE_LOG_MAX 0 @@ -73,17 +73,17 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> #define printk_time false #define prb_read_valid(rb, seq, r) false -@@ -2263,7 +2267,8 @@ static ssize_t msg_print_ext_body(char * +@@ -2265,7 +2269,8 @@ static ssize_t msg_print_ext_body(char * struct dev_printk_info *dev_info) { return 0; } static void console_lock_spinning_enable(void) { } static int console_lock_spinning_disable_and_check(void) { return 0; } -static void call_console_driver(struct console *con, const char *text, size_t len) {} +static void call_console_driver(struct console *con, const char *text, size_t len, -+ char *dropped_text) { } ++ char *dropped_text) {} static bool suppress_message_printing(int level) { return false; } - static inline void boot_delay_msec(int level) { } - static inline void printk_delay(void) { } -@@ -2560,6 +2565,14 @@ static void __console_unlock(void) + static void printk_delay(int level) {} + +@@ -2561,6 +2566,14 @@ static void __console_unlock(void) * Print one record for the given console. The record printed is whatever * record is the next available record for the given console. * @@ -98,9 +98,9 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> * Requires the console_lock. * * Returns false if the given console has no next record to print, otherwise -@@ -2569,17 +2582,16 @@ static void __console_unlock(void) +@@ -2570,17 +2583,16 @@ static void __console_unlock(void) * console_lock, in which case the caller is no longer holding the - * console_lock. + * console_lock. Otherwise it is set to false. */ -static bool console_emit_next_record(struct console *con, bool *handover) +static bool console_emit_next_record(struct console *con, char *text, char *ext_text, @@ -117,9 +117,9 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> - prb_rec_init_rd(&r, &info, text, sizeof(text)); + prb_rec_init_rd(&r, &info, text, CONSOLE_LOG_MAX); - if (!prb_read_valid(prb, con->seq, &r)) - return false; -@@ -2595,13 +2607,13 @@ static bool console_emit_next_record(str + *handover = false; + +@@ -2598,13 +2610,13 @@ static bool console_emit_next_record(str goto skip; } @@ -138,7 +138,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> len = record_print_text(&r, console_msg_format & MSG_FORMAT_SYSLOG, printk_time); } -@@ -2619,7 +2631,7 @@ static bool console_emit_next_record(str +@@ -2622,7 +2634,7 @@ static bool console_emit_next_record(str console_lock_spinning_enable(); stop_critical_timings(); /* don't trace print latency */ @@ -147,7 +147,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> start_critical_timings(); con->seq++; -@@ -2649,6 +2661,9 @@ static bool console_emit_next_record(str +@@ -2651,6 +2663,9 @@ static bool console_emit_next_record(str */ static bool console_flush_all(bool do_cond_resched, u64 *next_seq, bool *handover) { @@ -157,7 +157,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> bool any_usable = false; struct console *con; bool any_progress; -@@ -2666,7 +2681,16 @@ static bool console_flush_all(bool do_co +@@ -2668,7 +2683,16 @@ static bool console_flush_all(bool do_co continue; any_usable = true; diff --git a/patches/0007-printk-add-pr_flush.patch b/patches/0008-printk-add-pr_flush.patch index a7d722f795f9..972bb9ae69b0 100644 --- a/patches/0007-printk-add-pr_flush.patch +++ b/patches/0008-printk-add-pr_flush.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Wed, 15 Dec 2021 18:44:59 +0106 -Subject: [PATCH 07/14] printk: add pr_flush() +Subject: [PATCH 08/15] printk: add pr_flush() Provide a might-sleep function to allow waiting for threaded console printers to catch up to the latest logged message. @@ -41,7 +41,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> return 0; --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c -@@ -2447,6 +2447,7 @@ void suspend_console(void) +@@ -2448,6 +2448,7 @@ void suspend_console(void) if (!console_suspend_enabled) return; pr_info("Suspending console(s) (use no_console_suspend to debug)\n"); @@ -49,7 +49,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> console_lock(); console_suspended = 1; up_console_sem(); -@@ -2459,6 +2460,7 @@ void resume_console(void) +@@ -2460,6 +2461,7 @@ void resume_console(void) down_console_sem(); console_suspended = 0; console_unlock(); @@ -57,7 +57,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } /** -@@ -2802,8 +2804,10 @@ void console_unblank(void) +@@ -2801,8 +2803,10 @@ void console_unblank(void) if (oops_in_progress) { if (down_trylock_console_sem() != 0) return; @@ -69,7 +69,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> console_locked = 1; console_may_schedule = 0; -@@ -2869,6 +2873,7 @@ struct tty_driver *console_device(int *i +@@ -2868,6 +2872,7 @@ struct tty_driver *console_device(int *i */ void console_stop(struct console *console) { @@ -77,7 +77,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> console_lock(); console->flags &= ~CON_ENABLED; console_unlock(); -@@ -2880,6 +2885,7 @@ void console_start(struct console *conso +@@ -2879,6 +2884,7 @@ void console_start(struct console *conso console_lock(); console->flags |= CON_ENABLED; console_unlock(); @@ -85,7 +85,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } EXPORT_SYMBOL(console_start); -@@ -3250,6 +3256,71 @@ static int __init printk_late_init(void) +@@ -3249,6 +3255,71 @@ static int __init printk_late_init(void) late_initcall(printk_late_init); #if defined CONFIG_PRINTK diff --git a/patches/0008-printk-add-kthread-console-printers.patch b/patches/0009-printk-add-kthread-console-printers.patch index ba45990d509b..1fb69d5c3dd4 100644 --- a/patches/0008-printk-add-kthread-console-printers.patch +++ b/patches/0009-printk-add-kthread-console-printers.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Mon, 13 Dec 2021 21:22:17 +0106 -Subject: [PATCH 08/14] printk: add kthread console printers +Subject: [PATCH 09/15] printk: add kthread console printers Create a kthread for each console to perform console printing. During normal operation (@system_state == SYSTEM_RUNNING), the kthread @@ -14,18 +14,12 @@ by the printk caller. Console printers synchronize against each other and against console lockers by taking the console lock for each message that is printed. -NOTE: The kthread printers do not disable preemption while holding - the console lock. This introduces a regression that was - previously fixed with commit fd5f7cde1b85 ("printk: Never set - console_may_schedule in console_trylock()"). A follow-up - commit will correct this. - Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- include/linux/console.h | 2 - kernel/printk/printk.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++- - 2 files changed, 156 insertions(+), 2 deletions(-) + kernel/printk/printk.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 157 insertions(+), 2 deletions(-) --- a/include/linux/console.h +++ b/include/linux/console.h @@ -61,7 +55,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> #ifdef CONFIG_PRINTK DECLARE_WAIT_QUEUE_HEAD(log_wait); /* All 3 protected by @syslog_lock. */ -@@ -2199,7 +2213,7 @@ asmlinkage int vprintk_emit(int facility +@@ -2201,7 +2215,7 @@ asmlinkage int vprintk_emit(int facility printed_len = vprintk_store(facility, level, dev_info, fmt, args); /* If called from the scheduler, we can not call up(). */ @@ -70,7 +64,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* * Disable preemption to avoid being preempted while holding * console_sem which would prevent anyone from printing to -@@ -2240,6 +2254,8 @@ asmlinkage __visible int _printk(const c +@@ -2242,6 +2256,8 @@ asmlinkage __visible int _printk(const c } EXPORT_SYMBOL(_printk); @@ -79,15 +73,15 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> #else /* CONFIG_PRINTK */ #define CONSOLE_LOG_MAX 0 -@@ -2270,6 +2286,7 @@ static int console_lock_spinning_disable - static void call_console_driver(struct console *con, const char *text, size_t len, - char *dropped_text) { } +@@ -2273,6 +2289,7 @@ static void call_console_driver(struct c + char *dropped_text) {} static bool suppress_message_printing(int level) { return false; } -+static void start_printk_kthread(struct console *con) { } - static inline void boot_delay_msec(int level) { } - static inline void printk_delay(void) { } + static void printk_delay(int level) {} ++static void start_printk_kthread(struct console *con) {} + + #endif /* CONFIG_PRINTK */ -@@ -2460,6 +2477,10 @@ void resume_console(void) +@@ -2461,6 +2478,10 @@ void resume_console(void) down_console_sem(); console_suspended = 0; console_unlock(); @@ -98,7 +92,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> pr_flush(1000, true); } -@@ -2674,6 +2695,10 @@ static bool console_flush_all(bool do_co +@@ -2676,6 +2697,10 @@ static bool console_flush_all(bool do_co *handover = false; do { @@ -109,7 +103,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> any_progress = false; for_each_console(con) { -@@ -2885,6 +2910,10 @@ void console_start(struct console *conso +@@ -2884,6 +2909,10 @@ void console_start(struct console *conso console_lock(); console->flags |= CON_ENABLED; console_unlock(); @@ -120,7 +114,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> pr_flush(1000, true); } EXPORT_SYMBOL(console_start); -@@ -3089,6 +3118,8 @@ void register_console(struct console *ne +@@ -3088,6 +3117,8 @@ void register_console(struct console *ne /* Begin with next message. */ newcon->seq = prb_next_seq(prb); } @@ -129,7 +123,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> console_unlock(); console_sysfs_notify(); -@@ -3145,6 +3176,11 @@ int unregister_console(struct console *c +@@ -3144,6 +3175,11 @@ int unregister_console(struct console *c } } @@ -141,7 +135,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> if (res) goto out_disable_unlock; -@@ -3251,6 +3287,12 @@ static int __init printk_late_init(void) +@@ -3250,6 +3286,13 @@ static int __init printk_late_init(void) console_cpu_notify, NULL); WARN_ON(ret < 0); printk_sysctl_init(); @@ -151,10 +145,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> + start_printk_kthread(con); + kthreads_started = true; + console_unlock(); ++ return 0; } late_initcall(printk_late_init); -@@ -3321,6 +3363,116 @@ bool pr_flush(int timeout_ms, bool reset +@@ -3320,6 +3363,116 @@ bool pr_flush(int timeout_ms, bool reset } EXPORT_SYMBOL(pr_flush); @@ -271,7 +266,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* * Delayed printk version, for scheduler-internal messages: */ -@@ -3340,7 +3492,7 @@ static void wake_up_klogd_work_func(stru +@@ -3339,7 +3492,7 @@ static void wake_up_klogd_work_func(stru } if (pending & PRINTK_PENDING_WAKEUP) diff --git a/patches/0009-printk-reimplement-console_lock-for-proper-kthread-s.patch b/patches/0010-printk-reimplement-console_lock-for-proper-kthread-s.patch index 1d35549c4524..71809f6aece9 100644 --- a/patches/0009-printk-reimplement-console_lock-for-proper-kthread-s.patch +++ b/patches/0010-printk-reimplement-console_lock-for-proper-kthread-s.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Mon, 13 Dec 2021 21:24:23 +0106 -Subject: [PATCH 09/14] printk: reimplement console_lock for proper kthread +Subject: [PATCH 10/15] printk: reimplement console_lock for proper kthread support With non-threaded console printers preemption is disabled while @@ -79,12 +79,17 @@ console_trylock(). This is for 2 reasons: 2. The kthread printers no longer acquire the console lock, so it is not possible to handover the console lock. +This also has implications for console_unlock(), which attempts a +console_trylock() before returning. Introduce +console_trylock_sched() to allow console_unlock() to specify if it +is in a sleepable context. + Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- - include/linux/console.h | 15 ++++ - kernel/printk/printk.c | 162 +++++++++++++++++++++++++++++++++++++----------- - 2 files changed, 140 insertions(+), 37 deletions(-) + include/linux/console.h | 15 +++ + kernel/printk/printk.c | 190 ++++++++++++++++++++++++++++++++++++++---------- + 2 files changed, 166 insertions(+), 39 deletions(-) --- a/include/linux/console.h +++ b/include/linux/console.h @@ -191,7 +196,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> * This is used for debugging the mess that is the VT code by * keeping track if we have the console semaphore held. It's * definitely not the perfect debug tool (we don't know if _WE_ -@@ -2477,10 +2528,6 @@ void resume_console(void) +@@ -2478,10 +2529,6 @@ void resume_console(void) down_console_sem(); console_suspended = 0; console_unlock(); @@ -202,7 +207,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> pr_flush(1000, true); } -@@ -2518,6 +2565,7 @@ void console_lock(void) +@@ -2519,6 +2566,7 @@ void console_lock(void) down_console_sem(); if (console_suspended) return; @@ -210,7 +215,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> console_locked = 1; console_may_schedule = 1; } -@@ -2539,6 +2587,10 @@ int console_trylock(void) +@@ -2540,15 +2588,45 @@ int console_trylock(void) up_console_sem(); return 0; } @@ -221,8 +226,35 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> console_locked = 1; console_may_schedule = 0; return 1; -@@ -2547,7 +2599,7 @@ EXPORT_SYMBOL(console_trylock); + } + EXPORT_SYMBOL(console_trylock); ++/* ++ * A variant of console_trylock() that allows specifying if the context may ++ * sleep. If yes, a trylock on @console_sem is attempted and if successful, ++ * the threaded printers are paused. This is important to ensure that ++ * sleepable contexts do not become involved in console_lock handovers and ++ * will call cond_resched() during the printing loop. ++ */ ++static int console_trylock_sched(bool may_schedule) ++{ ++ if (!may_schedule) ++ return console_trylock(); ++ ++ might_sleep(); ++ ++ if (down_trylock_console_sem()) ++ return 0; ++ if (console_suspended) { ++ up_console_sem(); ++ return 0; ++ } ++ pause_all_consoles(); ++ console_locked = 1; ++ console_may_schedule = 1; ++ return 1; ++} ++ int is_console_locked(void) { - return console_locked; @@ -230,7 +262,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } EXPORT_SYMBOL(is_console_locked); -@@ -2581,6 +2633,19 @@ static inline bool console_is_usable(str +@@ -2582,6 +2660,19 @@ static inline bool console_is_usable(str static void __console_unlock(void) { console_locked = 0; @@ -250,17 +282,17 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> up_console_sem(); } -@@ -2603,7 +2668,8 @@ static void __console_unlock(void) +@@ -2604,7 +2695,8 @@ static void __console_unlock(void) * * @handover will be set to true if a printk waiter has taken over the * console_lock, in which case the caller is no longer holding the -- * console_lock. -+ * console_lock. A NULL pointer may be provided to disable allowing -+ * the console_lock to be taken over by a printk waiter. +- * console_lock. Otherwise it is set to false. ++ * console_lock. Otherwise it is set to false. A NULL pointer may be provided ++ * to disable allowing the console_lock to be taken over by a printk waiter. */ static bool console_emit_next_record(struct console *con, char *text, char *ext_text, char *dropped_text, bool *handover) -@@ -2611,11 +2677,15 @@ static bool console_emit_next_record(str +@@ -2612,12 +2704,14 @@ static bool console_emit_next_record(str struct printk_info info; struct printk_record r; unsigned long flags; @@ -270,13 +302,13 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> prb_rec_init_rd(&r, &info, text, CONSOLE_LOG_MAX); +- *handover = false; + if (handover) + *handover = false; -+ + if (!prb_read_valid(prb, con->seq, &r)) return false; - -@@ -2640,18 +2710,23 @@ static bool console_emit_next_record(str +@@ -2643,18 +2737,23 @@ static bool console_emit_next_record(str len = record_print_text(&r, console_msg_format & MSG_FORMAT_SYSLOG, printk_time); } @@ -312,7 +344,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> stop_critical_timings(); /* don't trace print latency */ call_console_driver(con, write_text, len, dropped_text); -@@ -2659,8 +2734,10 @@ static bool console_emit_next_record(str +@@ -2662,8 +2761,10 @@ static bool console_emit_next_record(str con->seq++; @@ -323,9 +355,18 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> + printk_safe_exit_irqrestore(flags); + } - boot_delay_msec(r.info->level); - printk_delay(); -@@ -2829,6 +2906,10 @@ void console_unblank(void) + printk_delay(r.info->level); + skip: +@@ -2797,7 +2898,7 @@ void console_unlock(void) + * Re-check if there is a new record to flush. If the trylock + * fails, another context is already handling the printing. + */ +- } while (prb_read_valid(prb, next_seq, NULL) && console_trylock()); ++ } while (prb_read_valid(prb, next_seq, NULL) && console_trylock_sched(do_cond_resched)); + } + EXPORT_SYMBOL(console_unlock); + +@@ -2828,6 +2929,10 @@ void console_unblank(void) if (oops_in_progress) { if (down_trylock_console_sem() != 0) return; @@ -336,7 +377,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } else { pr_flush(1000, true); console_lock(); -@@ -2910,10 +2991,6 @@ void console_start(struct console *conso +@@ -2909,10 +3014,6 @@ void console_start(struct console *conso console_lock(); console->flags |= CON_ENABLED; console_unlock(); @@ -347,7 +388,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> pr_flush(1000, true); } EXPORT_SYMBOL(console_start); -@@ -3108,7 +3185,11 @@ void register_console(struct console *ne +@@ -3107,7 +3208,11 @@ void register_console(struct console *ne if (newcon->flags & CON_EXTENDED) nr_ext_console_drivers++; @@ -359,7 +400,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> if (newcon->flags & CON_PRINTBUFFER) { /* Get a consistent copy of @syslog_seq. */ mutex_lock(&syslog_lock); -@@ -3370,16 +3451,17 @@ static bool printer_should_wake(struct c +@@ -3370,16 +3475,17 @@ static bool printer_should_wake(struct c if (kthread_should_stop()) return true; @@ -381,7 +422,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> return prb_read_valid(prb, seq, NULL); } -@@ -3390,7 +3472,6 @@ static int printk_kthread_func(void *dat +@@ -3390,7 +3496,6 @@ static int printk_kthread_func(void *dat char *dropped_text = NULL; char *ext_text = NULL; bool progress; @@ -389,7 +430,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> u64 seq = 0; char *text; int error; -@@ -3423,9 +3504,17 @@ static int printk_kthread_func(void *dat +@@ -3423,9 +3528,17 @@ static int printk_kthread_func(void *dat continue; do { @@ -410,7 +451,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> break; } -@@ -3439,14 +3528,13 @@ static int printk_kthread_func(void *dat +@@ -3439,14 +3552,13 @@ static int printk_kthread_func(void *dat */ console_may_schedule = 0; progress = console_emit_next_record(con, text, ext_text, diff --git a/patches/0010-printk-remove-console_locked.patch b/patches/0011-printk-remove-console_locked.patch index 6335bcf2c921..bc829e47705a 100644 --- a/patches/0010-printk-remove-console_locked.patch +++ b/patches/0011-printk-remove-console_locked.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Fri, 17 Dec 2021 12:29:13 +0106 -Subject: [PATCH 10/14] printk: remove @console_locked +Subject: [PATCH 11/15] printk: remove @console_locked The static global variable @console_locked is used to help debug VT code to make sure that certain code paths are running with the @@ -15,8 +15,8 @@ alternative variables. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- - kernel/printk/printk.c | 29 ++++++++++++++--------------- - 1 file changed, 14 insertions(+), 15 deletions(-) + kernel/printk/printk.c | 30 ++++++++++++++---------------- + 1 file changed, 14 insertions(+), 16 deletions(-) --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -37,7 +37,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* * Array of consoles built from command line options (console=) -@@ -2566,7 +2558,6 @@ void console_lock(void) +@@ -2567,7 +2559,6 @@ void console_lock(void) if (console_suspended) return; pause_all_consoles(); @@ -45,7 +45,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> console_may_schedule = 1; } EXPORT_SYMBOL(console_lock); -@@ -2591,15 +2582,26 @@ int console_trylock(void) +@@ -2592,7 +2583,6 @@ int console_trylock(void) up_console_sem(); return 0; } @@ -53,7 +53,14 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> console_may_schedule = 0; return 1; } - EXPORT_SYMBOL(console_trylock); +@@ -2619,14 +2609,25 @@ static int console_trylock_sched(bool ma + return 0; + } + pause_all_consoles(); +- console_locked = 1; + console_may_schedule = 1; + return 1; + } +/* + * This is used to help to make sure that certain paths within the VT code are @@ -74,7 +81,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } EXPORT_SYMBOL(is_console_locked); -@@ -2632,8 +2634,6 @@ static inline bool console_is_usable(str +@@ -2659,8 +2660,6 @@ static inline bool console_is_usable(str static void __console_unlock(void) { @@ -83,7 +90,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* * Depending on whether console_lock() or console_trylock() was used, * appropriately allow the kthread printers to continue. -@@ -2915,7 +2915,6 @@ void console_unblank(void) +@@ -2938,7 +2937,6 @@ void console_unblank(void) console_lock(); } diff --git a/patches/0011-console-introduce-CON_MIGHT_SLEEP-for-vt.patch b/patches/0012-console-introduce-CON_MIGHT_SLEEP-for-vt.patch index 6a93eb394fd9..4d6ec19a94c0 100644 --- a/patches/0011-console-introduce-CON_MIGHT_SLEEP-for-vt.patch +++ b/patches/0012-console-introduce-CON_MIGHT_SLEEP-for-vt.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Thu, 16 Dec 2021 16:06:29 +0106 -Subject: [PATCH 11/14] console: introduce CON_MIGHT_SLEEP for vt +Subject: [PATCH 12/15] console: introduce CON_MIGHT_SLEEP for vt Deadlocks and the framebuffer console have been a recurring issue that is getting worse. Daniel Vetter suggested [0] that @@ -43,7 +43,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> char name[16]; --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c -@@ -2783,6 +2783,8 @@ static bool console_flush_all(bool do_co +@@ -2808,6 +2808,8 @@ static bool console_flush_all(bool do_co if (!console_is_usable(con)) continue; diff --git a/patches/0012-printk-add-infrastucture-for-atomic-consoles.patch b/patches/0013-printk-add-infrastucture-for-atomic-consoles.patch index 064863c1c7a1..b90c9d440f26 100644 --- a/patches/0012-printk-add-infrastucture-for-atomic-consoles.patch +++ b/patches/0013-printk-add-infrastucture-for-atomic-consoles.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Wed, 22 Dec 2021 13:44:40 +0106 -Subject: [PATCH 12/14] printk: add infrastucture for atomic consoles +Subject: [PATCH 13/15] printk: add infrastucture for atomic consoles Many times it is not possible to see the console output on panic because printing threads cannot be scheduled and/or the @@ -18,13 +18,9 @@ also select CONFIG_HAVE_ATOMIC_CONSOLE in order to enable the atomic console code within the printk subsystem. If atomic consoles are available, panic() will flush the kernel -log only to the atomic consoles (after kgdb but before busting -spinlocks). Afterwards, panic() will continue the same, -including attempting to flush the other (non-atomic) consoles. - -Note that busting spinlocks is now done after kgdb. Since kgdb -fakes oops_in_progress anyway, there should be no need to bust -spinlocks before. +log only to the atomic consoles (before busting spinlocks). +Afterwards, panic() will continue as before, which includes +attempting to flush the other (non-atomic) consoles. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> @@ -100,18 +96,18 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> va_start(args, fmt); len = vscnprintf(buf, sizeof(buf), fmt, args); va_end(args); -@@ -240,6 +239,11 @@ void panic(const char *fmt, ...) - */ - kgdb_panic(buf); +@@ -233,6 +232,11 @@ void panic(const char *fmt, ...) + dump_stack(); + #endif -+ /* Use atomic consoles to dump the kernel log. */ ++ /* If atomic consoles are available, flush the kernel log. */ + console_flush_on_panic(CONSOLE_ATOMIC_FLUSH_PENDING); + + bust_spinlocks(1); + /* - * If we have crashed and we have a crash kernel loaded let it handle - * everything else. + * If kgdb is enabled, give it a chance to run before we stop all + * the other CPUs or else we won't be able to debug processes left --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -44,6 +44,7 @@ @@ -159,7 +155,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } /* -@@ -2297,6 +2307,76 @@ asmlinkage __visible int _printk(const c +@@ -2299,6 +2309,76 @@ asmlinkage __visible int _printk(const c } EXPORT_SYMBOL(_printk); @@ -236,7 +232,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> static void start_printk_kthread(struct console *con); #else /* CONFIG_PRINTK */ -@@ -2309,6 +2389,8 @@ static void start_printk_kthread(struct +@@ -2311,6 +2391,8 @@ static void start_printk_kthread(struct #define prb_first_valid_seq(rb) 0 #define prb_next_seq(rb) 0 @@ -245,16 +241,16 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> static u64 syslog_seq; static size_t record_print_text(const struct printk_record *r, -@@ -2327,7 +2409,7 @@ static ssize_t msg_print_ext_body(char * +@@ -2329,7 +2411,7 @@ static ssize_t msg_print_ext_body(char * static void console_lock_spinning_enable(void) { } static int console_lock_spinning_disable_and_check(void) { return 0; } static void call_console_driver(struct console *con, const char *text, size_t len, -- char *dropped_text) { } -+ char *dropped_text, bool atomic_printing) { } +- char *dropped_text) {} ++ char *dropped_text, bool atomic_printing) {} static bool suppress_message_printing(int level) { return false; } - static void start_printk_kthread(struct console *con) { } - static inline void boot_delay_msec(int level) { } -@@ -2611,13 +2693,23 @@ EXPORT_SYMBOL(is_console_locked); + static void printk_delay(int level) {} + static void start_printk_kthread(struct console *con) {} +@@ -2637,13 +2719,23 @@ EXPORT_SYMBOL(is_console_locked); * * Requires the console_lock. */ @@ -280,7 +276,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* * Console drivers may assume that per-cpu resources have been -@@ -2649,6 +2741,66 @@ static void __console_unlock(void) +@@ -2675,6 +2767,66 @@ static void __console_unlock(void) up_console_sem(); } @@ -347,7 +343,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* * Print one record for the given console. The record printed is whatever * record is the next available record for the given console. -@@ -2661,6 +2813,8 @@ static void __console_unlock(void) +@@ -2687,6 +2839,8 @@ static void __console_unlock(void) * If dropped messages should be printed, @dropped_text is a buffer of size * DROPPED_TEXT_MAX. Otherise @dropped_text must be NULL. * @@ -356,8 +352,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> * Requires the console_lock. * * Returns false if the given console has no next record to print, otherwise -@@ -2672,7 +2826,8 @@ static void __console_unlock(void) - * the console_lock to be taken over by a printk waiter. +@@ -2698,7 +2852,8 @@ static void __console_unlock(void) + * to disable allowing the console_lock to be taken over by a printk waiter. */ static bool console_emit_next_record(struct console *con, char *text, char *ext_text, - char *dropped_text, bool *handover) @@ -366,7 +362,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> { struct printk_info info; struct printk_record r; -@@ -2680,23 +2835,27 @@ static bool console_emit_next_record(str +@@ -2706,23 +2861,27 @@ static bool console_emit_next_record(str bool allow_handover; char *write_text; size_t len; @@ -399,7 +395,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> goto skip; } -@@ -2729,10 +2888,10 @@ static bool console_emit_next_record(str +@@ -2755,10 +2914,10 @@ static bool console_emit_next_record(str } stop_critical_timings(); /* don't trace print latency */ @@ -412,7 +408,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> if (allow_handover) { *handover = console_lock_spinning_disable_and_check(); -@@ -2781,7 +2940,7 @@ static bool console_flush_all(bool do_co +@@ -2806,7 +2965,7 @@ static bool console_flush_all(bool do_co for_each_console(con) { bool progress; @@ -421,7 +417,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> continue; if ((con->flags & CON_MIGHT_SLEEP) && !do_cond_resched) continue; -@@ -2791,11 +2950,11 @@ static bool console_flush_all(bool do_co +@@ -2816,11 +2975,11 @@ static bool console_flush_all(bool do_co /* Extended consoles do not print "dropped messages". */ progress = console_emit_next_record(con, &text[0], &ext_text[0], NULL, @@ -435,7 +431,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } if (*handover) return true; -@@ -2816,6 +2975,67 @@ static bool console_flush_all(bool do_co +@@ -2841,6 +3000,67 @@ static bool console_flush_all(bool do_co return any_usable; } @@ -503,7 +499,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /** * console_unlock - unlock the console system * -@@ -2932,6 +3152,11 @@ void console_unblank(void) +@@ -2954,6 +3174,11 @@ void console_unblank(void) */ void console_flush_on_panic(enum con_flush_mode mode) { @@ -515,7 +511,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* * If someone else is holding the console lock, trylock will fail * and may_schedule may be set. Ignore and proceed to unlock so -@@ -2948,7 +3173,7 @@ void console_flush_on_panic(enum con_flu +@@ -2970,7 +3195,7 @@ void console_flush_on_panic(enum con_flu seq = prb_first_valid_seq(prb); for_each_console(c) @@ -524,7 +520,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } console_unlock(); } -@@ -3189,16 +3414,19 @@ void register_console(struct console *ne +@@ -3211,16 +3436,19 @@ void register_console(struct console *ne if (consoles_paused) newcon->flags |= CON_PAUSED; @@ -547,7 +543,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } if (kthreads_started) start_printk_kthread(newcon); -@@ -3280,6 +3508,10 @@ int unregister_console(struct console *c +@@ -3302,6 +3530,10 @@ int unregister_console(struct console *c console_unlock(); console_sysfs_notify(); @@ -558,7 +554,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> if (console->exit) res = console->exit(console); -@@ -3413,7 +3645,7 @@ bool pr_flush(int timeout_ms, bool reset +@@ -3436,7 +3668,7 @@ bool pr_flush(int timeout_ms, bool reset console_lock(); for_each_console(con) { @@ -567,7 +563,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> continue; printk_seq = con->seq; if (printk_seq < seq) -@@ -3481,6 +3713,11 @@ static int printk_kthread_func(void *dat +@@ -3504,6 +3736,11 @@ static int printk_kthread_func(void *dat (con->flags & CON_BOOT) ? "boot" : "", con->name, con->index); @@ -579,7 +575,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> text = kmalloc(CONSOLE_LOG_MAX, GFP_KERNEL); if (!text) goto out; -@@ -3509,7 +3746,7 @@ static int printk_kthread_func(void *dat +@@ -3532,7 +3769,7 @@ static int printk_kthread_func(void *dat if (error) break; @@ -588,7 +584,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> mutex_unlock(&con->lock); break; } -@@ -3529,7 +3766,7 @@ static int printk_kthread_func(void *dat +@@ -3552,7 +3789,7 @@ static int printk_kthread_func(void *dat */ console_may_schedule = 0; progress = console_emit_next_record(con, text, ext_text, diff --git a/patches/0013-serial-8250-implement-write_atomic.patch b/patches/0014-serial-8250-implement-write_atomic.patch index 04ccb544ac89..42af2d2ed00a 100644 --- a/patches/0013-serial-8250-implement-write_atomic.patch +++ b/patches/0014-serial-8250-implement-write_atomic.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Mon, 30 Nov 2020 01:42:02 +0106 -Subject: [PATCH 13/14] serial: 8250: implement write_atomic +Subject: [PATCH 14/15] serial: 8250: implement write_atomic Implement a non-sleeping NMI-safe write_atomic() console function in order to support atomic console printing during a panic. diff --git a/patches/0014-printk-avoid-preempt_disable-for-PREEMPT_RT.patch b/patches/0015-printk-avoid-preempt_disable-for-PREEMPT_RT.patch index c58a2aa742ba..dc615e9f661f 100644 --- a/patches/0014-printk-avoid-preempt_disable-for-PREEMPT_RT.patch +++ b/patches/0015-printk-avoid-preempt_disable-for-PREEMPT_RT.patch @@ -1,6 +1,6 @@ From: John Ogness <john.ogness@linutronix.de> Date: Thu, 20 Jan 2022 16:53:56 +0106 -Subject: [PATCH 14/14] printk: avoid preempt_disable() for PREEMPT_RT +Subject: [PATCH 15/15] printk: avoid preempt_disable() for PREEMPT_RT During non-normal operation, printk() calls will attempt to write the messages directly to the consoles. This involves @@ -50,7 +50,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /* * Call the specified console driver, asking it to write out the specified -@@ -2268,19 +2270,31 @@ asmlinkage int vprintk_emit(int facility +@@ -2270,19 +2272,31 @@ asmlinkage int vprintk_emit(int facility /* If called from the scheduler, we can not call up(). */ if (!in_sched && !kthread_printers_active()) { /* @@ -87,7 +87,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> } wake_up_klogd(); -@@ -2869,8 +2883,13 @@ static bool console_emit_next_record(str +@@ -2895,8 +2909,13 @@ static bool console_emit_next_record(str len = record_print_text(&r, console_msg_format & MSG_FORMAT_SYSLOG, printk_time); } diff --git a/patches/Add_localversion_for_-RT_release.patch b/patches/Add_localversion_for_-RT_release.patch index 0e6dbb0e3c10..d960d516454d 100644 --- a/patches/Add_localversion_for_-RT_release.patch +++ b/patches/Add_localversion_for_-RT_release.patch @@ -15,4 +15,4 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- /dev/null +++ b/localversion-rt @@ -0,0 +1 @@ -+-rt1 ++-rt2 diff --git a/patches/series b/patches/series index 00804151d299..b87316613264 100644 --- a/patches/series +++ b/patches/series @@ -10,16 +10,17 @@ Revert-tty-serial-Use-fifo-in-8250-console-driver.patch 0002-printk-cpu-sync-always-disable-interrupts.patch 0003-printk-use-percpu-flag-instead-of-cpu_online.patch 0004-printk-get-caller_id-timestamp-after-migration-disab.patch -0005-printk-refactor-and-rework-printing-logic.patch -0006-printk-move-buffer-definitions-into-console_emit_nex.patch -0007-printk-add-pr_flush.patch -0008-printk-add-kthread-console-printers.patch -0009-printk-reimplement-console_lock-for-proper-kthread-s.patch -0010-printk-remove-console_locked.patch -0011-console-introduce-CON_MIGHT_SLEEP-for-vt.patch -0012-printk-add-infrastucture-for-atomic-consoles.patch -0013-serial-8250-implement-write_atomic.patch -0014-printk-avoid-preempt_disable-for-PREEMPT_RT.patch +0005-printk-call-boot_delay_msec-in-printk_delay.patch +0006-printk-refactor-and-rework-printing-logic.patch +0007-printk-move-buffer-definitions-into-console_emit_nex.patch +0008-printk-add-pr_flush.patch +0009-printk-add-kthread-console-printers.patch +0010-printk-reimplement-console_lock-for-proper-kthread-s.patch +0011-printk-remove-console_locked.patch +0012-console-introduce-CON_MIGHT_SLEEP-for-vt.patch +0013-printk-add-infrastucture-for-atomic-consoles.patch +0014-serial-8250-implement-write_atomic.patch +0015-printk-avoid-preempt_disable-for-PREEMPT_RT.patch ########################################################################### # Posted and applied |