printk: Make the console flush configurable in hotplug path

The thread which initiates the hot plug can get scheduled
out, while trying to acquire the console lock,
thus increasing the hot plug latency. This option
allows to selectively disable the console flush and
in turn reduce the hot plug latency.

Change-Id: I42507804d321b29b7761146a6c175d959bf79925
Signed-off-by: Mohammed Khajapasha <[email protected]>
Signed-off-by: Elliot Berman <[email protected]>
This commit is contained in:
Mohammed Khajapasha 2015-09-04 20:33:31 +05:30 • committed by Elliot Berman
commit 29432c4eba
2 changed files with 18 additions and 2 deletions

View file

@ -2245,6 +2245,8 @@ void resume_console(void)
console_unlock();
}
#ifdef CONFIG_CONSOLE_FLUSH_ON_HOTPLUG
/**
* console_cpu_notify - print deferred console messages after CPU hotplug
* @cpu: unused
@ -2264,6 +2266,8 @@ static int console_cpu_notify(unsigned int cpu)
return 0;
}
#endif
/**
* console_lock - lock the console system for exclusive use.
*
@ -2894,7 +2898,7 @@ void __init console_init(void)
static int __init printk_late_init(void)
{
struct console *con;
int ret;
int ret = 0;
for_each_console(con) {
if (!(con->flags & CON_BOOT))
@ -2916,13 +2920,15 @@ static int __init printk_late_init(void)
unregister_console(con);
}
}
#ifdef CONFIG_CONSOLE_FLUSH_ON_HOTPLUG
ret = cpuhp_setup_state_nocalls(CPUHP_PRINTK_DEAD, "printk:dead", NULL,
console_cpu_notify);
WARN_ON(ret < 0);
ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "printk:online",
console_cpu_notify, NULL);
WARN_ON(ret < 0);
return 0;
#endif
return ret;
}
late_initcall(printk_late_init);