* [PATCH printk v2 0/1] allow unsafe write_atomic() @ 2025-10-27 16:12 John Ogness 2025-10-27 16:12 ` [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic John Ogness 0 siblings, 1 reply; 9+ messages in thread From: John Ogness @ 2025-10-27 16:12 UTC (permalink / raw) To: Petr Mladek Cc: Sergey Senozhatsky, Steven Rostedt, Breno Leitao, Mike Galbraith, linux-kernel, Greg Kroah-Hartman This is v2 of a series to allow unsafe write_atomic() console callback implementations. This will allow console drivers to move to the nbcon API, even if they are not capable of NMI-safe atomic writing. The primary motivation for this series is to support netconsole. v1 is here [0]. This version is based on the rework/nbcon-in-kdb branch of the printk git in order to avoid conflicts due to the console_is_usable() relocation. The changes since v1: - Use a global variable to track exactly when it is allowed to flush using an unsafe write_atomic() rather than sprinkling around similar checks based on states and code paths. - Remove evil and incorrect WARN_ON() detection in nbcon_emit_next_record(). John Ogness [0] https://lore.kernel.org/lkml/20250912121852.2666874-1-john.ogness@linutronix.de John Ogness (1): printk: nbcon: Allow unsafe write_atomic() for panic include/linux/console.h | 19 ++++++++++++++--- kernel/printk/nbcon.c | 45 ++++++++++++++++++++++++++++------------- 2 files changed, 47 insertions(+), 17 deletions(-) base-commit: 62627bf0cadf6eae87d92fecf604c42160fe16ef -- 2.47.3 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic 2025-10-27 16:12 [PATCH printk v2 0/1] allow unsafe write_atomic() John Ogness @ 2025-10-27 16:12 ` John Ogness 2025-10-28 4:56 ` kernel test robot ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: John Ogness @ 2025-10-27 16:12 UTC (permalink / raw) To: Petr Mladek Cc: Sergey Senozhatsky, Steven Rostedt, Breno Leitao, Mike Galbraith, linux-kernel, Greg Kroah-Hartman There may be console drivers that have not yet figured out a way to implement safe atomic printing (->write_atomic() callback). These drivers could choose to only implement threaded printing (->write_thread() callback), but then it is guaranteed that _no_ output will be printed during panic. Not even attempted. As a result, developers may be tempted to implement unsafe ->write_atomic() callbacks and/or implement some sort of custom deferred printing trickery to try to make it work. This goes against the principle intention of the nbcon API as well as endangers other nbcon drivers that are doing things correctly (safely). As a compromise, allow nbcon drivers to implement unsafe ->write_atomic() callbacks by providing a new console flag CON_NBCON_ATOMIC_UNSAFE. When specified, the ->write_atomic() callback for that console will _only_ be called during the final "hope and pray" flush attempt at the end of a panic: nbcon_atomic_flush_unsafe(). Signed-off-by: John Ogness <john.ogness@linutronix.de> Link: https://lore.kernel.org/lkml/b2qps3uywhmjaym4mht2wpxul4yqtuuayeoq4iv4k3zf5wdgh3@tocu6c7mj4lt --- include/linux/console.h | 19 ++++++++++++++--- kernel/printk/nbcon.c | 45 ++++++++++++++++++++++++++++------------- 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/include/linux/console.h b/include/linux/console.h index d17f1f525bec9..5f17321ed962b 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -186,6 +186,8 @@ static inline void con_debug_leave(void) { } * printing callbacks must not be called. * @CON_NBCON: Console can operate outside of the legacy style console_lock * constraints. + * @CON_NBCON_ATOMIC_UNSAFE: The write_atomic() callback is not safe and is + * therefore only used by nbcon_atomic_flush_unsafe(). */ enum cons_flags { CON_PRINTBUFFER = BIT(0), @@ -197,6 +199,7 @@ enum cons_flags { CON_EXTENDED = BIT(6), CON_SUSPENDED = BIT(7), CON_NBCON = BIT(8), + CON_NBCON_ATOMIC_UNSAFE = BIT(9), }; /** @@ -608,6 +611,7 @@ extern void nbcon_write_context_set_buf(struct nbcon_write_context *wctxt, extern bool nbcon_enter_unsafe(struct nbcon_write_context *wctxt); extern bool nbcon_exit_unsafe(struct nbcon_write_context *wctxt); extern void nbcon_reacquire_nobuf(struct nbcon_write_context *wctxt); +extern bool nbcon_allow_unsafe_takeover(void); extern bool nbcon_kdb_try_acquire(struct console *con, struct nbcon_write_context *wctxt); extern void nbcon_kdb_release(struct nbcon_write_context *wctxt); @@ -627,9 +631,18 @@ static inline bool console_is_usable(struct console *con, short flags, bool use_ return false; if (flags & CON_NBCON) { - /* The write_atomic() callback is optional. */ - if (use_atomic && !con->write_atomic) - return false; + if (use_atomic) { + /* The write_atomic() callback is optional. */ + if (!con->write_atomic) + return false; + + /* + * An unsafe write_atomic() callback is only usable + * when unsafe takeovers are allowed. + */ + if ((flags & CON_NBCON_ATOMIC_UNSAFE) && !nbcon_allow_unsafe_takeover()) + return false; + } /* * For the !use_atomic case, @printk_kthreads_running is not diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c index fdd1cbebe77d8..254f7b79da5e7 100644 --- a/kernel/printk/nbcon.c +++ b/kernel/printk/nbcon.c @@ -1408,6 +1408,26 @@ enum nbcon_prio nbcon_get_default_prio(void) return NBCON_PRIO_NORMAL; } +/* + * Track if it is allowed to perform unsafe hostile takeovers of console + * ownership. When true, console drivers might perform unsafe actions while + * printing. It is externally available via nbcon_allow_unsafe_takeover(). + */ +static bool panic_nbcon_allow_unsafe_takeover; + +/** + * nbcon_allow_unsafe_takeover - Check if unsafe console takeovers are allowed + * + * Return: True, when it is permitted to perform unsafe console printing + * + * This is also used by console_is_usable() to determine if it is allowed to + * call write_atomic() callbacks flagged as unsafe (CON_NBCON_ATOMIC_UNSAFE). + */ +bool nbcon_allow_unsafe_takeover(void) +{ + return panic_on_this_cpu() && panic_nbcon_allow_unsafe_takeover; +} + /** * nbcon_legacy_emit_next_record - Print one record for an nbcon console * in legacy contexts @@ -1478,7 +1498,6 @@ bool nbcon_legacy_emit_next_record(struct console *con, bool *handover, * write_atomic() callback * @con: The nbcon console to flush * @stop_seq: Flush up until this record - * @allow_unsafe_takeover: True, to allow unsafe hostile takeovers * * Return: 0 if @con was flushed up to @stop_seq Otherwise, error code on * failure. @@ -1497,8 +1516,7 @@ bool nbcon_legacy_emit_next_record(struct console *con, bool *handover, * returned, it cannot be expected that the unfinalized record will become * available. */ -static int __nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq, - bool allow_unsafe_takeover) +static int __nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq) { struct nbcon_write_context wctxt = { }; struct nbcon_context *ctxt = &ACCESS_PRIVATE(&wctxt, ctxt); @@ -1507,7 +1525,7 @@ static int __nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq, ctxt->console = con; ctxt->spinwait_max_us = 2000; ctxt->prio = nbcon_get_default_prio(); - ctxt->allow_unsafe_takeover = allow_unsafe_takeover; + ctxt->allow_unsafe_takeover = nbcon_allow_unsafe_takeover(); if (!nbcon_context_try_acquire(ctxt, false)) return -EPERM; @@ -1538,15 +1556,13 @@ static int __nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq, * write_atomic() callback * @con: The nbcon console to flush * @stop_seq: Flush up until this record - * @allow_unsafe_takeover: True, to allow unsafe hostile takeovers * * This will stop flushing before @stop_seq if another context has ownership. * That context is then responsible for the flushing. Likewise, if new records * are added while this context was flushing and there is no other context * to handle the printing, this context must also flush those records. */ -static void nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq, - bool allow_unsafe_takeover) +static void nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq) { struct console_flush_type ft; unsigned long flags; @@ -1561,7 +1577,7 @@ static void nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq, */ local_irq_save(flags); - err = __nbcon_atomic_flush_pending_con(con, stop_seq, allow_unsafe_takeover); + err = __nbcon_atomic_flush_pending_con(con, stop_seq); local_irq_restore(flags); @@ -1593,9 +1609,8 @@ static void nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq, * __nbcon_atomic_flush_pending - Flush all nbcon consoles using their * write_atomic() callback * @stop_seq: Flush up until this record - * @allow_unsafe_takeover: True, to allow unsafe hostile takeovers */ -static void __nbcon_atomic_flush_pending(u64 stop_seq, bool allow_unsafe_takeover) +static void __nbcon_atomic_flush_pending(u64 stop_seq) { struct console *con; int cookie; @@ -1613,7 +1628,7 @@ static void __nbcon_atomic_flush_pending(u64 stop_seq, bool allow_unsafe_takeove if (nbcon_seq_read(con) >= stop_seq) continue; - nbcon_atomic_flush_pending_con(con, stop_seq, allow_unsafe_takeover); + nbcon_atomic_flush_pending_con(con, stop_seq); } console_srcu_read_unlock(cookie); } @@ -1629,7 +1644,7 @@ static void __nbcon_atomic_flush_pending(u64 stop_seq, bool allow_unsafe_takeove */ void nbcon_atomic_flush_pending(void) { - __nbcon_atomic_flush_pending(prb_next_reserve_seq(prb), false); + __nbcon_atomic_flush_pending(prb_next_reserve_seq(prb)); } /** @@ -1641,7 +1656,9 @@ void nbcon_atomic_flush_pending(void) */ void nbcon_atomic_flush_unsafe(void) { - __nbcon_atomic_flush_pending(prb_next_reserve_seq(prb), true); + panic_nbcon_allow_unsafe_takeover = true; + __nbcon_atomic_flush_pending(prb_next_reserve_seq(prb)); + panic_nbcon_allow_unsafe_takeover = false; } /** @@ -1848,7 +1865,7 @@ void nbcon_device_release(struct console *con) * using the legacy loop. */ if (ft.nbcon_atomic) { - __nbcon_atomic_flush_pending_con(con, prb_next_reserve_seq(prb), false); + __nbcon_atomic_flush_pending_con(con, prb_next_reserve_seq(prb)); } else if (ft.legacy_direct) { if (console_trylock()) console_unlock(); -- 2.47.3 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic 2025-10-27 16:12 ` [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic John Ogness @ 2025-10-28 4:56 ` kernel test robot 2025-10-28 4:56 ` kernel test robot 2025-10-30 15:03 ` Petr Mladek 2 siblings, 0 replies; 9+ messages in thread From: kernel test robot @ 2025-10-28 4:56 UTC (permalink / raw) To: John Ogness, Petr Mladek Cc: oe-kbuild-all, Sergey Senozhatsky, Steven Rostedt, Breno Leitao, Mike Galbraith, linux-kernel, Greg Kroah-Hartman Hi John, kernel test robot noticed the following build errors: [auto build test ERROR on 62627bf0cadf6eae87d92fecf604c42160fe16ef] url: https://github.com/intel-lab-lkp/linux/commits/John-Ogness/printk-nbcon-Allow-unsafe-write_atomic-for-panic/20251028-001756 base: 62627bf0cadf6eae87d92fecf604c42160fe16ef patch link: https://lore.kernel.org/r/20251027161212.334219-2-john.ogness%40linutronix.de patch subject: [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic config: m68k-allnoconfig (https://download.01.org/0day-ci/archive/20251028/202510281206.cLKMJ90G-lkp@intel.com/config) compiler: m68k-linux-gcc (GCC) 15.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251028/202510281206.cLKMJ90G-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202510281206.cLKMJ90G-lkp@intel.com/ All errors (new ones prefixed by >>): kernel/printk/nbcon.c: In function 'nbcon_kdb_release': >> kernel/printk/nbcon.c:1938:9: error: too many arguments to function '__nbcon_atomic_flush_pending_con'; expected 2, have 3 1938 | __nbcon_atomic_flush_pending_con(ctxt->console, prb_next_reserve_seq(prb), false); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ kernel/printk/nbcon.c:1519:12: note: declared here 1519 | static int __nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vim +/__nbcon_atomic_flush_pending_con +1938 kernel/printk/nbcon.c 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1916 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1917 /** 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1918 * nbcon_kdb_release - Exit unsafe section and release the nbcon console 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1919 * 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1920 * @wctxt: The nbcon write context initialized by a successful 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1921 * nbcon_kdb_try_acquire() 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1922 */ 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1923 void nbcon_kdb_release(struct nbcon_write_context *wctxt) 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1924 { 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1925 struct nbcon_context *ctxt = &ACCESS_PRIVATE(wctxt, ctxt); 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1926 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1927 if (!nbcon_context_exit_unsafe(ctxt)) 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1928 return; 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1929 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1930 nbcon_context_release(ctxt); 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1931 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1932 /* 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1933 * Flush any new printk() messages added when the console was blocked. 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1934 * Only the console used by the given write context was blocked. 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1935 * The console was locked only when the write_atomic() callback 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1936 * was usable. 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 1937 */ 49f7d3054e84617 Marcos Paulo de Souza 2025-10-16 @1938 __nbcon_atomic_flush_pending_con(ctxt->console, prb_next_reserve_seq(prb), false); -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic 2025-10-27 16:12 ` [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic John Ogness 2025-10-28 4:56 ` kernel test robot @ 2025-10-28 4:56 ` kernel test robot 2025-10-30 15:03 ` Petr Mladek 2 siblings, 0 replies; 9+ messages in thread From: kernel test robot @ 2025-10-28 4:56 UTC (permalink / raw) To: John Ogness, Petr Mladek Cc: llvm, oe-kbuild-all, Sergey Senozhatsky, Steven Rostedt, Breno Leitao, Mike Galbraith, linux-kernel, Greg Kroah-Hartman Hi John, kernel test robot noticed the following build errors: [auto build test ERROR on 62627bf0cadf6eae87d92fecf604c42160fe16ef] url: https://github.com/intel-lab-lkp/linux/commits/John-Ogness/printk-nbcon-Allow-unsafe-write_atomic-for-panic/20251028-001756 base: 62627bf0cadf6eae87d92fecf604c42160fe16ef patch link: https://lore.kernel.org/r/20251027161212.334219-2-john.ogness%40linutronix.de patch subject: [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic config: x86_64-allnoconfig (https://download.01.org/0day-ci/archive/20251028/202510281239.CrKvR38C-lkp@intel.com/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251028/202510281239.CrKvR38C-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202510281239.CrKvR38C-lkp@intel.com/ All errors (new ones prefixed by >>): >> kernel/printk/nbcon.c:1938:77: error: too many arguments to function call, expected 2, have 3 1938 | __nbcon_atomic_flush_pending_con(ctxt->console, prb_next_reserve_seq(prb), false); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~ kernel/printk/nbcon.c:1519:12: note: '__nbcon_atomic_flush_pending_con' declared here 1519 | static int __nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq) | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. vim +1938 kernel/printk/nbcon.c 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1916 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1917 /** 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1918 * nbcon_kdb_release - Exit unsafe section and release the nbcon console 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1919 * 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1920 * @wctxt: The nbcon write context initialized by a successful 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1921 * nbcon_kdb_try_acquire() 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1922 */ 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1923 void nbcon_kdb_release(struct nbcon_write_context *wctxt) 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1924 { 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1925 struct nbcon_context *ctxt = &ACCESS_PRIVATE(wctxt, ctxt); 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1926 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1927 if (!nbcon_context_exit_unsafe(ctxt)) 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1928 return; 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1929 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1930 nbcon_context_release(ctxt); 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1931 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1932 /* 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1933 * Flush any new printk() messages added when the console was blocked. 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1934 * Only the console used by the given write context was blocked. 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1935 * The console was locked only when the write_atomic() callback 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1936 * was usable. 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 1937 */ 49f7d3054e8461 Marcos Paulo de Souza 2025-10-16 @1938 __nbcon_atomic_flush_pending_con(ctxt->console, prb_next_reserve_seq(prb), false); -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic 2025-10-27 16:12 ` [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic John Ogness 2025-10-28 4:56 ` kernel test robot 2025-10-28 4:56 ` kernel test robot @ 2025-10-30 15:03 ` Petr Mladek 2025-10-31 8:56 ` John Ogness 2 siblings, 1 reply; 9+ messages in thread From: Petr Mladek @ 2025-10-30 15:03 UTC (permalink / raw) To: John Ogness Cc: Sergey Senozhatsky, Steven Rostedt, Breno Leitao, Mike Galbraith, linux-kernel, Greg Kroah-Hartman On Mon 2025-10-27 17:18:03, John Ogness wrote: > There may be console drivers that have not yet figured out a way > to implement safe atomic printing (->write_atomic() callback). > These drivers could choose to only implement threaded printing > (->write_thread() callback), but then it is guaranteed that _no_ > output will be printed during panic. Not even attempted. > > As a result, developers may be tempted to implement unsafe > ->write_atomic() callbacks and/or implement some sort of custom > deferred printing trickery to try to make it work. This goes > against the principle intention of the nbcon API as well as > endangers other nbcon drivers that are doing things correctly > (safely). > > As a compromise, allow nbcon drivers to implement unsafe > ->write_atomic() callbacks by providing a new console flag > CON_NBCON_ATOMIC_UNSAFE. When specified, the ->write_atomic() > callback for that console will _only_ be called during the > final "hope and pray" flush attempt at the end of a panic: > nbcon_atomic_flush_unsafe(). > > Signed-off-by: John Ogness <john.ogness@linutronix.de> > Link: https://lore.kernel.org/lkml/b2qps3uywhmjaym4mht2wpxul4yqtuuayeoq4iv4k3zf5wdgh3@tocu6c7mj4lt The patch looks good to me: Reviewed-by: Petr Mladek <pmladek@suse.com> That said, it needs one more hunk to fix build with the patchset adding support for nbcon into kdb which is in https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git/ It would fix the compilation problem reported by the robot: --- a/kernel/printk/nbcon.c +++ b/kernel/printk/nbcon.c @@ -1935,5 +1935,5 @@ void nbcon_kdb_release(struct nbcon_write_context *wctxt) * The console was locked only when the write_atomic() callback * was usable. */ - __nbcon_atomic_flush_pending_con(ctxt->console, prb_next_reserve_seq(prb), false); + __nbcon_atomic_flush_pending_con(ctxt->console, prb_next_reserve_seq(prb)); } Also there is one trivial conflict with the new branch which is preventing hardlockups in atomic flush which is https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git/log/?h=rework/atomic-flush-hardlockup Namely, it is the last patch which moves nbcon_context_try_acquire() into to while cycle, see https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git/commit/?h=rework/atomic-flush-hardlockup&id=d5d399efff65773ed82ddaf6c11a0fcfdb5eb029 Commit: I am not sure how to move forward. IMHO, the original plan was to push this patch together with the other netconsole-related changes. In this case, the conflicts will need to be solved when merging pull requests from netconsole and printk trees. Well, the conflicts are trivial. Or I could push this patch via the printk tree and queue it for 6.19. But this might be too late for netconsole. It primary depends whether the netconsole side might be ready for 6.19 or if it could wait for 6.20. Best Regards, Petr ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic 2025-10-30 15:03 ` Petr Mladek @ 2025-10-31 8:56 ` John Ogness 2025-11-04 9:56 ` Breno Leitao 0 siblings, 1 reply; 9+ messages in thread From: John Ogness @ 2025-10-31 8:56 UTC (permalink / raw) To: Petr Mladek Cc: Sergey Senozhatsky, Steven Rostedt, Breno Leitao, Mike Galbraith, linux-kernel, Greg Kroah-Hartman On 2025-10-30, Petr Mladek <pmladek@suse.com> wrote: > The patch looks good to me: > > Reviewed-by: Petr Mladek <pmladek@suse.com> Thanks. > That said, it needs one more hunk to fix build with the patchset > adding support for nbcon into kdb which is > in https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git/ [...] > Also there is one trivial conflict with the new branch which is > preventing hardlockups in atomic flush which is > https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git/log/?h=rework/atomic-flush-hardlockup > > Namely, it is the last patch which moves nbcon_context_try_acquire() > into to while cycle, see > https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git/commit/?h=rework/atomic-flush-hardlockup&id=d5d399efff65773ed82ddaf6c11a0fcfdb5eb029 I can send a new patch that takes all these underlying series into account... assuming it is going through the printk tree. > I am not sure how to move forward. IMHO, the original plan was to push > this patch together with the other netconsole-related changes. In this > case, the conflicts will need to be solved when merging pull requests > from netconsole and printk trees. Well, the conflicts are trivial. > > Or I could push this patch via the printk tree and queue it for 6.19. > But this might be too late for netconsole. @Breno: This new feature only exists for netconsole at the moment, so I am fine with it going through the netconsole tree. But we need to decide this soon because there are a lot of printk-changes queued for 6.19 that conflict with this patch and we should get those sorted out sooner rather than later. (Note that the patch in its current form will also conflict with the netconsole tree, so regardless of our decision I need to submit a new version.) John ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic 2025-10-31 8:56 ` John Ogness @ 2025-11-04 9:56 ` Breno Leitao 2025-11-07 13:56 ` Petr Mladek 0 siblings, 1 reply; 9+ messages in thread From: Breno Leitao @ 2025-11-04 9:56 UTC (permalink / raw) To: John Ogness Cc: Petr Mladek, Sergey Senozhatsky, Steven Rostedt, Mike Galbraith, linux-kernel, Greg Kroah-Hartman Hello John, On Fri, Oct 31, 2025 at 10:02:06AM +0106, John Ogness wrote: > > I am not sure how to move forward. IMHO, the original plan was to push > > this patch together with the other netconsole-related changes. In this > > case, the conflicts will need to be solved when merging pull requests > > from netconsole and printk trees. Well, the conflicts are trivial. > > > > Or I could push this patch via the printk tree and queue it for 6.19. > > But this might be too late for netconsole. > > @Breno: This new feature only exists for netconsole at the moment, so I > am fine with it going through the netconsole tree. But we need to decide > this soon because there are a lot of printk-changes queued for 6.19 that > conflict with this patch and we should get those sorted out sooner > rather than later. (Note that the patch in its current form will also > conflict with the netconsole tree, so regardless of our decision I need > to submit a new version.) I would prefer you do it through the printk tree for 6.19 and I use it in the next releae (6.20). I do NOT have plans for integrating the port of netcon to nbcon in 6.19, given I have other issues to solve first (described in [1] for curious souls), and I am still a bit stuck with [2]. Given all of these patch conflict, these patches are being a bit serial at this time. Link: https://lore.kernel.org/all/swdpckuwwlv3uiessmtnf2jwlx3jusw6u7fpk5iggqo4t2vdws@7rpjso4gr7qp/ [1] Link: https://lore.kernel.org/all/20251103-fix_netpoll_aa-v4-1-4cfecdf6da7c@debian.org/ [2] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic 2025-11-04 9:56 ` Breno Leitao @ 2025-11-07 13:56 ` Petr Mladek 2025-11-07 14:12 ` John Ogness 0 siblings, 1 reply; 9+ messages in thread From: Petr Mladek @ 2025-11-07 13:56 UTC (permalink / raw) To: Breno Leitao Cc: John Ogness, Sergey Senozhatsky, Steven Rostedt, Mike Galbraith, linux-kernel, Greg Kroah-Hartman On Tue 2025-11-04 01:56:07, Breno Leitao wrote: > Hello John, > > On Fri, Oct 31, 2025 at 10:02:06AM +0106, John Ogness wrote: > > > I am not sure how to move forward. IMHO, the original plan was to push > > > this patch together with the other netconsole-related changes. In this > > > case, the conflicts will need to be solved when merging pull requests > > > from netconsole and printk trees. Well, the conflicts are trivial. > > > > > > Or I could push this patch via the printk tree and queue it for 6.19. > > > But this might be too late for netconsole. > > > > @Breno: This new feature only exists for netconsole at the moment, so I > > am fine with it going through the netconsole tree. But we need to decide > > this soon because there are a lot of printk-changes queued for 6.19 that > > conflict with this patch and we should get those sorted out sooner > > rather than later. (Note that the patch in its current form will also > > conflict with the netconsole tree, so regardless of our decision I need > > to submit a new version.) > > I would prefer you do it through the printk tree for 6.19 and I use it > in the next releae (6.20). OK, I have just committed the patch into printk/linux.git, branch rework/write_atomic-unsafe. It is intended for 6.19 merge window. > I do NOT have plans for integrating the port of netcon to nbcon > in 6.19, given I have other issues to solve first (described in [1] for > curious souls), and I am still a bit stuck with [2]. Given all of these > patch conflict, these patches are being a bit serial at this time. > > Link: https://lore.kernel.org/all/swdpckuwwlv3uiessmtnf2jwlx3jusw6u7fpk5iggqo4t2vdws@7rpjso4gr7qp/ [1] > Link: https://lore.kernel.org/all/20251103-fix_netpoll_aa-v4-1-4cfecdf6da7c@debian.org/ [2] Good to know. Best Regards, Petr ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic 2025-11-07 13:56 ` Petr Mladek @ 2025-11-07 14:12 ` John Ogness 0 siblings, 0 replies; 9+ messages in thread From: John Ogness @ 2025-11-07 14:12 UTC (permalink / raw) To: Petr Mladek, Breno Leitao Cc: Sergey Senozhatsky, Steven Rostedt, Mike Galbraith, linux-kernel, Greg Kroah-Hartman On 2025-11-07, Petr Mladek <pmladek@suse.com> wrote: >> I would prefer you do it through the printk tree for 6.19 and I use it >> in the next releae (6.20). > > OK, I have just committed the patch into printk/linux.git, > branch rework/write_atomic-unsafe. It is intended for 6.19 merge window. Thanks for fixing it up the patch for the kdb series. John ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-11-07 14:12 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-27 16:12 [PATCH printk v2 0/1] allow unsafe write_atomic() John Ogness 2025-10-27 16:12 ` [PATCH printk v2 1/1] printk: nbcon: Allow unsafe write_atomic() for panic John Ogness 2025-10-28 4:56 ` kernel test robot 2025-10-28 4:56 ` kernel test robot 2025-10-30 15:03 ` Petr Mladek 2025-10-31 8:56 ` John Ogness 2025-11-04 9:56 ` Breno Leitao 2025-11-07 13:56 ` Petr Mladek 2025-11-07 14:12 ` John Ogness
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox