summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0017-printk-nbcon-Add-helper-to-assign-priority-based-on-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches-rt/0017-printk-nbcon-Add-helper-to-assign-priority-based-on-.patch')
-rw-r--r--debian/patches-rt/0017-printk-nbcon-Add-helper-to-assign-priority-based-on-.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/debian/patches-rt/0017-printk-nbcon-Add-helper-to-assign-priority-based-on-.patch b/debian/patches-rt/0017-printk-nbcon-Add-helper-to-assign-priority-based-on-.patch
new file mode 100644
index 0000000000..0fda8a8c5e
--- /dev/null
+++ b/debian/patches-rt/0017-printk-nbcon-Add-helper-to-assign-priority-based-on-.patch
@@ -0,0 +1,67 @@
+From: John Ogness <john.ogness@linutronix.de>
+Date: Thu, 14 Dec 2023 14:38:42 +0000
+Subject: [PATCH 17/46] printk: nbcon: Add helper to assign priority based on
+ CPU state
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.9/older/patches-6.9-rt5.tar.xz
+
+Add a helper function to use the current state of the CPU to
+determine which priority to assign to the printing context.
+
+The EMERGENCY priority handling is added in a follow-up commit.
+It will use a per-CPU variable.
+
+Note: nbcon_driver_try_acquire(), which is used by console
+ drivers to acquire the nbcon console for non-printing
+ activities, will always use NORMAL priority.
+
+Signed-off-by: John Ogness <john.ogness@linutronix.de>
+Reviewed-by: Petr Mladek <pmladek@suse.com>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/printk/internal.h | 2 ++
+ kernel/printk/nbcon.c | 16 ++++++++++++++++
+ 2 files changed, 18 insertions(+)
+
+--- a/kernel/printk/internal.h
++++ b/kernel/printk/internal.h
+@@ -84,6 +84,7 @@ void nbcon_seq_force(struct console *con
+ bool nbcon_alloc(struct console *con);
+ void nbcon_init(struct console *con, u64 init_seq);
+ void nbcon_free(struct console *con);
++enum nbcon_prio nbcon_get_default_prio(void);
+
+ /*
+ * Check if the given console is currently capable and allowed to print
+@@ -138,6 +139,7 @@ static inline void nbcon_seq_force(struc
+ static inline bool nbcon_alloc(struct console *con) { return false; }
+ static inline void nbcon_init(struct console *con, u64 init_seq) { }
+ static inline void nbcon_free(struct console *con) { }
++static inline enum nbcon_prio nbcon_get_default_prio(void) { return NBCON_PRIO_NONE; }
+
+ static inline bool console_is_usable(struct console *con, short flags) { return false; }
+
+--- a/kernel/printk/nbcon.c
++++ b/kernel/printk/nbcon.c
+@@ -938,6 +938,22 @@ static bool nbcon_emit_next_record(struc
+ }
+
+ /**
++ * nbcon_get_default_prio - The appropriate nbcon priority to use for nbcon
++ * printing on the current CPU
++ *
++ * Context: Any context which could not be migrated to another CPU.
++ * Return: The nbcon_prio to use for acquiring an nbcon console in this
++ * context for printing.
++ */
++enum nbcon_prio nbcon_get_default_prio(void)
++{
++ if (this_cpu_in_panic())
++ return NBCON_PRIO_PANIC;
++
++ return NBCON_PRIO_NORMAL;
++}
++
++/**
+ * nbcon_alloc - Allocate buffers needed by the nbcon console
+ * @con: Console to allocate buffers for
+ *