linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking
@ 2025-02-26 19:59 Marcos Paulo de Souza
  2025-02-26 19:59 ` [PATCH 1/5] printk: Rename suspend_console to console_suspend_all Marcos Paulo de Souza
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Marcos Paulo de Souza @ 2025-02-26 19:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Eric Biederman, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Petr Mladek, Steven Rostedt, John Ogness,
	Sergey Senozhatsky, Todd E Brandt, Jiri Slaby
  Cc: linux-kernel, kexec, linux-pm, linux-serial,
	Marcos Paulo de Souza

Hello, I've being working on some patches that help to clarify the suspend/resume
of printk machinery. The last patch on this patchset address one issue regarding
suspended consoles and blanking.

This is a part one patchset that I would like to see merged before I send more patches
that will rework the suspend flag (a global suspend flag istead of per console) and
the removal of CON_ENABLED flag later on (I've created a function that will forcibly)
register the console instead of using this flag.

Please review!

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
Marcos Paulo de Souza (5):
      printk: Rename suspend_console to console_suspend_all
      printk: Rename resume_console to console_resume_all
      printk: Rename console_stop to console_suspend
      printk: Rename console_start to console_resume
      printk: Check CON_SUSPEND when unblanking a console

 drivers/tty/serial/serial_core.c                   |  6 ++---
 include/linux/console.h                            |  8 +++---
 kernel/kexec_core.c                                |  4 +--
 kernel/power/hibernate.c                           | 16 ++++++------
 kernel/power/suspend.c                             |  8 +++---
 kernel/printk/printk.c                             | 30 ++++++++++++++--------
 .../pm-graph/config/custom-timeline-functions.cfg  |  4 +--
 tools/power/pm-graph/sleepgraph.py                 |  6 ++---
 8 files changed, 46 insertions(+), 36 deletions(-)
---
base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04
change-id: 20250225-printk-renaming-126c1a11ad7a

Best regards,
-- 
Marcos Paulo de Souza <mpdesouza@suse.com>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] printk: Rename suspend_console to console_suspend_all
  2025-02-26 19:59 [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking Marcos Paulo de Souza
@ 2025-02-26 19:59 ` Marcos Paulo de Souza
  2025-02-26 19:59 ` [PATCH 2/5] printk: Rename resume_console to console_resume_all Marcos Paulo de Souza
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Marcos Paulo de Souza @ 2025-02-26 19:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Eric Biederman, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Petr Mladek, Steven Rostedt, John Ogness,
	Sergey Senozhatsky, Todd E Brandt, Jiri Slaby
  Cc: linux-kernel, kexec, linux-pm, linux-serial,
	Marcos Paulo de Souza

The function suspend_console has a misleading name, since it suspends all
consoles, so rename it accordly.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
 include/linux/console.h                                   | 2 +-
 kernel/kexec_core.c                                       | 2 +-
 kernel/power/hibernate.c                                  | 8 ++++----
 kernel/power/suspend.c                                    | 2 +-
 kernel/printk/printk.c                                    | 4 ++--
 tools/power/pm-graph/config/custom-timeline-functions.cfg | 2 +-
 tools/power/pm-graph/sleepgraph.py                        | 2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/linux/console.h b/include/linux/console.h
index eba367bf605d..fa5941f4f9c5 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -648,7 +648,7 @@ static inline void console_sysfs_notify(void)
 extern bool console_suspend_enabled;
 
 /* Suspend and resume console messages over PM events */
-extern void suspend_console(void);
+extern void console_suspend_all(void);
 extern void resume_console(void);
 
 int mda_console_init(void);
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index c0caa14880c3..8f95870030a3 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1007,7 +1007,7 @@ int kernel_kexec(void)
 			error = -EBUSY;
 			goto Restore_console;
 		}
-		suspend_console();
+		console_suspend_all();
 		error = dpm_suspend_start(PMSG_FREEZE);
 		if (error)
 			goto Resume_console;
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 1f87aa01ba44..a18f6016ce6c 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -411,7 +411,7 @@ int hibernation_snapshot(int platform_mode)
 		goto Thaw;
 	}
 
-	suspend_console();
+	console_suspend_all();
 	pm_restrict_gfp_mask();
 
 	error = dpm_suspend(PMSG_FREEZE);
@@ -547,7 +547,7 @@ int hibernation_restore(int platform_mode)
 	int error;
 
 	pm_prepare_console();
-	suspend_console();
+	console_suspend_all();
 	pm_restrict_gfp_mask();
 	error = dpm_suspend_start(PMSG_QUIESCE);
 	if (!error) {
@@ -586,7 +586,7 @@ int hibernation_platform_enter(void)
 		goto Close;
 
 	entering_platform_hibernation = true;
-	suspend_console();
+	console_suspend_all();
 	error = dpm_suspend_start(PMSG_HIBERNATE);
 	if (error) {
 		if (hibernation_ops->recover)
@@ -896,7 +896,7 @@ int hibernate_quiet_exec(int (*func)(void *data), void *data)
 	if (error)
 		goto dpm_complete;
 
-	suspend_console();
+	console_suspend_all();
 
 	error = dpm_suspend(PMSG_FREEZE);
 	if (error)
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 09f8397bae15..f296dd0a1a18 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -502,7 +502,7 @@ int suspend_devices_and_enter(suspend_state_t state)
 	if (error)
 		goto Close;
 
-	suspend_console();
+	console_suspend_all();
 	suspend_test_start();
 	error = dpm_suspend_start(PMSG_SUSPEND);
 	if (error) {
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 80910bc3470c..6cfb1e6d3613 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2733,11 +2733,11 @@ module_param_named(console_no_auto_verbose, printk_console_no_auto_verbose, bool
 MODULE_PARM_DESC(console_no_auto_verbose, "Disable console loglevel raise to highest on oops/panic/etc");
 
 /**
- * suspend_console - suspend the console subsystem
+ * console_suspend_all - suspend the console subsystem
  *
  * This disables printk() while we go into suspend states
  */
-void suspend_console(void)
+void console_suspend_all(void)
 {
 	struct console *con;
 
diff --git a/tools/power/pm-graph/config/custom-timeline-functions.cfg b/tools/power/pm-graph/config/custom-timeline-functions.cfg
index 4f80ad7d7275..80ba55250163 100644
--- a/tools/power/pm-graph/config/custom-timeline-functions.cfg
+++ b/tools/power/pm-graph/config/custom-timeline-functions.cfg
@@ -122,7 +122,7 @@ freeze_processes:
 freeze_kernel_threads:
 pm_restrict_gfp_mask:
 acpi_suspend_begin:
-suspend_console:
+console_suspend_all:
 acpi_pm_prepare:
 syscore_suspend:
 arch_enable_nonboot_cpus_end:
diff --git a/tools/power/pm-graph/sleepgraph.py b/tools/power/pm-graph/sleepgraph.py
index 918eae58b0b4..114c3d0c6619 100755
--- a/tools/power/pm-graph/sleepgraph.py
+++ b/tools/power/pm-graph/sleepgraph.py
@@ -210,7 +210,7 @@ class SystemValues:
 		'hibernate_preallocate_memory': {},
 		'create_basic_memory_bitmaps': {},
 		'swsusp_write': {},
-		'suspend_console': {},
+		'console_suspend_all': {},
 		'acpi_pm_prepare': {},
 		'syscore_suspend': {},
 		'arch_enable_nonboot_cpus_end': {},

-- 
2.48.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] printk: Rename resume_console to console_resume_all
  2025-02-26 19:59 [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking Marcos Paulo de Souza
  2025-02-26 19:59 ` [PATCH 1/5] printk: Rename suspend_console to console_suspend_all Marcos Paulo de Souza
@ 2025-02-26 19:59 ` Marcos Paulo de Souza
  2025-02-26 19:59 ` [PATCH 3/5] printk: Rename console_stop to console_suspend Marcos Paulo de Souza
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Marcos Paulo de Souza @ 2025-02-26 19:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Eric Biederman, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Petr Mladek, Steven Rostedt, John Ogness,
	Sergey Senozhatsky, Todd E Brandt, Jiri Slaby
  Cc: linux-kernel, kexec, linux-pm, linux-serial,
	Marcos Paulo de Souza

The function resume_console has a misleading name,  since it resumes all
consoles, so rename it accordly.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
 include/linux/console.h                                   | 2 +-
 kernel/kexec_core.c                                       | 2 +-
 kernel/power/hibernate.c                                  | 8 ++++----
 kernel/power/suspend.c                                    | 6 +++---
 kernel/printk/printk.c                                    | 2 +-
 tools/power/pm-graph/config/custom-timeline-functions.cfg | 2 +-
 tools/power/pm-graph/sleepgraph.py                        | 4 ++--
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/linux/console.h b/include/linux/console.h
index fa5941f4f9c5..0d48e0deb213 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -649,7 +649,7 @@ extern bool console_suspend_enabled;
 
 /* Suspend and resume console messages over PM events */
 extern void console_suspend_all(void);
-extern void resume_console(void);
+extern void console_resume_all(void);
 
 int mda_console_init(void);
 
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 8f95870030a3..6fcc46f3eb39 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1061,7 +1061,7 @@ int kernel_kexec(void)
  Resume_devices:
 		dpm_resume_end(PMSG_RESTORE);
  Resume_console:
-		resume_console();
+		console_resume_all();
 		thaw_processes();
  Restore_console:
 		pm_restore_console();
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index a18f6016ce6c..c9f60670a261 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -437,7 +437,7 @@ int hibernation_snapshot(int platform_mode)
 	if (error || !in_suspend)
 		pm_restore_gfp_mask();
 
-	resume_console();
+	console_resume_all();
 	dpm_complete(msg);
 
  Close:
@@ -561,7 +561,7 @@ int hibernation_restore(int platform_mode)
 	}
 	dpm_resume_end(PMSG_RECOVER);
 	pm_restore_gfp_mask();
-	resume_console();
+	console_resume_all();
 	pm_restore_console();
 	return error;
 }
@@ -634,7 +634,7 @@ int hibernation_platform_enter(void)
  Resume_devices:
 	entering_platform_hibernation = false;
 	dpm_resume_end(PMSG_RESTORE);
-	resume_console();
+	console_resume_all();
 
  Close:
 	hibernation_ops->end();
@@ -920,7 +920,7 @@ int hibernate_quiet_exec(int (*func)(void *data), void *data)
 dpm_resume:
 	dpm_resume(PMSG_THAW);
 
-	resume_console();
+	console_resume_all();
 
 dpm_complete:
 	dpm_complete(PMSG_THAW);
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index f296dd0a1a18..c3da3db58cdf 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -521,9 +521,9 @@ int suspend_devices_and_enter(suspend_state_t state)
 	suspend_test_start();
 	dpm_resume_end(PMSG_RESUME);
 	suspend_test_finish("resume devices");
-	trace_suspend_resume(TPS("resume_console"), state, true);
-	resume_console();
-	trace_suspend_resume(TPS("resume_console"), state, false);
+	trace_suspend_resume(TPS("console_resume_all"), state, true);
+	console_resume_all();
+	trace_suspend_resume(TPS("console_resume_all"), state, false);
 
  Close:
 	platform_resume_end(state);
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 6cfb1e6d3613..ef259660563a 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2760,7 +2760,7 @@ void console_suspend_all(void)
 	synchronize_srcu(&console_srcu);
 }
 
-void resume_console(void)
+void console_resume_all(void)
 {
 	struct console_flush_type ft;
 	struct console *con;
diff --git a/tools/power/pm-graph/config/custom-timeline-functions.cfg b/tools/power/pm-graph/config/custom-timeline-functions.cfg
index 80ba55250163..0321b59518f3 100644
--- a/tools/power/pm-graph/config/custom-timeline-functions.cfg
+++ b/tools/power/pm-graph/config/custom-timeline-functions.cfg
@@ -128,7 +128,7 @@ syscore_suspend:
 arch_enable_nonboot_cpus_end:
 syscore_resume:
 acpi_pm_finish:
-resume_console:
+console_resume_all:
 acpi_pm_end:
 pm_restore_gfp_mask:
 thaw_processes:
diff --git a/tools/power/pm-graph/sleepgraph.py b/tools/power/pm-graph/sleepgraph.py
index 114c3d0c6619..e2261f33a082 100755
--- a/tools/power/pm-graph/sleepgraph.py
+++ b/tools/power/pm-graph/sleepgraph.py
@@ -216,7 +216,7 @@ class SystemValues:
 		'arch_enable_nonboot_cpus_end': {},
 		'syscore_resume': {},
 		'acpi_pm_finish': {},
-		'resume_console': {},
+		'console_resume_all': {},
 		'acpi_pm_end': {},
 		'pm_restore_gfp_mask': {},
 		'thaw_processes': {},
@@ -3459,7 +3459,7 @@ def parseTraceLog(live=False):
 	tracewatch = ['irq_wakeup']
 	if sysvals.usekprobes:
 		tracewatch += ['sync_filesystems', 'freeze_processes', 'syscore_suspend',
-			'syscore_resume', 'resume_console', 'thaw_processes', 'CPU_ON',
+			'syscore_resume', 'console_resume_all', 'thaw_processes', 'CPU_ON',
 			'CPU_OFF', 'acpi_suspend']
 
 	# extract the callgraph and traceevent data

-- 
2.48.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] printk: Rename console_stop to console_suspend
  2025-02-26 19:59 [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking Marcos Paulo de Souza
  2025-02-26 19:59 ` [PATCH 1/5] printk: Rename suspend_console to console_suspend_all Marcos Paulo de Souza
  2025-02-26 19:59 ` [PATCH 2/5] printk: Rename resume_console to console_resume_all Marcos Paulo de Souza
@ 2025-02-26 19:59 ` Marcos Paulo de Souza
  2025-02-26 19:59 ` [PATCH 4/5] printk: Rename console_start to console_resume Marcos Paulo de Souza
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Marcos Paulo de Souza @ 2025-02-26 19:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Eric Biederman, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Petr Mladek, Steven Rostedt, John Ogness,
	Sergey Senozhatsky, Todd E Brandt, Jiri Slaby
  Cc: linux-kernel, kexec, linux-pm, linux-serial,
	Marcos Paulo de Souza

The intent of console_stop was in fact to suspend it, so rename the
function accordly.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
 drivers/tty/serial/serial_core.c | 4 ++--
 include/linux/console.h          | 2 +-
 kernel/printk/printk.c           | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 74fa02b23772..ff2499dbbb82 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2442,10 +2442,10 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
 	}
 
 	/*
-	 * Disable the console device before suspending.
+	 * Suspend the console device before suspending the port.
 	 */
 	if (uart_console(uport))
-		console_stop(uport->cons);
+		console_suspend(uport->cons);
 
 	uart_change_pm(state, UART_PM_STATE_OFF);
 
diff --git a/include/linux/console.h b/include/linux/console.h
index 0d48e0deb213..74587eeea3c7 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -633,7 +633,7 @@ extern void console_conditional_schedule(void);
 extern void console_unblank(void);
 extern void console_flush_on_panic(enum con_flush_mode mode);
 extern struct tty_driver *console_device(int *);
-extern void console_stop(struct console *);
+extern void console_suspend(struct console *);
 extern void console_start(struct console *);
 extern int is_console_locked(void);
 extern int braille_register_console(struct console *, int index,
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index ef259660563a..c40b841c191b 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3497,10 +3497,10 @@ struct tty_driver *console_device(int *index)
 
 /*
  * Prevent further output on the passed console device so that (for example)
- * serial drivers can disable console output before suspending a port, and can
+ * serial drivers can suspend console output before suspending a port, and can
  * re-enable output afterwards.
  */
-void console_stop(struct console *console)
+void console_suspend(struct console *console)
 {
 	__pr_flush(console, 1000, true);
 	console_list_lock();
@@ -3515,7 +3515,7 @@ void console_stop(struct console *console)
 	 */
 	synchronize_srcu(&console_srcu);
 }
-EXPORT_SYMBOL(console_stop);
+EXPORT_SYMBOL(console_suspend);
 
 void console_start(struct console *console)
 {

-- 
2.48.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] printk: Rename console_start to console_resume
  2025-02-26 19:59 [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking Marcos Paulo de Souza
                   ` (2 preceding siblings ...)
  2025-02-26 19:59 ` [PATCH 3/5] printk: Rename console_stop to console_suspend Marcos Paulo de Souza
@ 2025-02-26 19:59 ` Marcos Paulo de Souza
  2025-02-27  6:30   ` Jiri Slaby
  2025-02-26 19:59 ` [PATCH 5/5] printk: Check CON_SUSPEND when unblanking a console Marcos Paulo de Souza
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Marcos Paulo de Souza @ 2025-02-26 19:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Eric Biederman, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Petr Mladek, Steven Rostedt, John Ogness,
	Sergey Senozhatsky, Todd E Brandt, Jiri Slaby
  Cc: linux-kernel, kexec, linux-pm, linux-serial,
	Marcos Paulo de Souza

The intent of console_start was to resume a previosly suspended console,
so rename it accordly.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
 drivers/tty/serial/serial_core.c | 2 +-
 include/linux/console.h          | 2 +-
 kernel/printk/printk.c           | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index ff2499dbbb82..4e6bbbeeb2bf 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2500,7 +2500,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
 			uart_port_unlock_irq(uport);
 		}
 		if (console_suspend_enabled)
-			console_start(uport->cons);
+			console_resume(uport->cons);
 	}
 
 	if (tty_port_suspended(port)) {
diff --git a/include/linux/console.h b/include/linux/console.h
index 74587eeea3c7..8f10d0a85bb4 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -634,7 +634,7 @@ extern void console_unblank(void);
 extern void console_flush_on_panic(enum con_flush_mode mode);
 extern struct tty_driver *console_device(int *);
 extern void console_suspend(struct console *);
-extern void console_start(struct console *);
+extern void console_resume(struct console *);
 extern int is_console_locked(void);
 extern int braille_register_console(struct console *, int index,
 		char *console_options, char *braille_options);
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index c40b841c191b..fbbaec06c9f3 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3517,7 +3517,7 @@ void console_suspend(struct console *console)
 }
 EXPORT_SYMBOL(console_suspend);
 
-void console_start(struct console *console)
+void console_resume(struct console *console)
 {
 	struct console_flush_type ft;
 	bool is_nbcon;
@@ -3542,7 +3542,7 @@ void console_start(struct console *console)
 
 	__pr_flush(console, 1000, true);
 }
-EXPORT_SYMBOL(console_start);
+EXPORT_SYMBOL(console_resume);
 
 #ifdef CONFIG_PRINTK
 static int unregister_console_locked(struct console *console);

-- 
2.48.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] printk: Check CON_SUSPEND when unblanking a console
  2025-02-26 19:59 [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking Marcos Paulo de Souza
                   ` (3 preceding siblings ...)
  2025-02-26 19:59 ` [PATCH 4/5] printk: Rename console_start to console_resume Marcos Paulo de Souza
@ 2025-02-26 19:59 ` Marcos Paulo de Souza
  2025-02-27 15:30 ` [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking John Ogness
  2025-03-11 10:37 ` Petr Mladek
  6 siblings, 0 replies; 11+ messages in thread
From: Marcos Paulo de Souza @ 2025-02-26 19:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Eric Biederman, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Petr Mladek, Steven Rostedt, John Ogness,
	Sergey Senozhatsky, Todd E Brandt, Jiri Slaby
  Cc: linux-kernel, kexec, linux-pm, linux-serial,
	Marcos Paulo de Souza

The commit 9e70a5e109a4 ("printk: Add per-console suspended state")
introduced the CON_SUSPENDED flag for consoles. The suspended consoles
will stop receiving messages, so don't unblank suspended consoles
because it won't be showing anything either way.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
 kernel/printk/printk.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index fbbaec06c9f3..4b7ed40bf808 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3342,7 +3342,12 @@ void console_unblank(void)
 	 */
 	cookie = console_srcu_read_lock();
 	for_each_console_srcu(c) {
-		if ((console_srcu_read_flags(c) & CON_ENABLED) && c->unblank) {
+		short flags = console_srcu_read_flags(c);
+
+		if (flags & CON_SUSPENDED)
+			continue;
+
+		if ((flags & CON_ENABLED) && c->unblank) {
 			found_unblank = true;
 			break;
 		}
@@ -3379,7 +3384,12 @@ void console_unblank(void)
 
 	cookie = console_srcu_read_lock();
 	for_each_console_srcu(c) {
-		if ((console_srcu_read_flags(c) & CON_ENABLED) && c->unblank)
+		short flags = console_srcu_read_flags(c);
+
+		if (flags & CON_SUSPENDED)
+			continue;
+
+		if ((flags & CON_ENABLED) && c->unblank)
 			c->unblank();
 	}
 	console_srcu_read_unlock(cookie);

-- 
2.48.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/5] printk: Rename console_start to console_resume
  2025-02-26 19:59 ` [PATCH 4/5] printk: Rename console_start to console_resume Marcos Paulo de Souza
@ 2025-02-27  6:30   ` Jiri Slaby
  0 siblings, 0 replies; 11+ messages in thread
From: Jiri Slaby @ 2025-02-27  6:30 UTC (permalink / raw)
  To: Marcos Paulo de Souza, Greg Kroah-Hartman, Eric Biederman,
	Rafael J. Wysocki, Len Brown, Pavel Machek, Petr Mladek,
	Steven Rostedt, John Ogness, Sergey Senozhatsky, Todd E Brandt
  Cc: linux-kernel, kexec, linux-pm, linux-serial

On 26. 02. 25, 20:59, Marcos Paulo de Souza wrote:
> The intent of console_start was to resume a previosly suspended console,
> so rename it accordly.

FWIW no objections re code change. Except "previosly" here and 
"accordly" in 1-4 :D. (In case you resend.)

thanks,
-- 
js
suse labs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking
  2025-02-26 19:59 [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking Marcos Paulo de Souza
                   ` (4 preceding siblings ...)
  2025-02-26 19:59 ` [PATCH 5/5] printk: Check CON_SUSPEND when unblanking a console Marcos Paulo de Souza
@ 2025-02-27 15:30 ` John Ogness
  2025-03-11 10:37 ` Petr Mladek
  6 siblings, 0 replies; 11+ messages in thread
From: John Ogness @ 2025-02-27 15:30 UTC (permalink / raw)
  To: Marcos Paulo de Souza, Greg Kroah-Hartman, Eric Biederman,
	Rafael J. Wysocki, Len Brown, Pavel Machek, Petr Mladek,
	Steven Rostedt, Sergey Senozhatsky, Todd E Brandt, Jiri Slaby
  Cc: linux-kernel, kexec, linux-pm, linux-serial,
	Marcos Paulo de Souza

On 2025-02-26, Marcos Paulo de Souza <mpdesouza@suse.com> wrote:
> Hello, I've being working on some patches that help to clarify the suspend/resume
> of printk machinery. The last patch on this patchset address one issue regarding
> suspended consoles and blanking.
>
> This is a part one patchset that I would like to see merged before I send more patches
> that will rework the suspend flag (a global suspend flag istead of per console) and
> the removal of CON_ENABLED flag later on (I've created a function that will forcibly)
> register the console instead of using this flag.
>
> Please review!
>
> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>

The series looks good (adding the spellchecking that Jiri
mentioned). Thanks!

Reviewed-by: John Ogness <john.ogness@linutronix.de>

I think it is worth mentioning that the series was motivated by this [0]
discussion. And since I just mentioned it, that is probably mention
enough. ;-)

John Ogness

[0] https://lore.kernel.org/lkml/ZyoNZfLT6tlVAWjO@pathway.suse.cz

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking
  2025-02-26 19:59 [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking Marcos Paulo de Souza
                   ` (5 preceding siblings ...)
  2025-02-27 15:30 ` [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking John Ogness
@ 2025-03-11 10:37 ` Petr Mladek
  2025-03-11 12:40   ` Petr Mladek
  6 siblings, 1 reply; 11+ messages in thread
From: Petr Mladek @ 2025-03-11 10:37 UTC (permalink / raw)
  To: Marcos Paulo de Souza
  Cc: Greg Kroah-Hartman, Eric Biederman, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Steven Rostedt, John Ogness, Sergey Senozhatsky,
	Todd E Brandt, Jiri Slaby, linux-kernel, kexec, linux-pm,
	linux-serial

On Wed 2025-02-26 16:59:00, Marcos Paulo de Souza wrote:
> Hello, I've being working on some patches that help to clarify the suspend/resume
> of printk machinery. The last patch on this patchset address one issue regarding
> suspended consoles and blanking.
> 
> This is a part one patchset that I would like to see merged before I send more patches
> that will rework the suspend flag (a global suspend flag istead of per console) and
> the removal of CON_ENABLED flag later on (I've created a function that will forcibly)
> register the console instead of using this flag.
> 
> Please review!
> 
> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>

Looks good to me. I could fix the typos when pushing.

Well, there is one more thing. It seems that the simple graphic logger
was merged for 6.14-rc1. And the console_stop()/console_start() API
is used also in drivers/gpu/drm/clients/drm_log.c.

It is actually the code which motivated this rename, as already
pointed out by John, see
https://lore.kernel.org/lkml/ZyoNZfLT6tlVAWjO@pathway.suse.cz/

Well, I am going to update these two locations when pushing this
as well. Let's just get this change done.

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking
  2025-03-11 10:37 ` Petr Mladek
@ 2025-03-11 12:40   ` Petr Mladek
  2025-03-11 14:41     ` Marcos Paulo de Souza
  0 siblings, 1 reply; 11+ messages in thread
From: Petr Mladek @ 2025-03-11 12:40 UTC (permalink / raw)
  To: Marcos Paulo de Souza
  Cc: Greg Kroah-Hartman, Eric Biederman, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Steven Rostedt, John Ogness, Sergey Senozhatsky,
	Todd E Brandt, Jiri Slaby, linux-kernel, kexec, linux-pm,
	linux-serial

On Tue 2025-03-11 11:38:00, Petr Mladek wrote:
> On Wed 2025-02-26 16:59:00, Marcos Paulo de Souza wrote:
> > Hello, I've being working on some patches that help to clarify the suspend/resume
> > of printk machinery. The last patch on this patchset address one issue regarding
> > suspended consoles and blanking.
> > 
> > This is a part one patchset that I would like to see merged before I send more patches
> > that will rework the suspend flag (a global suspend flag istead of per console) and
> > the removal of CON_ENABLED flag later on (I've created a function that will forcibly)
> > register the console instead of using this flag.
> > 
> > Please review!
> > 
> > Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
> 
> Looks good to me. I could fix the typos when pushing.
> 
> Well, there is one more thing. It seems that the simple graphic logger
> was merged for 6.14-rc1. And the console_stop()/console_start() API
> is used also in drivers/gpu/drm/clients/drm_log.c.
> 
> It is actually the code which motivated this rename, as already
> pointed out by John, see
> https://lore.kernel.org/lkml/ZyoNZfLT6tlVAWjO@pathway.suse.cz/
> 
> Well, I am going to update these two locations when pushing this
> as well. Let's just get this change done.

And I did as mentioned above.

JFYI, the patcheset has been committed into printk/linux.git,
branch for-6.15-console-suspend-api-cleanup.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking
  2025-03-11 12:40   ` Petr Mladek
@ 2025-03-11 14:41     ` Marcos Paulo de Souza
  0 siblings, 0 replies; 11+ messages in thread
From: Marcos Paulo de Souza @ 2025-03-11 14:41 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Greg Kroah-Hartman, Eric Biederman, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Steven Rostedt, John Ogness, Sergey Senozhatsky,
	Todd E Brandt, Jiri Slaby, linux-kernel, kexec, linux-pm,
	linux-serial

On Tue, 2025-03-11 at 13:40 +0100, Petr Mladek wrote:
> On Tue 2025-03-11 11:38:00, Petr Mladek wrote:
> > On Wed 2025-02-26 16:59:00, Marcos Paulo de Souza wrote:
> > > Hello, I've being working on some patches that help to clarify
> > > the suspend/resume
> > > of printk machinery. The last patch on this patchset address one
> > > issue regarding
> > > suspended consoles and blanking.
> > > 
> > > This is a part one patchset that I would like to see merged
> > > before I send more patches
> > > that will rework the suspend flag (a global suspend flag istead
> > > of per console) and
> > > the removal of CON_ENABLED flag later on (I've created a function
> > > that will forcibly)
> > > register the console instead of using this flag.
> > > 
> > > Please review!
> > > 
> > > Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
> > 
> > Looks good to me. I could fix the typos when pushing.
> > 
> > Well, there is one more thing. It seems that the simple graphic
> > logger
> > was merged for 6.14-rc1. And the console_stop()/console_start() API
> > is used also in drivers/gpu/drm/clients/drm_log.c.
> > 
> > It is actually the code which motivated this rename, as already
> > pointed out by John, see
> > https://lore.kernel.org/lkml/ZyoNZfLT6tlVAWjO@pathway.suse.cz/
> > 
> > Well, I am going to update these two locations when pushing this
> > as well. Let's just get this change done.
> 
> And I did as mentioned above.
> 
> JFYI, the patcheset has been committed into printk/linux.git,
> branch for-6.15-console-suspend-api-cleanup.

Thanks to all reviewers and to you Petr for taking the patches and
adjusting the typos!

> 
> Best Regards,
> Petr


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-03-11 14:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-26 19:59 [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking Marcos Paulo de Souza
2025-02-26 19:59 ` [PATCH 1/5] printk: Rename suspend_console to console_suspend_all Marcos Paulo de Souza
2025-02-26 19:59 ` [PATCH 2/5] printk: Rename resume_console to console_resume_all Marcos Paulo de Souza
2025-02-26 19:59 ` [PATCH 3/5] printk: Rename console_stop to console_suspend Marcos Paulo de Souza
2025-02-26 19:59 ` [PATCH 4/5] printk: Rename console_start to console_resume Marcos Paulo de Souza
2025-02-27  6:30   ` Jiri Slaby
2025-02-26 19:59 ` [PATCH 5/5] printk: Check CON_SUSPEND when unblanking a console Marcos Paulo de Souza
2025-02-27 15:30 ` [PATCH 0/5] printk: renaming some suspend/resume functions and one fix for unblanking John Ogness
2025-03-11 10:37 ` Petr Mladek
2025-03-11 12:40   ` Petr Mladek
2025-03-11 14:41     ` Marcos Paulo de Souza

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).