Lines Matching full:console

7 #include <linux/console.h>
25 * Printk console printing implementation for consoles which does not depend
28 * The state of the console is maintained in the "nbcon_state" atomic
31 * The console is locked when:
34 * console. Only higher priority contexts are allowed to take over the
35 * lock. A value of 0 (NBCON_PRIO_NONE) means the console is not locked.
37 * - The 'cpu' field denotes on which CPU the console is locked. It is used
49 * - The 'unsafe' field allows to take over the console in a safe way in the
51 * shared resources or when the console device is manipulated. It can be
52 * cleared, for example, after emitting one character when the console
56 * console in an unsafe state. The console will stay in the unsafe state
61 * 1) Direct acquire when the console is not owned or is owned by a lower
65 * when the current owner has lower priority and the console is in an
73 * console.
80 * console state.
82 * b) Gives up console ownership by clearing the 'prio' field.
85 * console is an unsafe state. It is used only in panic() by the final
94 * All operations on @console::nbcon_state are atomic cmpxchg based to
105 * - Whether to spin-wait if there is already an owner and the console is
121 * nbcon_state_set - Helper function to set the console state
122 * @con: Console to update
125 * Only to be used when the console is not yet or no longer visible in the
128 static inline void nbcon_state_set(struct console *con, struct nbcon_state *new) in nbcon_state_set()
134 * nbcon_state_read - Helper function to read the console state
135 * @con: Console to read
138 static inline void nbcon_state_read(struct console *con, struct nbcon_state *state) in nbcon_state_read()
144 * nbcon_state_try_cmpxchg() - Helper function for atomic_try_cmpxchg() on console state
145 * @con: Console to update
151 static inline bool nbcon_state_try_cmpxchg(struct console *con, struct nbcon_state *cur, in nbcon_state_try_cmpxchg()
158 * nbcon_seq_read - Read the current console sequence
159 * @con: Console to read the sequence of
163 u64 nbcon_seq_read(struct console *con) in nbcon_seq_read()
171 * nbcon_seq_force - Force console sequence to a specific value
172 * @con: Console to work on
178 void nbcon_seq_force(struct console *con, u64 seq) in nbcon_seq_force()
192 * nbcon_seq_try_update - Try to update the console sequence number
200 * console. In the later case, it will stop printing anyway.
205 struct console *con = ctxt->console; in nbcon_seq_try_update()
218 * @cur: The current console state
220 * Acquire the console when it is released. Also acquire the console when
221 * the current owner has a lower priority and the console is in a safe state.
233 * -EBUSY: The current owner has a lower priority but the console
241 struct console *con = ctxt->console; in nbcon_context_try_acquire_direct()
246 * Panic does not imply that the console is owned. However, it in nbcon_context_try_acquire_direct()
262 * The console should never be safe for a direct acquire in nbcon_context_try_acquire_direct()
303 * Event #3 occurs when panic() has flushed the console. in nbcon_waiter_matches()
315 * @cur: The current console state
318 * It is called when the console is in an unsafe state. The current
319 * owner will release the console on exit from the unsafe region.
321 * Return: 0 on success and @cur is updated to the new console state.
329 * -EBUSY: The console is still locked. The caller should
339 struct console *con = ctxt->console; in nbcon_context_try_acquire_requested()
378 /* Handover success. This context now owns the console. */ in nbcon_context_try_acquire_requested()
385 * @cur: The current console state
388 * than the current owner and the console is in an unsafe state.
392 * the request. Then it waits until the current owner releases the console,
396 * region and releases the console. It does not touch the "req_prio" field
397 * so that the console stays reserved for the waiter.
406 * console or the handover request.
410 * willing to wait (zero timeout). Or the console does
422 struct console *con = ctxt->console; in nbcon_context_try_acquire_handover()
439 * Console stays unsafe after an unsafe takeover until re-initialized. in nbcon_context_try_acquire_handover()
451 * the console directly when the current state has been modified. in nbcon_context_try_acquire_handover()
460 /* Wait until there is no owner and then acquire the console. */ in nbcon_context_try_acquire_handover()
485 * the console or the handover request. in nbcon_context_try_acquire_handover()
515 * @cur: The current console state
517 * Acquire the console even in the unsafe state.
528 struct console *con = ctxt->console; in nbcon_context_try_acquire_hostile()
560 * nbcon_context_try_acquire - Try to acquire nbcon console
564 * Return: True if the console was acquired. False otherwise.
567 * caller should check the current console state to see if it is
569 * the console is not in an unsafe state.
574 struct console *con = ctxt->console; in nbcon_context_try_acquire()
604 ctxt->seq = nbcon_seq_read(ctxt->console); in nbcon_context_try_acquire()
633 * 4. [Task A] gets running on [CPU X] and sees that the console is in nbcon_owner_matches()
648 * nbcon_context_release - Release the console
654 struct console *con = ctxt->console; in nbcon_context_release()
681 * @cur: The current console state
683 * Return: True if this context still owns the console. False if
691 * It can be called inside an unsafe section when the console is just
700 * the console and is no longer allowed to go forward. In this case it must
708 /* Make sure this context still owns the console. */ in nbcon_context_can_proceed()
712 /* The console owner can proceed if there is no waiter. */ in nbcon_context_can_proceed()
717 * A console owner within an unsafe region is always allowed to in nbcon_context_can_proceed()
738 * outermost callsite must make the final decision whether console in nbcon_context_can_proceed()
742 * The calling context no longer owns the console so go back all the in nbcon_context_can_proceed()
753 * Return: True if this context still owns the console. False if
760 * It can be called inside an unsafe section when the console is just
768 * the console and is no longer allowed to go forward. In this case it must
775 struct console *con = ctxt->console; in nbcon_can_proceed()
793 * owns the console. Otherwise false if ownership was handed
796 * This function allows console owners to modify the unsafe status of the
797 * console.
800 * the console and is no longer allowed to go forward. In this case it must
808 struct console *con = ctxt->console; in __nbcon_context_update_unsafe()
838 struct console *con = ctxt->console; in nbcon_write_context_set_buf()
851 * Return: True if this context still owns the console. False if
855 * the console and is no longer allowed to go forward. In this case it must
875 * Return: True if this context still owns the console. False if
879 * the console and is no longer allowed to go forward. In this case it must
896 * nbcon_reacquire_nobuf - Reacquire a console after losing ownership
928 * Return: True if this context still owns the console. False if
932 * the console and is no longer allowed to go forward. In this case it must
935 * wants to do more it must reacquire the console first.
943 struct console *con = ctxt->console; in nbcon_emit_next_record()
1047 * dropped count for the console. in nbcon_emit_next_record()
1071 * nbcon_emit_one - Print one record for an nbcon console using the
1079 * False, when there is no pending record, or when the console
1084 * This is an internal helper to handle the locking of the console before
1090 struct console *con = ctxt->console; in nbcon_emit_one()
1108 * nbcon_emit_next_record() returns false when the console was in nbcon_emit_one()
1129 * @con: Console to operate on
1132 * Return: True if the thread should shutdown or if the console is
1138 static bool nbcon_kthread_should_wakeup(struct console *con, struct nbcon_context *ctxt) in nbcon_kthread_should_wakeup()
1163 * @__console: Console to operate on
1169 struct console *con = __console; in nbcon_kthread_func()
1171 .ctxt.console = con, in nbcon_kthread_func()
1222 * nbcon_irq_work - irq work to wake console printer thread
1227 struct console *con = container_of(irq_work, struct console, irq_work); in nbcon_irq_work()
1254 struct console *con; in nbcon_kthreads_wake()
1277 * nbcon_kthread_stop - Stop a console printer thread
1278 * @con: Console to operate on
1280 void nbcon_kthread_stop(struct console *con) in nbcon_kthread_stop()
1292 * nbcon_kthread_create - Create a console printer thread
1293 * @con: Console to operate on
1301 * be fatal for console registration.
1307 bool nbcon_kthread_create(struct console *con) in nbcon_kthread_create()
1325 * It is important that console printing threads are scheduled in nbcon_kthread_create()
1367 * Return: The nbcon_prio to use for acquiring an nbcon console in this
1389 * nbcon_legacy_emit_next_record - Print one record for an nbcon console
1391 * @con: The console to print on
1409 * False, when there is no pending record, or when the console
1415 * on nbcon consoles from legacy context (printing via console unlocking).
1418 bool nbcon_legacy_emit_next_record(struct console *con, bool *handover, in nbcon_legacy_emit_next_record()
1426 ctxt->console = con; in nbcon_legacy_emit_next_record()
1454 * __nbcon_atomic_flush_pending_con - Flush specified nbcon console using its
1456 * @con: The nbcon console to flush
1465 * -EPERM: Unable to acquire console ownership.
1473 * this context is not allowed to acquire the console. When -ENOENT is
1477 static int __nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq, in __nbcon_atomic_flush_pending_con()
1484 ctxt->console = con; in __nbcon_atomic_flush_pending_con()
1494 * nbcon_emit_next_record() returns false when the console was in __nbcon_atomic_flush_pending_con()
1514 * nbcon_atomic_flush_pending_con - Flush specified nbcon console using its
1516 * @con: The nbcon console to flush
1525 static void nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq, in nbcon_atomic_flush_pending_con()
1534 * Atomic flushing does not use console driver synchronization (i.e. in nbcon_atomic_flush_pending_con()
1537 * a driver that will deadlock trying to acquire console ownership. in nbcon_atomic_flush_pending_con()
1577 struct console *con; in __nbcon_atomic_flush_pending()
1661 * nbcon_alloc - Allocate and init the nbcon console specific data
1662 * @con: Console to initialize
1664 * Return: True if the console was fully allocated and initialized.
1667 * When allocation and init was successful, the console must be properly
1670 bool nbcon_alloc(struct console *con) in nbcon_alloc()
1692 * Boot console printing is synchronized with legacy console in nbcon_alloc()
1717 * nbcon_free - Free and cleanup the nbcon console specific data
1718 * @con: Console to free/cleanup nbcon data
1720 void nbcon_free(struct console *con) in nbcon_free()
1737 * nbcon_device_try_acquire - Try to acquire nbcon console and enter unsafe
1739 * @con: The nbcon console to acquire
1743 * Return: True if the console was acquired. False otherwise.
1745 * Console drivers will usually use their own internal synchronization
1746 * mechasism to synchronize between console printing and non-printing
1747 * activities (such as setting baud rates). However, nbcon console drivers
1752 * This function acquires the nbcon console using priority NBCON_PRIO_NORMAL
1755 bool nbcon_device_try_acquire(struct console *con) in nbcon_device_try_acquire()
1762 ctxt->console = con; in nbcon_device_try_acquire()
1776 * nbcon_device_release - Exit unsafe section and release the nbcon console
1777 * @con: The nbcon console acquired in nbcon_device_try_acquire()
1779 void nbcon_device_release(struct console *con) in nbcon_device_release()
1791 * This context must flush any new records added while the console in nbcon_device_release()
1793 * console_srcu_read_lock must be taken to ensure the console is in nbcon_device_release()