From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 A1A0244AB9F; Tue, 21 Jul 2026 22:37:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784673445; cv=none; b=cyAqyv90I+JwEQ2CytuSUa0MsrUykUMDz+cw65XfKSC49IHRZAYLuNy1rF9BI0b657WSF/c5SQtY757G6xtnAAEZz6yrNaDMB3hiVU1lay8k/hjkD2hKZwQcsof1PcrJr48bz77OBK3qlL/c5x5kC1TgRxlCTlLc4bw0GMg7oLY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784673445; c=relaxed/simple; bh=lFhGLh8zcLo+uGzALtLeO47daQmTajUmstIWl3LalfU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S2Uq04xoOwlSaGbzJA414lU3CVA3K23CENRwUUDhKVTTkivEfgsV6M4oJBJhukeB7MjN97lAa8SktbiuwCRMQT9duhFx5+zRXqVykT5QpMgSdGZe2VmewYLU28062pCS67RZYeXwaHR9wkApoDakYppAz9ouBlSGzPwP5o2UCS8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=riTmnaeR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="riTmnaeR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AC9F1F000E9; Tue, 21 Jul 2026 22:37:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784673444; bh=14fgoDcK/uCREYxrB0Vt/nZU/J0g0n45xTlKUGRByhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=riTmnaeRqPgA8Lmk6dUdsusRMI0XcL7/qfF6iebzbNbxcI85hchZUX9jwhR7XUeyn Wbg6kyumdEcgIfik2K/yu8JndNAzDFfjdqq0EqHK0pXhhRLmabYV9XqpGcSaBuF1UJ Mqbz2G6JcvYe03Ue7b1VW2HevepnxbAkqcjNUPiE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Stephan Gerhold , Konrad Dybcio Subject: [PATCH 5.10 164/699] serial: msm: Disable DMA for kernel console UART Date: Tue, 21 Jul 2026 17:18:43 +0200 Message-ID: <20260721152359.403881248@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stephan Gerhold commit 22dd2777e6c180e1c945b00f6d18550979436324 upstream. At the moment, concurrent writes from userspace and the kernel to the console can trigger a race condition that results in an infinite loop of the same messages printed over and over again. This is most likely to happen during system startup or shutdown when the init system starts/stops a large number of system services that interact with various kernel code. When userspace writes to the TTY device, the driver initiates an asynchronous DMA transfer and releases the port lock. At the same moment, the kernel printk path might grab the port lock and re-configure the UART controller for PIO, without waiting for the DMA operation to complete. It seems like this collision results in zero progress being reported for the DMA engine, so the same text is printed to the console over and over again. For the kernel console, we want a reliable output path that will be functional even during crashes etc. So rather than implementing complex code to synchronize the kernel console write routines with the userspace DMA write routines, simply disable DMA for the console UART instance. Similar checks exist in many other serial drivers, e.g. 8250_port.c, imx.c, sh-sci.c etc. Cc: stable Fixes: 3a878c430fd6 ("tty: serial: msm: Add TX DMA support") Signed-off-by: Stephan Gerhold Acked-by: Konrad Dybcio Link: https://patch.msgid.link/20260706-serial-msm-console-dma-collision-v1-1-3179b8cb1d89@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/msm_serial.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -1216,7 +1216,8 @@ static int msm_startup(struct uart_port data |= UART_MR1_AUTO_RFR_LEVEL0 & rfr_level; msm_write(port, data, UART_MR1); - if (msm_port->is_uartdm) { + /* Disable DMA for console to prevent PIO/DMA collisions */ + if (msm_port->is_uartdm && !uart_console(port)) { msm_request_tx_dma(msm_port, msm_port->uart.mapbase); msm_request_rx_dma(msm_port, msm_port->uart.mapbase); }