Lines Matching full:console

10  * to the console.  Added hook for sending the console messages
11 * elsewhere, in preparation for a serial line console (someday).
26 #include <linux/console.h>
76 EXPORT_TRACEPOINT_SYMBOL_GPL(console);
86 * console_mutex protects console_list updates and console->flags updates.
88 * accessible via the console list.
93 * console_sem protects updates to console->seq
94 * and also provides serialization for console printing.
243 * console_list_lock - Lock the console list
245 * For console list or console->flags updates
267 * console_list_unlock - Unlock the console list
279 * SRCU-protected console list
281 * Use for_each_console_srcu() to iterate the console list
295 * the SRCU-protected console list
323 * because spindump/WARN/etc from under console ->lock will in __down_trylock_console_sem()
351 * keeping track if we have the console semaphore held. It's
354 * paths in the console code where we end up in places I want
355 * locked without the console semaphore held).
360 * Array of consoles built from command line options (console=)
371 /* Flag: console code may call schedule() */
441 * Specifies if a legacy console is registered. If legacy consoles are
442 * present, it is necessary to perform the console lock/unlock dance
443 * whenever console flushing should occur.
448 * Specifies if an nbcon console is registered. If nbcon consoles are present,
455 * Specifies if a boot console is registered. If boot consoles are present,
457 * the console lock. This is because boot consoles and nbcon consoles may
1280 "ignore loglevel setting (prints all kernel messages to the console)");
1778 /* Disable logging to console */ in do_syslog()
1784 /* Enable logging to console */ in do_syslog()
1791 /* Set level of messages printed to console */ in do_syslog()
1798 /* Implicitly re-enable logging to console */ in do_syslog()
2029 * The owner passed the console lock to us. in console_trylock_spinning()
2030 * Since we did not spin on console lock, annotate in console_trylock_spinning()
2417 * Try to acquire and then immediately release the console in vprintk_emit()
2455 static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress);
2467 static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress) { return true; } in __pr_flush()
2472 struct console *early_console;
2497 * @c console was defined by the user on the command line. in set_user_specified()
2501 /* At least one console defined by the user on the command line. */ in set_user_specified()
2516 * We use a signed short index for struct console for device drivers to in __add_preferred_console()
2518 * value is not valid when the console name and index are defined on in __add_preferred_console()
2566 * Set up a console. Called via do_early_param() in init/main.c
2567 * for each "console=" parameter in the boot command line.
2581 * console="" or console=null have been suggested as a way to in console_setup()
2582 * disable console output. Use ttynull that has been created in console_setup()
2593 /* For a DEVNAME:0.0 style console the character device is unknown early */ in console_setup()
2633 __setup("console=", console_setup);
2639 * @options: options for this console
2641 * The last preferred console added will be used for kernel messages
2643 * above to handle user-supplied console arguments; however it can also
2645 * commonly to provide a default console (ie from PROM variables) when
2654 * match_devname_and_update_preferred_console - Update a preferred console
2657 * @name: Name of the corresponding console driver, e.g. "ttyS"
2658 * @idx: Console index, e.g. port number.
2661 * preferred via the console=DEVNAME:0.0 command line option.
2662 * It fills the missing console driver name and console index
2668 * could predict which console driver name and index this device
2686 pr_info("associate the preferred console \"%s\" with \"%s%d\"\n", in match_devname_and_update_preferred_console()
2709 MODULE_PARM_DESC(console_suspend, "suspend console during suspend"
2722 MODULE_PARM_DESC(console_no_auto_verbose, "Disable console loglevel raise to highest on oops/panic/…
2725 * console_suspend_all - suspend the console subsystem
2731 struct console *con; in console_suspend_all()
2735 pr_info("Suspending console(s) (use no_console_suspend to debug)\n"); in console_suspend_all()
2755 struct console *con; in console_resume_all()
2782 * console_cpu_notify - print deferred console messages after CPU hotplug
2786 * will be printed on the console only if there are CON_ANYTIME consoles.
2807 * console_lock - block the console subsystem from printing
2829 * console_trylock - try to block the console subsystem from printing
2945 * console output.
2987 * has level above the console loglevel. in printk_get_next_message()
3005 * Legacy console printing from printk() caller context does not respect
3011 * console write() callback when legacy printing to avoid false positive
3033 * Used as the printk buffers for non-panic, serialized console printing.
3040 * Print one record for the given console. The record printed is whatever
3041 * record is the next available record for the given console.
3049 * Returns false if the given console has no next record to print, otherwise
3054 static bool console_emit_next_record(struct console *con, bool *handover, int cookie) in console_emit_next_record()
3127 static bool console_emit_next_record(struct console *con, bool *handover, int cookie) in console_emit_next_record()
3151 * Returns true when there was at least one usable console and all messages
3164 struct console *con; in console_flush_all()
3243 * Console drivers are called with interrupts disabled, so in __console_flush_and_unlock()
3246 * console registration path, and should invoke cond_resched() in __console_flush_and_unlock()
3248 * scheduling stall on a slow console leading to RCU stall and in __console_flush_and_unlock()
3273 * console_flush_all() but before unlocking the console. in __console_flush_and_unlock()
3281 * console_unlock - unblock the legacy console subsystem from printing
3284 * the legacy console subsystem.
3286 * While the console_lock was held, console output may have been buffered
3307 * If the console code is currently allowed to sleep, and
3323 struct console *c; in console_unblank()
3329 * console lock, which in particular can be dangerous if in console_unblank()
3349 * Stop console printing because the unblank() callback may in console_unblank()
3350 * assume the console is not within its write() callback. in console_unblank()
3361 * Attempting to trylock the console lock can deadlock in console_unblank()
3401 struct console *c; in __console_rewind_all()
3427 * console_flush_on_panic - flush console content on panic
3439 * Ignore the console lock and flush out the messages. Attempting a in console_flush_on_panic()
3449 * If another context is holding the console lock, in console_flush_on_panic()
3468 * Return the console tty driver structure and its associated index
3472 struct console *c; in console_device()
3478 * other console operations. For example, fg_console is in console_device()
3498 * Prevent further output on the passed console device so that (for example)
3499 * serial drivers can suspend console output before suspending a port, and can
3502 void console_suspend(struct console *console) in console_suspend() argument
3504 __pr_flush(console, 1000, true); in console_suspend()
3506 console_srcu_write_flags(console, console->flags & ~CON_ENABLED); in console_suspend()
3511 * be able to see that this console is disabled so that (for example) in console_suspend()
3519 void console_resume(struct console *console) in console_resume() argument
3525 console_srcu_write_flags(console, console->flags | CON_ENABLED); in console_resume()
3526 is_nbcon = console->flags & CON_NBCON; in console_resume()
3538 nbcon_kthread_wake(console); in console_resume()
3542 __pr_flush(console, 1000, true); in console_resume()
3547 static int unregister_console_locked(struct console *console);
3557 struct console *con; in legacy_kthread_should_wakeup()
3632 * It is important that console printing threads are scheduled in legacy_kthread_create()
3649 struct console *con; in printk_kthreads_shutdown()
3682 struct console *con; in printk_kthreads_check_locked()
3712 * Printer threads cannot be started as long as any boot console is in printk_kthreads_check_locked()
3714 * registers between boot console code and regular console code. in printk_kthreads_check_locked()
3716 * an nbcon console is registered. in printk_kthreads_check_locked()
3757 pr_info("debug: skip boot console de-registration.\n"); in keep_bootcon_setup()
3764 static int console_call_setup(struct console *newcon, char *options) in console_call_setup()
3771 /* Synchronize with possible boot console. */ in console_call_setup()
3781 * the newly registered console with any of the ones selected
3788 static int try_enable_preferred_console(struct console *newcon, in try_enable_preferred_console()
3797 /* Console not yet initialized? */ in try_enable_preferred_console()
3838 /* Try to enable the console unconditionally */
3839 static void try_enable_default_console(struct console *newcon) in try_enable_default_console()
3853 /* Return the starting sequence number for a newly registered console. */
3854 static u64 get_init_console_seq(struct console *newcon, bool bootcon_registered) in get_init_console_seq()
3856 struct console *con; in get_init_console_seq()
3872 * device as @newcon. Since it is not known which boot console in get_init_console_seq()
3874 * start with the message of the enabled boot console that is in get_init_console_seq()
3879 * Hold the console_lock to stop console printing and in get_init_console_seq()
3880 * guarantee safe access to console->seq. in get_init_console_seq()
3885 * Flush all consoles and set the console to start at in get_init_console_seq()
3928 hlist_entry(console_list.first, struct console, node)
3930 static int unregister_console_locked(struct console *console);
3933 * The console driver calls this routine during kernel initialization
3934 * to register the console printing procedure with printk() and to
3936 * console driver was initialized.
3946 * - As soon as a "real" console is registered, all bootconsoles
3948 * - Once a "real" console is registered, any attempt to register a
3951 void register_console(struct console *newcon) in register_console()
3956 struct console *con; in register_console()
3964 if (WARN(con == newcon, "console '%s%d' already registered\n", in register_console()
3984 * Ensure the nbcon console buffers can be allocated in register_console()
3992 * See if we want to enable this console driver by default. in register_console()
3994 * Nope when a console is preferred by the command line, device in register_console()
3997 * The first real console with tty binding (driver) wins. More in register_console()
4000 * Note that a console with tty binding will have CON_CONSDEV in register_console()
4010 /* See if this console matches one we selected on the command line */ in register_console()
4017 /* printk() messages are not printed to the Braille console. */ in register_console()
4025 * If we have a bootconsole, and are switching to a real console, in register_console()
4026 * don't print everything out again, since when the boot console, and in register_console()
4027 * the real console are the same physical device, it's annoying to in register_console()
4051 * console, it will not be aware of the nbcon synchronization. This in register_console()
4053 * simultaneously if this new console is used for atomic printing in register_console()
4057 * in use while this new console transitions to being registered. in register_console()
4063 * Put this console in the list - keep the in register_console()
4082 * on all contexts being able to see the new console before in register_console()
4086 /* This new console is now registered. */ in register_console()
4093 * By unregistering the bootconsoles after we enable the real console in register_console()
4094 * we get the "console xxx enabled" message on all the consoles - in register_console()
4097 * went to the bootconsole (that they do not see on the real console) in register_console()
4111 /* Changed console list, may require printer threads to start/stop. */ in register_console()
4119 static int unregister_console_locked(struct console *console) in unregister_console_locked() argument
4121 bool use_device_lock = (console->flags & CON_NBCON) && console->write_atomic; in unregister_console_locked()
4126 struct console *c; in unregister_console_locked()
4131 con_printk(KERN_INFO, console, "disabled\n"); in unregister_console_locked()
4133 res = _braille_unregister_console(console); in unregister_console_locked()
4139 if (!console_is_registered_locked(console)) in unregister_console_locked()
4141 else if (console_is_usable(console, console->flags, true)) in unregister_console_locked()
4142 __pr_flush(console, 1000, true); in unregister_console_locked()
4145 console_srcu_write_flags(console, console->flags & ~CON_ENABLED); in unregister_console_locked()
4152 * in use while this console transitions to being unregistered. in unregister_console_locked()
4155 console->device_lock(console, &flags); in unregister_console_locked()
4157 hlist_del_init_rcu(&console->node); in unregister_console_locked()
4160 console->device_unlock(console, flags); in unregister_console_locked()
4164 * If this isn't the last console and it has CON_CONSDEV set, we in unregister_console_locked()
4165 * need to set it on the next preferred console. in unregister_console_locked()
4169 * console has any device attached. Oh well.... in unregister_console_locked()
4171 if (!hlist_empty(&console_list) && console->flags & CON_CONSDEV) in unregister_console_locked()
4176 * must not be able to see this console in the list so that any in unregister_console_locked()
4182 * With this console gone, the global flags tracking registered in unregister_console_locked()
4183 * console types may have changed. Update them. in unregister_console_locked()
4202 if (console->flags & CON_NBCON) in unregister_console_locked()
4203 nbcon_free(console); in unregister_console_locked()
4207 if (console->exit) in unregister_console_locked()
4208 res = console->exit(console); in unregister_console_locked()
4210 /* Changed console list, may require printer threads to start/stop. */ in unregister_console_locked()
4216 int unregister_console(struct console *console) in unregister_console() argument
4221 res = unregister_console_locked(console); in unregister_console()
4228 * console_force_preferred_locked - force a registered console preferred
4229 * @con: The registered console to force preferred.
4233 void console_force_preferred_locked(struct console *con) in console_force_preferred_locked()
4235 struct console *cur_pref_con; in console_force_preferred_locked()
4247 * Delete, but do not re-initialize the entry. This allows the console in console_force_preferred_locked()
4249 * checks), even though it was briefly removed from the console list. in console_force_preferred_locked()
4254 * Ensure that all SRCU list walks have completed so that the console in console_force_preferred_locked()
4255 * can be added to the beginning of the console list and its forward in console_force_preferred_locked()
4270 * Initialize the console device. This is called *early*, so
4290 * set up the console device so that later boot sequences can in console_init()
4294 trace_initcall_level("console"); in console_init()
4310 * module, the real console hasn't registered yet at this point, there will
4311 * be a brief interval in which no messages are logged to the console, which
4316 * get unregistered when the real preferred console is registered.
4321 struct console *con; in printk_late_init()
4359 /* If @con is specified, only wait for that console. Otherwise wait for all. */
4360 static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress) in __pr_flush()
4365 struct console *c; in __pr_flush()
4398 * console->seq. Releasing console_lock flushes more in __pr_flush()
4404 * console could register at any time. Always hold the in __pr_flush()
4472 * Context: Process context. May sleep while acquiring console lock.
4538 * and the console printing of those records has already occurred or is
4551 * console printing in a deferred context
4554 * this context is responsible for console printing those records, but
4555 * the current context is not allowed to perform the console printing.
4556 * Trigger an irq_work context to perform the console printing. This
4902 * Try to obtain lock on console subsystem and replay all