From: John Ogness <john.ogness@linutronix.de>
To: Marcos Paulo de Souza <mpdesouza@suse.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Petr Mladek <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Jason Wessel <jason.wessel@windriver.com>,
Daniel Thompson <danielt@kernel.org>,
Douglas Anderson <dianders@chromium.org>
Cc: linux-kernel@vger.kernel.org,
kgdb-bugreport@lists.sourceforge.net,
Marcos Paulo de Souza <mpdesouza@suse.com>
Subject: Re: [PATCH v5 3/5] printk: nbcon: Allow KDB to acquire the NBCON context
Date: Wed, 01 Oct 2025 17:11:17 +0206 [thread overview]
Message-ID: <84ecrmhdci.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <20250930-nbcon-kgdboc-v5-3-8125893cfb4f@suse.com>
On 2025-09-30, Marcos Paulo de Souza <mpdesouza@suse.com> wrote:
> diff --git a/include/linux/kdb.h b/include/linux/kdb.h
> index ecbf819deeca118f27e98bf71bb37dd27a257ebb..36b46c85733fe1df28cde7760e5c26e96de40c05 100644
> --- a/include/linux/kdb.h
> +++ b/include/linux/kdb.h
> @@ -207,11 +207,26 @@ static inline const char *kdb_walk_kallsyms(loff_t *pos)
> /* Dynamic kdb shell command registration */
> extern int kdb_register(kdbtab_t *cmd);
> extern void kdb_unregister(kdbtab_t *cmd);
> +
> +/* Return true when KDB as locked for printing a message on this CPU. */
> +static inline
> +bool kdb_printf_on_this_cpu(void)
> +{
> + /*
> + * We can use raw_smp_processor_id() here because the task could
> + * not get migrated when KDB has locked for printing on this CPU.
> + */
> + return unlikely(READ_ONCE(kdb_printf_cpu) == raw_smp_processor_id());
> +}
> +
> #else /* ! CONFIG_KGDB_KDB */
> static inline __printf(1, 2) int kdb_printf(const char *fmt, ...) { return 0; }
> static inline void kdb_init(int level) {}
> static inline int kdb_register(kdbtab_t *cmd) { return 0; }
> static inline void kdb_unregister(kdbtab_t *cmd) {}
> +
> +static inline bool kdb_printf_on_this_cpu(void) { return false };
> +
> #endif /* CONFIG_KGDB_KDB */
> enum {
> KDB_NOT_INITIALIZED,
The include for raw_smp_processor_id() is also needed:
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
index 36b46c85733fe..db9d73b12a1af 100644
--- a/include/linux/kdb.h
+++ b/include/linux/kdb.h
@@ -14,6 +14,7 @@
*/
#include <linux/list.h>
+#include <linux/smp.h>
/* Shifted versions of the command enable bits are be used if the command
* has no arguments (see kdb_check_flags). This allows commands, such as
next prev parent reply other threads:[~2025-10-01 15:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 17:21 [PATCH v5 0/5] Handle NBCON consoles on KDB Marcos Paulo de Souza
2025-09-30 17:21 ` [PATCH v5 1/5] printk: nbcon: Export console_is_usable Marcos Paulo de Souza
2025-10-01 14:36 ` John Ogness
2025-09-30 17:21 ` [PATCH v5 2/5] printk: nbcon: Introduce KDB helpers Marcos Paulo de Souza
2025-10-01 14:56 ` John Ogness
2025-10-02 11:23 ` Marcos Paulo de Souza
2025-10-02 19:03 ` Marcos Paulo de Souza
2025-10-06 8:31 ` John Ogness
2025-10-06 13:58 ` Petr Mladek
2025-09-30 17:21 ` [PATCH v5 3/5] printk: nbcon: Allow KDB to acquire the NBCON context Marcos Paulo de Souza
2025-10-01 15:05 ` John Ogness [this message]
2025-09-30 17:21 ` [PATCH v5 4/5] printk: nbcon: Export nbcon_write_context_set_buf Marcos Paulo de Souza
2025-10-01 15:08 ` John Ogness
2025-09-30 17:21 ` [PATCH v5 5/5] kdb: Adapt kdb_msg_write to work with NBCON consoles Marcos Paulo de Souza
2025-10-01 15:21 ` John Ogness
2025-10-02 14:01 ` [PATCH v5 0/5] Handle NBCON consoles on KDB Daniel Thompson
2025-10-02 16:20 ` Marcos Paulo de Souza
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=84ecrmhdci.fsf@jogness.linutronix.de \
--to=john.ogness@linutronix.de \
--cc=danielt@kernel.org \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mpdesouza@suse.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.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.