From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796203945; b=0hcLn7jh5qsYLlTD1KpQnb9OXZZ1ohBDW/c6PPXU5rLLum+C6mL6ttUnRg2lX0TFeuF1 3uBkoMwl0Vc5dxzN08ypk3Sut1iuZdNEFX0qfwOehp0UiGkMCqnouDv2ZZaCeJsRHo2EX ci1Yf9+rHhxTAKS95csXWWLb7fRQKemB/TdE8ijuvAkET7gtktJ/9TBjMSt23EQNWoFEI x0ld4MJAGb99znxjutTL3GxTk03Gj0yJCsd7x7OQ3NY6IPJyONmgb5o8s7MY6/8Dlg7gc 9Jl+So0cr9e760Hujnkis/BFLWGs9nyJDNG+CywA5bPuDPV1onKiY/CG9ZfS9ZQDD2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796203945; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=32u/K5RYT+uWcqVD5FJE/RFWHcZWl0tLUDW5DxyJHpg=; b=ENBBh3iTl9uAaE8GB2jjPJH8PY0Sch4OPStXFE8LiA/bmFwaskgD1FlhL1H8oAyfzUiu A2/CISqTJKybUojKoJ4C4BRdW0iPDVa5g51fE/sjhSuPrCGync5ADccR7z0Y5ou5/mWJB CLtl92RfEL+FLME48s4Qq9Hm8rBxPBJGJczBCn3J3axCAeqfYQKxea6PPqSlCXmCLRKmn hslU+4aXIDP/RTicDeipu4uvKdzI2sKIFKWiAZRS3d2U53RD34XYWoWAn0NPx6k/2XXHG wi/GoUDum/3N5f1ICnPcZQl5lY/xN5a0tMVKTnd1D1kuvExtCPfwwoUj3vPOBbD9kAg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eQMDxgpM; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2669C606A31A for ; Wed, 2 Dec 2026 09:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eQMDxgpM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 909A51F00896; Wed, 2 Dec 2026 09:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796203944; bh=32u/K5RYT+uWcqVD5FJE/RFWHcZWl0tLUDW5DxyJHpg=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=eQMDxgpM1NY2QHbHmNwXUMRbfUcql8ZyWvPCAoKYTOD3jjKRlKKPDLxL409cse2cH cC0wyIEKOykhbkyVsU14YTsyQwetFyIRMPFH3Hrl8Hr34bAnaoqYLyH6vPK69Jf3IV llm6lAFOvlLuFgvfdrzLbDj6SzyQ3l4OxE/Gew5ySi5+wL1tkka1U/ETPoWou5QedE +zdA6O7UG3goar6oAda4i9UWTnnHdczBtoOs9vZY5mjwzMJSW9Lw8tjIS0vuefd0xr dPJf/mI7sxBMXP21WmkHICSIn8GD+yz9/XMwiNgu+2vIUjwvMprAerx7XZd9PVVnMU w87S6GR39Nn3w== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2] serial: core: Don't spin for nbcon ownership with the port lock held Reply-To: sashiko-reviews@lists.linux.dev To: "Eliav Farber" Cc: linux-serial@vger.kernel.org In-Reply-To: <20261202092712.18975-1-farbere@amazon.com> References: <20261202092712.18975-1-farbere@amazon.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 09:32:24 +0000 X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > uart_port_lock() and its variants take the port lock and then spin until > they own the nbcon console context, which synchronizes port->lock users > against the write_atomic() callback. During a panic on another CPU the > only acquire still allowed is a reacquire by the context that lost > ownership, see commit 571c1ea91a73 ("printk: nbcon: Allow reacquire > during panic"). The wrapper's acquire is not one, so it is always > refused and the spin never ends. >=20 > A panic on another CPU only has to land between taking the port lock and > acquiring ownership. The CPU is then left holding the port lock, and in > the _irq and _irqsave cases with interrupts disabled, so it stops > answering the stop IPI from panic(). Triggering a panic from a shell on > the serial console reproduces this: a CPU enters the wrapper while the > tty is transmitting and never leaves it. On an 8250 console the panic > output slows to tens of milliseconds per character and never reaches the > reboot. >=20 > Fix this by retrying with the port lock released and interrupts > restored. __uart_port_using_nbcon() is re-tested on each attempt because > the console can be unregistered while the lock is dropped. A caller that > already has interrupts disabled still spins, but no longer holds the > port lock. >=20 > This message and change were written with the help of an AI coding > assistant. I reviewed everything, corrected a few things, and tested > the result on arm64 hardware with an 8250 console. >=20 > Fixes: 4126f149c48b ("serial: core: Acquire nbcon context in port->lock w= rapper") > Cc: stable@vger.kernel.org > Signed-off-by: Eliav Farber Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202092712.1897= 5-1-farbere@amazon.com?part=3D1