[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2026012217-opium-grit-2295@gregkh>
Date: Thu, 22 Jan 2026 11:27:57 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Yicong Yang <yang.yicong@...oheart.com>
Cc: rafael@...nel.org, lenb@...nel.org, tglx@...nel.org, dakr@...nel.org,
akpm@...ux-foundation.org, apatel@...tanamicro.com, pjw@...nel.org,
palmer@...belt.com, aou@...s.berkeley.edu, alex@...ti.fr,
geshijian@...oheart.com, weidong.wd@...oheart.com,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org
Subject: Re: [PATCH 2/2] init: Move console_on_rootfs after
async_synchronize_full
On Thu, Jan 22, 2026 at 03:34:46PM +0800, Yicong Yang wrote:
> Currently the console_on_rootfs() is called before
> async_synchronize_full(), the console initialization
> could be still in process in theory due to async
> probe, etc. Make it after the async_synchronize_full()
> to make sure the initialization work is done.
Please wrap at 72 columns.
>
> Log the error code as well if we failed to open the console.
>
> Signed-off-by: Yicong Yang <yang.yicong@...oheart.com>
> ---
> init/main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/init/main.c b/init/main.c
> index b84818ad9685..c37ba5f89b96 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1578,6 +1578,7 @@ static int __ref kernel_init(void *unused)
> kernel_init_freeable();
> /* need to finish all async __init code before freeing the memory */
> async_synchronize_full();
> + console_on_rootfs();
Are you sure this is ok? Messing around with init levels and order is
_VERY_ tricky.
Your console should NOT be on an async probe path, if you really need
it, then do not do that at all. Make it sync, and then it should be ok.
>
> system_state = SYSTEM_FREEING_INITMEM;
> kprobe_free_init_mem();
> @@ -1647,7 +1648,7 @@ void __init console_on_rootfs(void)
> struct file *file = filp_open("/dev/console", O_RDWR, 0);
>
> if (IS_ERR(file)) {
> - pr_err("Warning: unable to open an initial console.\n");
> + pr_err("Warning: unable to open an initial console, err = %ld\n", PTR_ERR(file));
Why is this changed?
> return;
> }
> init_dup(file);
> @@ -1690,7 +1691,6 @@ static noinline void __init kernel_init_freeable(void)
> kunit_run_all_tests();
>
> wait_for_initramfs();
> - console_on_rootfs();
You just delayed the console output for many (i.e. most) systems out
there, are you sure that is acceptable to them?
thanks,
greg k-h
Powered by blists - more mailing lists