From nobody Tue Feb 10 05:27:35 2026 Received: from va-2-45.ptr.blmpb.com (va-2-45.ptr.blmpb.com [209.127.231.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 632F4481249 for ; Thu, 22 Jan 2026 07:35:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.231.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769067346; cv=none; b=MhmHF9zFhXEDEeBEVYmqpQwwvapfwS2jQ4fVvMbtHO6rKQFC/rjz1NtTk1Xg6KfbzjzV6yGI4OgYW1KXbRdvX2BdqyGU8HRP8OZ0pBXyiilXVP333AZWOrmgu/mOck4/ox3FnulIFBx7A9zLwElU7k5GTb89lGM22XBJp/hOco4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769067346; c=relaxed/simple; bh=Zg4V6RJ5CX9TkQlNvozgJSw3th6d9YeG4f0THZUNWK4=; h=Date:In-Reply-To:To:Cc:Mime-Version:From:Subject:References: Message-Id:Content-Type; b=ELqVM/JFuG5dV2ogwseZwVreF2dJ1INfJi7Equzb6yVOJnMR5yrskNSsg9Q5UTEZzAMX8m7N9+8pxZAHIQdV+vE7LOi8deirTHt2nRE0YgB/g2gaIIg4KhL8aeXTcglEqTA+AGsaGJcgu+tQcSW171E5c/R/qF0QfU1+96SPFog= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=picoheart.com; spf=pass smtp.mailfrom=picoheart.com; dkim=pass (2048-bit key) header.d=picoheart-com.20200927.dkim.feishu.cn header.i=@picoheart-com.20200927.dkim.feishu.cn header.b=wNQzGcVg; arc=none smtp.client-ip=209.127.231.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=picoheart.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=picoheart.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=picoheart-com.20200927.dkim.feishu.cn header.i=@picoheart-com.20200927.dkim.feishu.cn header.b="wNQzGcVg" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=s1; d=picoheart-com.20200927.dkim.feishu.cn; t=1769067297; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=+g/3tjO+rV9WYb2Jh/rm5GHV4Veu7YSdogQYF3BcWcg=; b=wNQzGcVgLadD5kvUkSUhWc45cDCxqGNGk6kd/+Wz0BUSIemBHHh9+csbwE5Lol9hTFdnSx lnDZNlRR+79edruORKpTgTilX5NN3Df7nP4eDQjYgLTtpB2k7e+A3mO3k35LX2QkuYGqfq +HYh0Z6Mj8kSsz4CygQGQGIsuN/U9Jfa/UqKNGfb3YLrzCZgboO/lo9jqP4qz/u0vMPzIu dEM0lIys8QnUps1Lcltctl6o2i2Yrt0O5QcBr33LcrzqoQdqA2ur8uLOgJKS2xrcOBJ4vl QC1TbrPduy45WUvBIN30u0XxrjloAjEMU8p58mzFrI29VsImUHE+9/Z5vYaoSg== Date: Thu, 22 Jan 2026 15:34:46 +0800 In-Reply-To: <20260122073446.45628-1-yang.yicong@picoheart.com> Content-Transfer-Encoding: quoted-printable X-Original-From: Yicong Yang X-Lms-Return-Path: To: , , , , Cc: , , , , , , , , , , , Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 From: "Yicong Yang" Subject: [PATCH 2/2] init: Move console_on_rootfs after async_synchronize_full Received: from G9WYR9K0VW ([58.250.122.114]) by smtp.feishu.cn with ESMTPS; Thu, 22 Jan 2026 15:34:54 +0800 X-Mailer: git-send-email 2.50.1 References: <20260122073446.45628-1-yang.yicong@picoheart.com> Message-Id: <20260122073446.45628-3-yang.yicong@picoheart.com> Content-Type: text/plain; charset="utf-8" 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. Log the error code as well if we failed to open the console. Signed-off-by: Yicong Yang --- 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(); =20 system_state =3D SYSTEM_FREEING_INITMEM; kprobe_free_init_mem(); @@ -1647,7 +1648,7 @@ void __init console_on_rootfs(void) struct file *file =3D filp_open("/dev/console", O_RDWR, 0); =20 if (IS_ERR(file)) { - pr_err("Warning: unable to open an initial console.\n"); + pr_err("Warning: unable to open an initial console, err =3D %ld\n", PTR_= ERR(file)); return; } init_dup(file); @@ -1690,7 +1691,6 @@ static noinline void __init kernel_init_freeable(void) kunit_run_all_tests(); =20 wait_for_initramfs(); - console_on_rootfs(); =20 /* * check if there is an early userspace init. If yes, let it do all --=20 2.34.1