mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2025-04-19 20:58:31 +09:00
printk changes for 6.15
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEESH4wyp42V4tXvYsjUqAMR0iAlPIFAmflJC4ACgkQUqAMR0iA lPIEMBAAsIJmQPHdZUQ49tkMGMoQPU9gnrrDZbRzN9IWwMQQymwEobSEkJkrx7O3 MFQHc5Z29cAxDqrWDCG5hrH0P3rd994pLPgC/XZC9+UbksYIkIrudCqaPaekLVaw BQmBZnZRe7PltOiDpx/TxQ8WQgNlAmZpLpIRTB3ePHZpikq/mf4CGcoYXkrNij1j E7uzurLZssJwXasRkWOVNvaOFyVcxrjn78H0JoT7mVeh2IUkWyMALX4IyDeD6Uvh SCe19/6W3Uyeh/jpJ6+gjuirVy/Vam/2GXeer4yKpgSQBtsqIaGyki4Cc6Xy12gU 71nRPTggysZXNnqZ40qw68Irb9JGAo63qFDwWf3OQI+yQQWHyGZIinxr+2xupwWF ZgmDJtvUsWKHT4+WmB9+MVTGW7Jy8wKq2u/Haf8xCJxs2yhI0J8iUvQi3CPAMdRH Q8G9UJP29Lfj0hdKVT2/wVNGxZKIZ8c6v1vR6Rd1hJ0Zqp4Oj+XGr0btE8Ah5LYv GI/M00LCdTNT2kBbbw8lekovUIs2stiRl6hfKoQFR11oiZwFDUePLDdJH2GiJAZm g9fPs6YuBERfPtzUeo9a9UbSd6oPTLgLNBEklpHUTWilzO8E/Jh+ZXyvQwj7eXyq Hi4OnShn1uxL68o6DJfKsF2qW8S2U5g61JrU3D1CaQ98Derrp0o= =lNTZ -----END PGP SIGNATURE----- Merge tag 'printk-for-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux Pull printk updates from Petr Mladek: - New option "printk.debug_non_panic_cpus" allows to store printk messages from non-panic CPUs during panic. It might be useful when panic() fails. It is disabled by default because it increases the chance to see the messages printed before panic() and on the panic-CPU. - New build option "CONFIG_NULL_TTY_DEFAULT_CONSOLE" allows to build kernel without the virtual terminal support which prefers ttynull over serial console. - Do not unblank suspended consoles. - Some code clean up. * tag 'printk-for-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: printk/panic: Add option to allow non-panic CPUs to write to the ring buffer. printk: Add an option to allow ttynull to be a default console device printk: Check CON_SUSPEND when unblanking a console printk: Rename console_start to console_resume printk: Rename console_stop to console_suspend printk: Rename resume_console to console_resume_all printk: Rename suspend_console to console_suspend_all
This commit is contained in:
commit
96050814a3
@ -5020,6 +5020,14 @@
|
||||
Format: <bool>
|
||||
default: 0 (auto_verbose is enabled)
|
||||
|
||||
printk.debug_non_panic_cpus=
|
||||
Allows storing messages from non-panic CPUs into
|
||||
the printk log buffer during panic(). They are
|
||||
flushed to consoles by the panic-CPU on
|
||||
a best-effort basis.
|
||||
Format: <bool> (1/Y/y=enable, 0/N/n=disable)
|
||||
Default: disabled
|
||||
|
||||
printk.devkmsg={on,off,ratelimit}
|
||||
Control writing to /dev/kmsg.
|
||||
on - unlimited logging to /dev/kmsg from userspace
|
||||
|
@ -78,7 +78,9 @@ If no console device is specified, the first device found capable of
|
||||
acting as a system console will be used. At this time, the system
|
||||
first looks for a VGA card and then for a serial port. So if you don't
|
||||
have a VGA card in your system the first serial port will automatically
|
||||
become the console.
|
||||
become the console, unless the kernel is configured with the
|
||||
CONFIG_NULL_TTY_DEFAULT_CONSOLE option, then it will default to using the
|
||||
ttynull device.
|
||||
|
||||
You will need to create a new device to use ``/dev/console``. The official
|
||||
``/dev/console`` is now character device 5,1.
|
||||
|
@ -323,7 +323,7 @@ static int drm_log_client_suspend(struct drm_client_dev *client, bool _console_l
|
||||
{
|
||||
struct drm_log *dlog = client_to_drm_log(client);
|
||||
|
||||
console_stop(&dlog->con);
|
||||
console_suspend(&dlog->con);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -332,7 +332,7 @@ static int drm_log_client_resume(struct drm_client_dev *client, bool _console_lo
|
||||
{
|
||||
struct drm_log *dlog = client_to_drm_log(client);
|
||||
|
||||
console_start(&dlog->con);
|
||||
console_resume(&dlog->con);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -383,7 +383,24 @@ config NULL_TTY
|
||||
available or desired.
|
||||
|
||||
In order to use this driver, you should redirect the console to this
|
||||
TTY, or boot the kernel with console=ttynull.
|
||||
TTY, boot the kernel with console=ttynull, or enable
|
||||
NULL_TTY_DEFAULT_CONSOLE.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config NULL_TTY_DEFAULT_CONSOLE
|
||||
bool "Support for console on ttynull"
|
||||
depends on NULL_TTY=y && !VT_CONSOLE
|
||||
help
|
||||
Say Y here if you want the NULL TTY to be used as a /dev/console
|
||||
device by default.
|
||||
|
||||
For example, it might be useful to prevent a VT-less kernel from
|
||||
writing the system log to a random device connected to the serial
|
||||
port.
|
||||
|
||||
Another console driver still might get preferred via the command
|
||||
line, SPCR, or the device tree.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
|
@ -2426,10 +2426,10 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable the console device before suspending.
|
||||
* Suspend the console device before suspending the port.
|
||||
*/
|
||||
if (uart_console(uport))
|
||||
console_stop(uport->cons);
|
||||
console_suspend(uport->cons);
|
||||
|
||||
uart_change_pm(state, UART_PM_STATE_OFF);
|
||||
|
||||
@ -2484,7 +2484,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
|
||||
uart_port_unlock_irq(uport);
|
||||
}
|
||||
if (console_suspend_enabled)
|
||||
console_start(uport->cons);
|
||||
console_resume(uport->cons);
|
||||
}
|
||||
|
||||
if (tty_port_suspended(port)) {
|
||||
|
@ -633,8 +633,8 @@ extern void console_conditional_schedule(void);
|
||||
extern void console_unblank(void);
|
||||
extern void console_flush_on_panic(enum con_flush_mode mode);
|
||||
extern struct tty_driver *console_device(int *);
|
||||
extern void console_stop(struct console *);
|
||||
extern void console_start(struct console *);
|
||||
extern void console_suspend(struct console *);
|
||||
extern void console_resume(struct console *);
|
||||
extern int is_console_locked(void);
|
||||
extern int braille_register_console(struct console *, int index,
|
||||
char *console_options, char *braille_options);
|
||||
@ -648,8 +648,8 @@ static inline void console_sysfs_notify(void)
|
||||
extern bool console_suspend_enabled;
|
||||
|
||||
/* Suspend and resume console messages over PM events */
|
||||
extern void suspend_console(void);
|
||||
extern void resume_console(void);
|
||||
extern void console_suspend_all(void);
|
||||
extern void console_resume_all(void);
|
||||
|
||||
int mda_console_init(void);
|
||||
|
||||
|
@ -1013,7 +1013,7 @@ int kernel_kexec(void)
|
||||
error = -EBUSY;
|
||||
goto Restore_console;
|
||||
}
|
||||
suspend_console();
|
||||
console_suspend_all();
|
||||
error = dpm_suspend_start(PMSG_FREEZE);
|
||||
if (error)
|
||||
goto Resume_console;
|
||||
@ -1072,7 +1072,7 @@ int kernel_kexec(void)
|
||||
Resume_devices:
|
||||
dpm_resume_end(PMSG_RESTORE);
|
||||
Resume_console:
|
||||
resume_console();
|
||||
console_resume_all();
|
||||
thaw_processes();
|
||||
Restore_console:
|
||||
pm_restore_console();
|
||||
|
@ -411,7 +411,7 @@ int hibernation_snapshot(int platform_mode)
|
||||
goto Thaw;
|
||||
}
|
||||
|
||||
suspend_console();
|
||||
console_suspend_all();
|
||||
pm_restrict_gfp_mask();
|
||||
|
||||
error = dpm_suspend(PMSG_FREEZE);
|
||||
@ -437,7 +437,7 @@ int hibernation_snapshot(int platform_mode)
|
||||
if (error || !in_suspend)
|
||||
pm_restore_gfp_mask();
|
||||
|
||||
resume_console();
|
||||
console_resume_all();
|
||||
dpm_complete(msg);
|
||||
|
||||
Close:
|
||||
@ -547,7 +547,7 @@ int hibernation_restore(int platform_mode)
|
||||
int error;
|
||||
|
||||
pm_prepare_console();
|
||||
suspend_console();
|
||||
console_suspend_all();
|
||||
pm_restrict_gfp_mask();
|
||||
error = dpm_suspend_start(PMSG_QUIESCE);
|
||||
if (!error) {
|
||||
@ -561,7 +561,7 @@ int hibernation_restore(int platform_mode)
|
||||
}
|
||||
dpm_resume_end(PMSG_RECOVER);
|
||||
pm_restore_gfp_mask();
|
||||
resume_console();
|
||||
console_resume_all();
|
||||
pm_restore_console();
|
||||
return error;
|
||||
}
|
||||
@ -586,7 +586,7 @@ int hibernation_platform_enter(void)
|
||||
goto Close;
|
||||
|
||||
entering_platform_hibernation = true;
|
||||
suspend_console();
|
||||
console_suspend_all();
|
||||
error = dpm_suspend_start(PMSG_HIBERNATE);
|
||||
if (error) {
|
||||
if (hibernation_ops->recover)
|
||||
@ -639,7 +639,7 @@ int hibernation_platform_enter(void)
|
||||
Resume_devices:
|
||||
entering_platform_hibernation = false;
|
||||
dpm_resume_end(PMSG_RESTORE);
|
||||
resume_console();
|
||||
console_resume_all();
|
||||
|
||||
Close:
|
||||
hibernation_ops->end();
|
||||
@ -901,7 +901,7 @@ int hibernate_quiet_exec(int (*func)(void *data), void *data)
|
||||
if (error)
|
||||
goto dpm_complete;
|
||||
|
||||
suspend_console();
|
||||
console_suspend_all();
|
||||
|
||||
error = dpm_suspend(PMSG_FREEZE);
|
||||
if (error)
|
||||
@ -925,7 +925,7 @@ skip:
|
||||
dpm_resume:
|
||||
dpm_resume(PMSG_THAW);
|
||||
|
||||
resume_console();
|
||||
console_resume_all();
|
||||
|
||||
dpm_complete:
|
||||
dpm_complete(PMSG_THAW);
|
||||
|
@ -508,7 +508,7 @@ int suspend_devices_and_enter(suspend_state_t state)
|
||||
if (error)
|
||||
goto Close;
|
||||
|
||||
suspend_console();
|
||||
console_suspend_all();
|
||||
suspend_test_start();
|
||||
error = dpm_suspend_start(PMSG_SUSPEND);
|
||||
if (error) {
|
||||
@ -527,9 +527,9 @@ int suspend_devices_and_enter(suspend_state_t state)
|
||||
suspend_test_start();
|
||||
dpm_resume_end(PMSG_RESUME);
|
||||
suspend_test_finish("resume devices");
|
||||
trace_suspend_resume(TPS("resume_console"), state, true);
|
||||
resume_console();
|
||||
trace_suspend_resume(TPS("resume_console"), state, false);
|
||||
trace_suspend_resume(TPS("console_resume_all"), state, true);
|
||||
console_resume_all();
|
||||
trace_suspend_resume(TPS("console_resume_all"), state, false);
|
||||
|
||||
Close:
|
||||
platform_resume_end(state);
|
||||
|
@ -64,6 +64,7 @@ struct dev_printk_info;
|
||||
|
||||
extern struct printk_ringbuffer *prb;
|
||||
extern bool printk_kthreads_running;
|
||||
extern bool debug_non_panic_cpus;
|
||||
|
||||
__printf(4, 0)
|
||||
int vprintk_store(int facility, int level,
|
||||
|
@ -2375,6 +2375,22 @@ void printk_legacy_allow_panic_sync(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool __read_mostly debug_non_panic_cpus;
|
||||
|
||||
#ifdef CONFIG_PRINTK_CALLER
|
||||
static int __init debug_non_panic_cpus_setup(char *str)
|
||||
{
|
||||
debug_non_panic_cpus = true;
|
||||
pr_info("allow messages from non-panic CPUs in panic()\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
early_param("debug_non_panic_cpus", debug_non_panic_cpus_setup);
|
||||
module_param(debug_non_panic_cpus, bool, 0644);
|
||||
MODULE_PARM_DESC(debug_non_panic_cpus,
|
||||
"allow messages from non-panic CPUs in panic()");
|
||||
#endif
|
||||
|
||||
asmlinkage int vprintk_emit(int facility, int level,
|
||||
const struct dev_printk_info *dev_info,
|
||||
const char *fmt, va_list args)
|
||||
@ -2391,7 +2407,9 @@ asmlinkage int vprintk_emit(int facility, int level,
|
||||
* non-panic CPUs are generating any messages, they will be
|
||||
* silently dropped.
|
||||
*/
|
||||
if (other_cpu_in_panic() && !panic_triggering_all_cpu_backtrace)
|
||||
if (other_cpu_in_panic() &&
|
||||
!debug_non_panic_cpus &&
|
||||
!panic_triggering_all_cpu_backtrace)
|
||||
return 0;
|
||||
|
||||
printk_get_console_flush_type(&ft);
|
||||
@ -2731,11 +2749,11 @@ module_param_named(console_no_auto_verbose, printk_console_no_auto_verbose, bool
|
||||
MODULE_PARM_DESC(console_no_auto_verbose, "Disable console loglevel raise to highest on oops/panic/etc");
|
||||
|
||||
/**
|
||||
* suspend_console - suspend the console subsystem
|
||||
* console_suspend_all - suspend the console subsystem
|
||||
*
|
||||
* This disables printk() while we go into suspend states
|
||||
*/
|
||||
void suspend_console(void)
|
||||
void console_suspend_all(void)
|
||||
{
|
||||
struct console *con;
|
||||
|
||||
@ -2758,7 +2776,7 @@ void suspend_console(void)
|
||||
synchronize_srcu(&console_srcu);
|
||||
}
|
||||
|
||||
void resume_console(void)
|
||||
void console_resume_all(void)
|
||||
{
|
||||
struct console_flush_type ft;
|
||||
struct console *con;
|
||||
@ -3340,7 +3358,12 @@ void console_unblank(void)
|
||||
*/
|
||||
cookie = console_srcu_read_lock();
|
||||
for_each_console_srcu(c) {
|
||||
if ((console_srcu_read_flags(c) & CON_ENABLED) && c->unblank) {
|
||||
short flags = console_srcu_read_flags(c);
|
||||
|
||||
if (flags & CON_SUSPENDED)
|
||||
continue;
|
||||
|
||||
if ((flags & CON_ENABLED) && c->unblank) {
|
||||
found_unblank = true;
|
||||
break;
|
||||
}
|
||||
@ -3377,7 +3400,12 @@ void console_unblank(void)
|
||||
|
||||
cookie = console_srcu_read_lock();
|
||||
for_each_console_srcu(c) {
|
||||
if ((console_srcu_read_flags(c) & CON_ENABLED) && c->unblank)
|
||||
short flags = console_srcu_read_flags(c);
|
||||
|
||||
if (flags & CON_SUSPENDED)
|
||||
continue;
|
||||
|
||||
if ((flags & CON_ENABLED) && c->unblank)
|
||||
c->unblank();
|
||||
}
|
||||
console_srcu_read_unlock(cookie);
|
||||
@ -3495,10 +3523,10 @@ struct tty_driver *console_device(int *index)
|
||||
|
||||
/*
|
||||
* Prevent further output on the passed console device so that (for example)
|
||||
* serial drivers can disable console output before suspending a port, and can
|
||||
* serial drivers can suspend console output before suspending a port, and can
|
||||
* re-enable output afterwards.
|
||||
*/
|
||||
void console_stop(struct console *console)
|
||||
void console_suspend(struct console *console)
|
||||
{
|
||||
__pr_flush(console, 1000, true);
|
||||
console_list_lock();
|
||||
@ -3513,9 +3541,9 @@ void console_stop(struct console *console)
|
||||
*/
|
||||
synchronize_srcu(&console_srcu);
|
||||
}
|
||||
EXPORT_SYMBOL(console_stop);
|
||||
EXPORT_SYMBOL(console_suspend);
|
||||
|
||||
void console_start(struct console *console)
|
||||
void console_resume(struct console *console)
|
||||
{
|
||||
struct console_flush_type ft;
|
||||
bool is_nbcon;
|
||||
@ -3540,7 +3568,7 @@ void console_start(struct console *console)
|
||||
|
||||
__pr_flush(console, 1000, true);
|
||||
}
|
||||
EXPORT_SYMBOL(console_start);
|
||||
EXPORT_SYMBOL(console_resume);
|
||||
|
||||
#ifdef CONFIG_PRINTK
|
||||
static int unregister_console_locked(struct console *console);
|
||||
@ -4275,6 +4303,11 @@ void __init console_init(void)
|
||||
initcall_t call;
|
||||
initcall_entry_t *ce;
|
||||
|
||||
#ifdef CONFIG_NULL_TTY_DEFAULT_CONSOLE
|
||||
if (!console_set_on_cmdline)
|
||||
add_preferred_console("ttynull", 0, NULL);
|
||||
#endif
|
||||
|
||||
/* Setup the default TTY line discipline. */
|
||||
n_tty_init();
|
||||
|
||||
|
@ -2133,9 +2133,9 @@ static bool _prb_read_valid(struct printk_ringbuffer *rb, u64 *seq,
|
||||
* there may be other finalized records beyond that
|
||||
* need to be printed for a panic situation. If this
|
||||
* is the panic CPU, skip this
|
||||
* non-existent/non-finalized record unless it is
|
||||
* at or beyond the head, in which case it is not
|
||||
* possible to continue.
|
||||
* non-existent/non-finalized record unless non-panic
|
||||
* CPUs are still running and their debugging is
|
||||
* explicitly enabled.
|
||||
*
|
||||
* Note that new messages printed on panic CPU are
|
||||
* finalized when we are here. The only exception
|
||||
@ -2143,10 +2143,13 @@ static bool _prb_read_valid(struct printk_ringbuffer *rb, u64 *seq,
|
||||
* But it would have the sequence number returned
|
||||
* by "prb_next_reserve_seq() - 1".
|
||||
*/
|
||||
if (this_cpu_in_panic() && ((*seq + 1) < prb_next_reserve_seq(rb)))
|
||||
if (this_cpu_in_panic() &&
|
||||
(!debug_non_panic_cpus || legacy_allow_panic_sync) &&
|
||||
((*seq + 1) < prb_next_reserve_seq(rb))) {
|
||||
(*seq)++;
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,13 +122,13 @@ freeze_processes:
|
||||
freeze_kernel_threads:
|
||||
pm_restrict_gfp_mask:
|
||||
acpi_suspend_begin:
|
||||
suspend_console:
|
||||
console_suspend_all:
|
||||
acpi_pm_prepare:
|
||||
syscore_suspend:
|
||||
arch_enable_nonboot_cpus_end:
|
||||
syscore_resume:
|
||||
acpi_pm_finish:
|
||||
resume_console:
|
||||
console_resume_all:
|
||||
acpi_pm_end:
|
||||
pm_restore_gfp_mask:
|
||||
thaw_processes:
|
||||
|
@ -210,13 +210,13 @@ class SystemValues:
|
||||
'hibernate_preallocate_memory': {},
|
||||
'create_basic_memory_bitmaps': {},
|
||||
'swsusp_write': {},
|
||||
'suspend_console': {},
|
||||
'console_suspend_all': {},
|
||||
'acpi_pm_prepare': {},
|
||||
'syscore_suspend': {},
|
||||
'arch_enable_nonboot_cpus_end': {},
|
||||
'syscore_resume': {},
|
||||
'acpi_pm_finish': {},
|
||||
'resume_console': {},
|
||||
'console_resume_all': {},
|
||||
'acpi_pm_end': {},
|
||||
'pm_restore_gfp_mask': {},
|
||||
'thaw_processes': {},
|
||||
@ -3459,7 +3459,7 @@ def parseTraceLog(live=False):
|
||||
tracewatch = ['irq_wakeup']
|
||||
if sysvals.usekprobes:
|
||||
tracewatch += ['sync_filesystems', 'freeze_processes', 'syscore_suspend',
|
||||
'syscore_resume', 'resume_console', 'thaw_processes', 'CPU_ON',
|
||||
'syscore_resume', 'console_resume_all', 'thaw_processes', 'CPU_ON',
|
||||
'CPU_OFF', 'acpi_suspend']
|
||||
|
||||
# extract the callgraph and traceevent data
|
||||
|
Loading…
x
Reference in New Issue
Block a user