mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
Merge branch 'rework/console-list-lock' into for-linus
This commit is contained in:
commit
21493c6e96
3 changed files with 12 additions and 15 deletions
|
@ -171,6 +171,7 @@ static int configure_kgdboc(void)
|
||||||
int err = -ENODEV;
|
int err = -ENODEV;
|
||||||
char *cptr = config;
|
char *cptr = config;
|
||||||
struct console *cons;
|
struct console *cons;
|
||||||
|
int cookie;
|
||||||
|
|
||||||
if (!strlen(config) || isspace(config[0])) {
|
if (!strlen(config) || isspace(config[0])) {
|
||||||
err = 0;
|
err = 0;
|
||||||
|
@ -189,20 +190,9 @@ static int configure_kgdboc(void)
|
||||||
if (kgdboc_register_kbd(&cptr))
|
if (kgdboc_register_kbd(&cptr))
|
||||||
goto do_register;
|
goto do_register;
|
||||||
|
|
||||||
/*
|
|
||||||
* tty_find_polling_driver() can call uart_set_options()
|
|
||||||
* (via poll_init) to configure the uart. Take the console_list_lock
|
|
||||||
* in order to synchronize against register_console(), which can also
|
|
||||||
* configure the uart via uart_set_options(). This also allows safe
|
|
||||||
* traversal of the console list.
|
|
||||||
*/
|
|
||||||
console_list_lock();
|
|
||||||
|
|
||||||
p = tty_find_polling_driver(cptr, &tty_line);
|
p = tty_find_polling_driver(cptr, &tty_line);
|
||||||
if (!p) {
|
if (!p)
|
||||||
console_list_unlock();
|
|
||||||
goto noconfig;
|
goto noconfig;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Take console_lock to serialize device() callback with
|
* Take console_lock to serialize device() callback with
|
||||||
|
@ -211,7 +201,8 @@ static int configure_kgdboc(void)
|
||||||
*/
|
*/
|
||||||
console_lock();
|
console_lock();
|
||||||
|
|
||||||
for_each_console(cons) {
|
cookie = console_srcu_read_lock();
|
||||||
|
for_each_console_srcu(cons) {
|
||||||
int idx;
|
int idx;
|
||||||
if (cons->device && cons->device(cons, &idx) == p &&
|
if (cons->device && cons->device(cons, &idx) == p &&
|
||||||
idx == tty_line) {
|
idx == tty_line) {
|
||||||
|
@ -219,11 +210,10 @@ static int configure_kgdboc(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console_srcu_read_unlock(cookie);
|
||||||
|
|
||||||
console_unlock();
|
console_unlock();
|
||||||
|
|
||||||
console_list_unlock();
|
|
||||||
|
|
||||||
kgdb_tty_driver = p;
|
kgdb_tty_driver = p;
|
||||||
kgdb_tty_line = tty_line;
|
kgdb_tty_line = tty_line;
|
||||||
|
|
||||||
|
|
|
@ -2212,6 +2212,9 @@ EXPORT_SYMBOL_GPL(uart_parse_options);
|
||||||
* @parity: parity character - 'n' (none), 'o' (odd), 'e' (even)
|
* @parity: parity character - 'n' (none), 'o' (odd), 'e' (even)
|
||||||
* @bits: number of data bits
|
* @bits: number of data bits
|
||||||
* @flow: flow control character - 'r' (rts)
|
* @flow: flow control character - 'r' (rts)
|
||||||
|
*
|
||||||
|
* Locking: Caller must hold console_list_lock in order to serialize
|
||||||
|
* early initialization of the serial-console lock.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
uart_set_options(struct uart_port *port, struct console *co,
|
uart_set_options(struct uart_port *port, struct console *co,
|
||||||
|
@ -2619,7 +2622,9 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options)
|
||||||
|
|
||||||
if (!ret && options) {
|
if (!ret && options) {
|
||||||
uart_parse_options(options, &baud, &parity, &bits, &flow);
|
uart_parse_options(options, &baud, &parity, &bits, &flow);
|
||||||
|
console_list_lock();
|
||||||
ret = uart_set_options(port, NULL, baud, parity, bits, flow);
|
ret = uart_set_options(port, NULL, baud, parity, bits, flow);
|
||||||
|
console_list_unlock();
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&tport->mutex);
|
mutex_unlock(&tport->mutex);
|
||||||
|
|
|
@ -123,6 +123,7 @@ bool console_srcu_read_lock_is_held(void)
|
||||||
{
|
{
|
||||||
return srcu_read_lock_held(&console_srcu);
|
return srcu_read_lock_held(&console_srcu);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(console_srcu_read_lock_is_held);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum devkmsg_log_bits {
|
enum devkmsg_log_bits {
|
||||||
|
@ -1891,6 +1892,7 @@ static void console_lock_spinning_enable(void)
|
||||||
/**
|
/**
|
||||||
* console_lock_spinning_disable_and_check - mark end of code where another
|
* console_lock_spinning_disable_and_check - mark end of code where another
|
||||||
* thread was able to busy wait and check if there is a waiter
|
* thread was able to busy wait and check if there is a waiter
|
||||||
|
* @cookie: cookie returned from console_srcu_read_lock()
|
||||||
*
|
*
|
||||||
* This is called at the end of the section where spinning is allowed.
|
* This is called at the end of the section where spinning is allowed.
|
||||||
* It has two functions. First, it is a signal that it is no longer
|
* It has two functions. First, it is a signal that it is no longer
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue