Lines Matching defs: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
268 * console_list_unlock - Unlock the console list
281 * SRCU-protected console list
283 * Use for_each_console_srcu() to iterate the console list
297 * the SRCU-protected console list
325 * because spindump/WARN/etc from under console ->lock will
353 * keeping track if we have the console semaphore held. It's
356 * paths in the console code where we end up in places I want
357 * locked without the console semaphore held).
362 * Array of consoles built from command line options (console=)
373 /* Flag: console code may call schedule() */
443 * Specifies if a legacy console is registered. If legacy consoles are
444 * present, it is necessary to perform the console lock/unlock dance
445 * whenever console flushing should occur.
450 * Specifies if an nbcon console is registered. If nbcon consoles are present,
457 * Specifies if a boot console is registered. If boot consoles are present,
459 * the console lock. This is because boot consoles and nbcon consoles may
1285 "ignore loglevel setting (prints all kernel messages to the console)");
1783 /* Disable logging to console */
1789 /* Enable logging to console */
1796 /* Set level of messages printed to console */
1803 /* Implicitly re-enable logging to console */
2034 * The owner passed the console lock to us.
2035 * Since we did not spin on console lock, annotate
2473 * Try to acquire and then immediately release the console
2511 static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress);
2523 static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress) { return true; }
2528 struct console *early_console;
2553 * @c console was defined by the user on the command line.
2557 /* At least one console defined by the user on the command line. */
2572 * We use a signed short index for struct console for device drivers to
2574 * value is not valid when the console name and index are defined on
2622 * Set up a console. Called via do_early_param() in init/main.c
2623 * for each "console=" parameter in the boot command line.
2637 * console="" or console=null have been suggested as a way to
2638 * disable console output. Use ttynull that has been created
2649 /* For a DEVNAME:0.0 style console the character device is unknown early */
2689 __setup("console=", console_setup);
2695 * @options: options for this console
2697 * The last preferred console added will be used for kernel messages
2699 * above to handle user-supplied console arguments; however it can also
2701 * commonly to provide a default console (ie from PROM variables) when
2710 * match_devname_and_update_preferred_console - Update a preferred console
2713 * @name: Name of the corresponding console driver, e.g. "ttyS"
2717 * preferred via the console=DEVNAME:0.0 command line option.
2718 * It fills the missing console driver name and console index
2724 * could predict which console driver name and index this device
2742 pr_info("associate the preferred console \"%s\" with \"%s%d\"\n",
2765 MODULE_PARM_DESC(console_suspend, "suspend console during suspend"
2778 MODULE_PARM_DESC(console_no_auto_verbose, "Disable console loglevel raise to highest on oops/panic/etc");
2781 * console_suspend_all - suspend the console subsystem
2787 struct console *con;
2790 pr_info("Suspending console(s) (use no_console_suspend to debug)\n");
2793 * Flush any console backlog and then avoid queueing irq_work until
2821 struct console *con;
2824 * Allow queueing irq_work. After restoring console state, deferred
2826 * is now a console backlog.
2856 * console_cpu_notify - print deferred console messages after CPU hotplug
2860 * will be printed on the console only if there are CON_ANYTIME consoles.
2881 * console_lock - block the console subsystem from printing
2903 * console_trylock - try to block the console subsystem from printing
3019 * console output.
3062 * has level above the console loglevel.
3080 * The legacy console always acquires a spinlock_t from its printing
3105 * Used as the printk buffers for non-panic, serialized console printing.
3112 * Print one record for the given console. The record printed is whatever
3113 * record is the next available record for the given console.
3121 * Returns false if the given console has no next record to print, otherwise
3126 static bool console_emit_next_record(struct console *con, bool *handover, int cookie)
3199 static bool console_emit_next_record(struct console *con, bool *handover, int cookie)
3211 * Print out one record for each console.
3239 struct console *con;
3288 * A usable console made progress. There might still be
3325 * Returns true when there was at least one usable console and all messages
3361 * console registration path, and should invoke cond_resched()
3363 * scheduling stall on a slow console leading to RCU stall and
3388 * console_flush_all() but before unlocking the console.
3396 * console_unlock - unblock the legacy console subsystem from printing
3399 * the legacy console subsystem.
3401 * While the console_lock was held, console output may have been buffered
3422 struct console *c;
3428 * console lock, which in particular can be dangerous if
3446 * Stop console printing because the unblank() callback may
3447 * assume the console is not within its write() callback.
3458 * Attempting to trylock the console lock can deadlock
3496 struct console *c;
3522 * console_flush_on_panic - flush console content on panic
3534 * Ignore the console lock and flush out the messages. Attempting a
3544 * If another context is holding the console lock,
3563 * Return the console tty driver structure and its associated index
3567 struct console *c;
3573 * other console operations. For example, fg_console is
3593 * Prevent further output on the passed console device so that (for example)
3594 * serial drivers can suspend console output before suspending a port, and can
3597 void console_suspend(struct console *console)
3599 __pr_flush(console, 1000, true);
3601 console_srcu_write_flags(console, console->flags & ~CON_ENABLED);
3606 * be able to see that this console is disabled so that (for example)
3614 void console_resume(struct console *console)
3620 console_srcu_write_flags(console, console->flags | CON_ENABLED);
3621 is_nbcon = console->flags & CON_NBCON;
3633 nbcon_kthread_wake(console);
3637 __pr_flush(console, 1000, true);
3642 static int unregister_console_locked(struct console *console);
3652 struct console *con;
3736 * It is important that console printing threads are scheduled
3754 struct console *con;
3791 struct console *con;
3821 * Printer threads cannot be started as long as any boot console is
3823 * registers between boot console code and regular console code.
3825 * an nbcon console is registered.
3866 pr_info("debug: skip boot console de-registration.\n");
3873 static int console_call_setup(struct console *newcon, char *options)
3880 /* Synchronize with possible boot console. */
3890 * the newly registered console with any of the ones selected
3897 static int try_enable_preferred_console(struct console *newcon,
3947 /* Try to enable the console unconditionally */
3948 static void try_enable_default_console(struct console *newcon)
3962 /* Return the starting sequence number for a newly registered console. */
3963 static u64 get_init_console_seq(struct console *newcon, bool bootcon_registered)
3965 struct console *con;
3981 * device as @newcon. Since it is not known which boot console
3983 * start with the message of the enabled boot console that is
3988 * Hold the console_lock to stop console printing and
3989 * guarantee safe access to console->seq.
3994 * Flush all consoles and set the console to start at
4037 hlist_entry(console_list.first, struct console, node)
4039 static int unregister_console_locked(struct console *console);
4042 * The console driver calls this routine during kernel initialization
4043 * to register the console printing procedure with printk() and to
4045 * console driver was initialized.
4055 * - As soon as a "real" console is registered, all bootconsoles
4057 * - Once a "real" console is registered, any attempt to register a
4060 void register_console(struct console *newcon)
4065 struct console *con;
4073 if (WARN(con == newcon, "console '%s%d' already registered\n",
4093 * Ensure the nbcon console buffers can be allocated
4101 * See if we want to enable this console driver by default.
4103 * Nope when a console is preferred by the command line, device
4106 * The first real console with tty binding (driver) wins. More
4109 * Note that a console with tty binding will have CON_CONSDEV
4119 /* See if this console matches one we selected on the command line */
4126 /* printk() messages are not printed to the Braille console. */
4134 * If we have a bootconsole, and are switching to a real console,
4135 * don't print everything out again, since when the boot console, and
4136 * the real console are the same physical device, it's annoying to
4160 * console, it will not be aware of the nbcon synchronization. This
4162 * simultaneously if this new console is used for atomic printing
4166 * in use while this new console transitions to being registered.
4172 * Put this console in the list - keep the
4191 * on all contexts being able to see the new console before
4195 /* This new console is now registered. */
4202 * By unregistering the bootconsoles after we enable the real console
4203 * we get the "console xxx enabled" message on all the consoles -
4206 * went to the bootconsole (that they do not see on the real console)
4220 /* Changed console list, may require printer threads to start/stop. */
4228 static int unregister_console_locked(struct console *console)
4230 bool use_device_lock = (console->flags & CON_NBCON) && console->write_atomic;
4235 struct console *c;
4240 con_printk(KERN_INFO, console, "disabled\n");
4242 res = _braille_unregister_console(console);
4248 if (!console_is_registered_locked(console))
4250 else if (console_is_usable(console, console->flags, true))
4251 __pr_flush(console, 1000, true);
4254 console_srcu_write_flags(console, console->flags & ~CON_ENABLED);
4261 * in use while this console transitions to being unregistered.
4264 console->device_lock(console, &flags);
4266 hlist_del_init_rcu(&console->node);
4269 console->device_unlock(console, flags);
4273 * If this isn't the last console and it has CON_CONSDEV set, we
4274 * need to set it on the next preferred console.
4278 * console has any device attached. Oh well....
4280 if (!hlist_empty(&console_list) && console->flags & CON_CONSDEV)
4285 * must not be able to see this console in the list so that any
4291 * With this console gone, the global flags tracking registered
4292 * console types may have changed. Update them.
4311 if (console->flags & CON_NBCON)
4312 nbcon_free(console);
4316 if (console->exit)
4317 res = console->exit(console);
4319 /* Changed console list, may require printer threads to start/stop. */
4325 int unregister_console(struct console *console)
4330 res = unregister_console_locked(console);
4337 * console_force_preferred_locked - force a registered console preferred
4338 * @con: The registered console to force preferred.
4342 void console_force_preferred_locked(struct console *con)
4344 struct console *cur_pref_con;
4356 * Delete, but do not re-initialize the entry. This allows the console
4358 * checks), even though it was briefly removed from the console list.
4363 * Ensure that all SRCU list walks have completed so that the console
4364 * can be added to the beginning of the console list and its forward
4379 * Initialize the console device. This is called *early*, so
4399 * set up the console device so that later boot sequences can
4403 trace_initcall_level("console");
4419 * module, the real console hasn't registered yet at this point, there will
4420 * be a brief interval in which no messages are logged to the console, which
4425 * get unregistered when the real preferred console is registered.
4430 struct console *con;
4468 /* If @con is specified, only wait for that console. Otherwise wait for all. */
4469 static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress)
4474 struct console *c;
4507 * console->seq. Releasing console_lock flushes more
4513 * console could register at any time. Always hold the
4581 * Context: Process context. May sleep while acquiring console lock.
4624 * It is not allowed to call this function when console irq_work
4654 * and the console printing of those records has already occurred or is
4667 * console printing in a deferred context
4670 * this context is responsible for console printing those records, but
4671 * the current context is not allowed to perform the console printing.
4672 * Trigger an irq_work context to perform the console printing. This
4692 * This is best effort. Depending on the system state, console states,
5039 * Try to obtain lock on console subsystem and replay all