From: Junxiao Chang <junxiao.chang@intel.com>
To: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org,
linux-kernel@vger.kernel.org
Cc: john.ogness@linutronix.de, hao3.li@intel.com, lili.li@intel.com,
jianfeng.gao@intel.com, linux-rt-users@vger.kernel.org
Subject: [PATCH 1/2] printk: nbcon: move locked_port flag to struct uart_port
Date: Tue, 23 Jan 2024 13:40:32 +0800 [thread overview]
Message-ID: <20240123054033.183114-2-junxiao.chang@intel.com> (raw)
In-Reply-To: <20240123054033.183114-1-junxiao.chang@intel.com>
Console pointer in uart_port might be shared among multiple uart
ports. Flag port locked by nbcon should be saved in uart_port
structure instead of in console structure.
Fixes: 6424f396c49e ("printk: nbcon: Implement processing in port->lock wrapper")
Suggested-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
---
include/linux/console.h | 2 --
include/linux/serial_core.h | 1 +
kernel/printk/nbcon.c | 8 ++++----
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/include/linux/console.h b/include/linux/console.h
index f8a0628678886..1eb9580e9b18a 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -304,7 +304,6 @@ struct nbcon_write_context {
* @nbcon_state: State for nbcon consoles
* @nbcon_seq: Sequence number of the next record for nbcon to print
* @pbufs: Pointer to nbcon private buffer
- * @locked_port: True, if the port lock is locked by nbcon
* @kthread: Printer kthread for this console
* @rcuwait: RCU-safe wait object for @kthread waking
* @irq_work: Defer @kthread waking to IRQ work context
@@ -338,7 +337,6 @@ struct console {
atomic_t __private nbcon_state;
atomic_long_t __private nbcon_seq;
struct printk_buffers *pbufs;
- bool locked_port;
struct task_struct *kthread;
struct rcuwait rcuwait;
struct irq_work irq_work;
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 245c11753effd..b2221a50fcb29 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -488,6 +488,7 @@ struct uart_port {
struct uart_icount icount; /* statistics */
struct console *cons; /* struct console, if any */
+ bool nbcon_locked_port; /* True, if the port is locked by nbcon */
/* flags must be updated while holding port mutex */
upf_t flags;
diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
index 1b1b585b1675b..b53d93585ee71 100644
--- a/kernel/printk/nbcon.c
+++ b/kernel/printk/nbcon.c
@@ -1586,7 +1586,7 @@ void nbcon_acquire(struct uart_port *up)
if (!uart_is_nbcon(up))
return;
- WARN_ON_ONCE(con->locked_port);
+ WARN_ON_ONCE(up->nbcon_locked_port);
do {
do {
@@ -1597,7 +1597,7 @@ void nbcon_acquire(struct uart_port *up)
} while (!nbcon_context_enter_unsafe(&ctxt));
- con->locked_port = true;
+ up->nbcon_locked_port = true;
}
EXPORT_SYMBOL_GPL(nbcon_acquire);
@@ -1623,13 +1623,13 @@ void nbcon_release(struct uart_port *up)
.prio = NBCON_PRIO_NORMAL,
};
- if (!con->locked_port)
+ if (!up->nbcon_locked_port)
return;
if (nbcon_context_exit_unsafe(&ctxt))
nbcon_context_release(&ctxt);
- con->locked_port = false;
+ up->nbcon_locked_port = false;
}
EXPORT_SYMBOL_GPL(nbcon_release);
--
2.34.1
next prev parent reply other threads:[~2024-01-23 5:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 6:52 [PATCH] printk: nbcon: check uart port is nbcon or not in nbcon_release Junxiao Chang
2024-01-17 8:23 ` John Ogness
2024-01-17 8:45 ` Chang, Junxiao
2024-01-17 10:03 ` John Ogness
2024-01-17 10:24 ` Sebastian Andrzej Siewior
2024-01-17 13:08 ` Chang, Junxiao
2024-01-17 13:42 ` John Ogness
2024-01-23 3:05 ` Chang, Junxiao
2024-01-23 5:40 ` [PATCH 0/2] nbcon locking issue with v6.6.10-rt18 kernel Junxiao Chang
2024-01-23 5:40 ` Junxiao Chang [this message]
2024-01-24 9:47 ` [PATCH 1/2] printk: nbcon: move locked_port flag to struct uart_port John Ogness
2024-01-24 10:05 ` Sebastian Andrzej Siewior
2024-01-25 1:08 ` Chang, Junxiao
2024-01-25 13:35 ` Sebastian Andrzej Siewior
2024-01-25 23:20 ` Chang, Junxiao
2024-01-26 7:58 ` John Ogness
2024-01-26 16:39 ` Sebastian Andrzej Siewior
2024-01-23 5:40 ` [PATCH 2/2] printk: nbcon: check uart port is nbcon or not in nbcon_release Junxiao Chang
2024-01-24 9:57 ` John Ogness
2024-01-26 2:33 ` Chang, Junxiao
2024-01-24 9:40 ` [PATCH 0/2] nbcon locking issue with v6.6.10-rt18 kernel John Ogness
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=20240123054033.183114-2-junxiao.chang@intel.com \
--to=junxiao.chang@intel.com \
--cc=bigeasy@linutronix.de \
--cc=hao3.li@intel.com \
--cc=jianfeng.gao@intel.com \
--cc=john.ogness@linutronix.de \
--cc=lili.li@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox