From nobody Sat Sep 26 13:08:31 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CAF8476682 for ; Tue, 1 Sep 2026 09:32:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788255174; cv=none; b=g78VptOWrpGvPcJWPlGPzDHfCg0CPaep1yFYjM2m2wUpMG0e1uh/Dl5FiHIJHDq3cVSJ7N/Nbvvc9JW832NP2aJXuWPBptEmLeAxsct7DTvMzq/3YEuVMsNY/bjeCL5ldzOh/luHZX4p7k1znco9oCt4RnDhUlDNe1trE1fuNmQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788255174; c=relaxed/simple; bh=+Cy8Q5PxUPQrM69/XpqWTIp/pzmpYzlVmRnKXkC1+RM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fM/Ui/hK+hQlfeah4ZJx57F/83HrFiB78ruJvVrLYbhBH7B95UmWcKVcHRrHUHynRc0jqDEaHPY3CNoKgaGOJsN51kfzdSfH91S23JNjrUNI/OUNtD2xYBVh0Feo0lI9nsS1F+ubQ8XpGvdqsR6nS73Hga7Zw0H1U4IG0mM5h8Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=f8f8Wb1i; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2NJ06RRz; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="f8f8Wb1i"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2NJ06RRz" From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1788255166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kz/a6ccVkYCQsTaCcHsJvUxIM8MUAq211m5EeLm/qb0=; b=f8f8Wb1ixgkLPKeTSSDZevnrLHKB1uqKSuv37v0yf4k4IsWkB3S1Kdz9awLa3ydMJF0y+7 7ztO62Th88FMr9Fi/SEvl9hgv8m4AC8pnYnN5KrwEx5aLTyDupUx1ZLtePdidbNWz24X4/ 3ltKO6uk6cQ3j+PFCPT9et/mBBBNnjBwb/OfWCg9syyiHmASUauOqIgeAmZIY4y8H9oIcI sZSmbMwSKKBgl6hJ01o0C2vAnUGp4aQhGW/FSVgbXP1fQqHptn2KX/4SDTe2GrkP3HX1Bu zkqO0WM/iSeVlps365F/3FECS114mDci125hfksK3Grmhzeu7NGiU5ENuTvxgQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1788255166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kz/a6ccVkYCQsTaCcHsJvUxIM8MUAq211m5EeLm/qb0=; b=2NJ06RRzwU94DWT2Qf0UYdulgkAEhIXmUx2SYhO+6qMXeMlICweF46ulRSCEYiyvpAXzpH zjf7xHNUbHBciuAA== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Sebastian Andrzej Siewior , Jon Hunter , Thierry Reding , "Greg Kroah-Hartman" , linux-kernel@vger.kernel.org Subject: [PATCH printk v3 1/2] printk/nbcon: Flush nbcon_irq_work in nbcon_free() Date: Tue, 1 Sep 2026 11:37:42 +0206 Message-ID: <20260901093245.344455-2-john.ogness@linutronix.de> In-Reply-To: <20260901093245.344455-1-john.ogness@linutronix.de> References: <20260901093245.344455-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Ensure any pending nbcon_irq_work is flushed before allowing the console to be recycled. Signed-off-by: John Ogness Reviewed-by: Petr Mladek --- kernel/printk/nbcon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c index a5921a84a80ed..68f77afee9106 100644 --- a/kernel/printk/nbcon.c +++ b/kernel/printk/nbcon.c @@ -1837,6 +1837,8 @@ void nbcon_free(struct console *con) /* Synchronize the kthread stop. */ lockdep_assert_console_list_lock_held(); =20 + irq_work_sync(&con->irq_work); + if (printk_kthreads_running) { nbcon_kthread_stop(con); =20 --=20 2.47.3 From nobody Sat Sep 26 13:08:31 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56F624756D3 for ; Tue, 1 Sep 2026 09:32:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788255174; cv=none; b=SV9dvkxMcIv6fI1b4L72GfVjV/W484Bm4kF8AEi5aifl1dxWvUH3dV5uDnE43ZPYwmoTCWLA1JiBXUQvttiUZemo9fjuDkP/A2obdcgAxABNYTbSOzr/yz61X7epcRncnAAgM4dODLVhg/cNIAbST792BaR7nQKSGAXMzaO4OwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788255174; c=relaxed/simple; bh=+olPtzPREUbjYvyJL5qFtHsjMtAYXcx3HBJ7Qvl16dE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UoWXqGn4KGnU8QybtqPWcFgPHIQIGSsw35MU+Lu1LDXCCN3AtOVXNz0d2dcCu5D00j56cnlLn/hbTPgNECZebExuZUWC94v2kW6+CHvN+WNMs3anTGE41RaC+feGFw7Ny8dQicOjkgdfjwup0DxM4SePIkR7t5EcGc8Vjc2F1Wc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=mrPY3CRK; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dB7ShJyX; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mrPY3CRK"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dB7ShJyX" From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1788255166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IqcPvHOJhs4S3ckV2FQDT7Cdh0zzFSs05k0K+sNuGnE=; b=mrPY3CRKs+qYGjGE1lX3YZpm3oLS3e9tswMxMJ2+K3lTAdwJtVlJ1ulnEtLtlen5mYk+S8 ZdckocN6VvfN/0KtYb4/5FBS1MDALuygYhMpBqyh7VWQ1PdiRxd2DP5JcMB90D+oXmJ8k4 DHPmhxSrBuKvgwRizTAkVFiD60zBDLE2zk+VnRa6xhkH9cVXgyvu2Ap20jaWomS2IE3AM+ y1lNa5kDtBga9S/Qdis9w3ucDO5jkt4Ak3wnb/gN+zrgunx77i6IufJ6sXvO5tYG76W8NB fM+O2fBaKfS23g5AF7XAUYTMGfHGKa8GrW59NV16JO0LHI1XSeI9R9o5JXngKw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1788255166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IqcPvHOJhs4S3ckV2FQDT7Cdh0zzFSs05k0K+sNuGnE=; b=dB7ShJyXBQJal3qKFpX3itg0cZXzLSUJ1hp5SkFgY1dtC3e8u0qoU2leSjZggeHcMSCEQF tQjYFEFyEEyjwnBw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Sebastian Andrzej Siewior , Jon Hunter , Thierry Reding , "Greg Kroah-Hartman" , linux-kernel@vger.kernel.org, Thomas Gleixner Subject: [PATCH printk v3 2/2] printk/nbcon: Change nbcon_irq_work to IRQ_WORK_LAZY Date: Tue, 1 Sep 2026 11:37:43 +0206 Message-ID: <20260901093245.344455-3-john.ogness@linutronix.de> In-Reply-To: <20260901093245.344455-1-john.ogness@linutronix.de> References: <20260901093245.344455-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Change the nbcon_irq_work to be IRQ_WORK_LAZY, thus not raising an IRQ upon irq_work queuing. The irq_work is then handled on the next kernel tick. This additional delay is acceptable because nbcon_irq_work is only responsible for non-emergency deferred printing, which is delayed anyway. This has the benefit of not needing to raise an IRQ for each printk() call. On a side note, the Tegra20 and Tegra30 platforms can hang if an irq_work IRQ is raised while entering cpuidle states. This problem was reproducible by calling printk() while entering cpuidle. So this change also provides a workaround for these platforms (as long as they are not running tickless). Link: https://lore.kernel.org/lkml/f3757a75-0ba1-4558-bf57-f19ab7e59a4c@nvi= dia.com Fixes: 76f258bf3f2a ("printk: nbcon: Introduce printer kthreads") Signed-off-by: John Ogness Reviewed-by: Petr Mladek Reviewed-by: Sebastian Andrzej Siewior Tested-by: Jon Hunter --- kernel/printk/nbcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c index 68f77afee9106..d17704fe93ae1 100644 --- a/kernel/printk/nbcon.c +++ b/kernel/printk/nbcon.c @@ -1782,7 +1782,7 @@ bool nbcon_alloc(struct console *con) } =20 rcuwait_init(&con->rcuwait); - init_irq_work(&con->irq_work, nbcon_irq_work); + con->irq_work =3D IRQ_WORK_INIT_LAZY(nbcon_irq_work); atomic_long_set(&ACCESS_PRIVATE(con, nbcon_prev_seq), -1UL); nbcon_state_set(con, &state); =20 --=20 2.47.3