[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <875y4kx1eh.fsf@jogness.linutronix.de>
Date: Fri, 08 Sep 2023 15:09:34 +0206
From: John Ogness <john.ogness@...utronix.de>
To: Petr Mladek <pmladek@...e.com>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH printk v3 3/7] printk: nbcon: Add buffer management
On 2023-09-06, Petr Mladek <pmladek@...e.com> wrote:
>> +bool nbcon_alloc(struct console *con)
>> +{
>> +
>> + con->pbufs = kmalloc(sizeof(*con->pbufs), GFP_KERNEL);
>
> We might need to use memblock_alloc() at least for early consoles.
I wasn't planning on addressing early consoles at this stage. The
initial 8250 NBCON implementation will only be for the regular console.
However, since it is planned that NBCON consoles are synchronized with
boot consoles using the console_lock, we might as well establish that
boot consoles (in general) are always synchronized uisng the
console_lock.
This allows us to use the single global pbufs of the legacy consoles
(see console_emit_next_record()) for NBCON boot consoles as well. The
static buffer is much more attractive because it is always available.
For v4, nbcon_alloc() will initialize con->pbufs to use the global
legacy pbufs for con->flags == CON_BOOT.
bool nbcon_alloc(struct console *con)
{
if (con->flags & CON_BOOT) {
/*
* Boot console printing is synchronized with legacy console
* printing, so boot consoles can share the same global printk
* buffers.
*/
con->pbufs = &printk_shared_pbufs;
} else {
con->pbufs = kmalloc(sizeof(*con->pbufs), GFP_KERNEL);
if (!con->pbufs) {
con_printk(KERN_ERR, con, "failed to allocate printing buffer\n");
return false;
}
}
return true;
}
John Ogness
Powered by blists - more mailing lists