Skip to content
Permalink
Browse files
printk: suppress rcu stall warnings caused by slow console devices
If we have a reasonable large dataset to flush in the printk ring
buffer in the presence of a slow console device (like a serial port
with a low baud rate configured), the RCU stall detector may report
warnings.

This patch suppresses RCU stall warnings while flushing the ring buffer
to the console.

Signed-off-by: Wander Lairson Costa <wander@redhat.com>
  • Loading branch information
walac authored and intel-lab-lkp committed Nov 11, 2021
1 parent debe436 commit bb0661fcac8e6a708539fe465c8ad7f74ca920fa
Showing 1 changed file with 23 additions and 1 deletion.
@@ -2585,6 +2585,20 @@ static inline int can_use_console(void)
return cpu_online(raw_smp_processor_id()) || have_callable_console();
}

extern int rcu_cpu_stall_suppress;

static void rcu_console_stall_suppress(void)
{
if (!rcu_cpu_stall_suppress)
rcu_cpu_stall_suppress = 4;
}

static void rcu_console_stall_unsuppress(void)
{
if (rcu_cpu_stall_suppress == 4)
rcu_cpu_stall_suppress = 0;
}

/**
* console_unlock - unlock the console system
*
@@ -2631,6 +2645,9 @@ void console_unlock(void)
* and cleared after the "again" goto label.
*/
do_cond_resched = console_may_schedule;

rcu_console_stall_suppress();

again:
console_may_schedule = 0;

@@ -2642,6 +2659,7 @@ void console_unlock(void)
if (!can_use_console()) {
console_locked = 0;
up_console_sem();
rcu_console_stall_unsuppress();
return;
}

@@ -2713,8 +2731,10 @@ void console_unlock(void)

handover = console_lock_spinning_disable_and_check();
printk_safe_exit_irqrestore(flags);
if (handover)
if (handover) {
rcu_console_stall_unsuppress();
return;
}

if (do_cond_resched)
cond_resched();
@@ -2735,6 +2755,8 @@ void console_unlock(void)
retry = prb_read_valid(prb, next_seq, NULL);
if (retry && console_trylock())
goto again;

rcu_console_stall_unsuppress();
}
EXPORT_SYMBOL(console_unlock);

0 comments on commit bb0661f

Please sign in to comment.