nbcon_kdb_try_acquire(9)
π nbcon_kdb_try_acquire β like, the kernel-api-manual moment of the day β¨
okay so bestie, this is the nbcon_kdb_try_acquire(9) page from the Kernel API Manual, and it's giving "tiny function, big responsibilities" energy. Let's get into it π«Ά
πΈ NAME πΈ
nbcon_kdb_try_acquire β literally tries to acquire the nbcon console and then enter the unsafe section. That's the whole vibe. No cap.
β¨ SYNOPSIS β¨
bool nbcon_kdb_try_acquire (struct console *con , struct
nbcon_write_context *wctxt );
(it returns a bool, in case you were wondering β spoiler: it's not always true π)
π ARGUMENTS π
conβ the nbcon console you're trying to acquire. like, the one. the main character console πwctxtβ the nbcon write context that gets used if it works out (i.e. on success π)
π¦ CONTEXT π¦
Under console_srcu_read_lock for emitting a single kdb message using the given con->write_atomic callback. And listen β you can only call this when the console is usable at the moment. That's the vibe check, and you gotta pass it first β
π RETURN π
Returns true if the console was acquired. false otherwise. that's it, that's the whole drama π
π₯ DESCRIPTION π₯
So kdb emits messages on consoles that are registered for printk without storing them into the ring buffer. Which means β plot twist β it has to acquire console ownership so that it can call the con->write_atomic callback in a safe way. iconic behaviour, honestly.
This function acquires the nbcon console using priority NBCON_PRIO_EMERGENCY and marks it unsafe for handover/takeover. yes bestie, emergency priority AND unsafe-for-handover. it's doing the most π
π SEE ALSO π
Kernel file ./kernel/printk/nbcon.c, plus the whole friend group:
nbcon_state_set(9)nbcon_state_read(9)nbcon_state_try_cmpxchg(9)nbcon_seq_read(9)nbcon_seq_force(9)nbcon_seq_try_update(9)nbcon_context_try_acquire_direct(9)nbcon_context_try_acquire_requested(9)nbcon_context_try_acquire_handover(9)nbcon_context_try_acquire_hostile(9)nbcon_context_try_acquire(9)nbcon_context_release(9)nbcon_context_can_proceed(9)nbcon_can_proceed(9)__nbcon_context_update_unsafe(9)nbcon_enter_unsafe(9)nbcon_exit_unsafe(9)nbcon_reacquire_nobuf(9)nbcon_emit_next_record(9)nbcon_kthread_should_wakeup(9)nbcon_kthread_func(9)nbcon_irq_work(9)nbcon_kthreads_wake(9)nbcon_kthread_create(9)nbcon_get_cpu_emergency_nesting(9)nbcon_get_default_prio(9)nbcon_allow_unsafe_takeover(9)nbcon_legacy_emit_next_record(9)__nbcon_atomic_flush_pending_con(9)nbcon_atomic_flush_pending_con(9)__nbcon_atomic_flush_pending(9)nbcon_atomic_flush_pending(9)nbcon_atomic_flush_unsafe(9)nbcon_cpu_emergency_enter(9)nbcon_cpu_emergency_exit(9)nbcon_alloc(9)nbcon_free(9)nbcon_device_try_acquire(9)nbcon_device_release(9)nbcon_kdb_release(9)nbcon_write_context_is_braille(9)nbcon_braille_try_acquire(9)nbcon_braille_release(9)
okay that's the whole page, you ate it up bestie π mwah π
sign-off time: this lil cutie lives in ./kernel/printk and it's dated October 2026 β slay, see you in the next manpage π§
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms