From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ABE6010F4 for ; Sun, 9 Feb 2025 06:49:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739083742; cv=none; b=pAQvkZi2/QlfhdnbRkJGzt2NkTNOtklNo3NMnKYzxWKOzqVlz6WOzC6GsYlvdhg10Czj/MsivVJlWVpu1frhmJtGGuw+Qqo1fbHdwwnkB3CPgo41SpT1b52y/yOT0+o5iCmAxpc6WDguW0sZrI/bocAPSGOkqDJTyDLy/lLrADQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739083742; c=relaxed/simple; bh=idUE59S7isi1HqwG6o4KKKwjDJTcXLPXC1nhBaDMFZg=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=EmWZwb8TWO3QB6fcawOZH/qi4Yx48+7BI9Gdq4M/zRnNRgvzmEMTciA1NU+uyx9jq/P5vbxCHaTc/Uxl0T5MjwGhrtjkFYWuuYFA5T+8DmPUzOBAf3YXSn52SX9HN/rZWXHm/Y6/w+regHNGl/CnfscQIC0aP/WDjtpJv9L59Gg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=T/VyNbzY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="T/VyNbzY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5971C4CEDD; Sun, 9 Feb 2025 06:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739083742; bh=idUE59S7isi1HqwG6o4KKKwjDJTcXLPXC1nhBaDMFZg=; h=Subject:To:Cc:From:Date:From; b=T/VyNbzYs7azyBP4INN4zTJ8ecZWDDPch/PEcbraA8F/Dkg1tYkd5L/84ZYNkq7Op 40OUk38inHaFTPrAQ0KQpha2w621bf0+WHDUqt8C9LojZ+ADL4cZYk85INKR2JzSr5 /NxMtusLCx5prkxxSRbpE0uJCwQs+u69vPrsw9Rw= Subject: FAILED: patch "[PATCH] tty: xilinx_uartps: split sysrq handling" failed to apply to 5.15-stable tree To: sean.anderson@linux.dev,gregkh@linuxfoundation.org,john.ogness@linutronix.de Cc: From: Date: Sun, 09 Feb 2025 07:48:55 +0100 Message-ID: <2025020955-handbook-simplify-cf71@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x b06f388994500297bb91be60ffaf6825ecfd2afe # git commit -s git send-email --to '' --in-reply-to '2025020955-handbook-simplify-cf71@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From b06f388994500297bb91be60ffaf6825ecfd2afe Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Fri, 10 Jan 2025 16:38:22 -0500 Subject: [PATCH] tty: xilinx_uartps: split sysrq handling lockdep detects the following circular locking dependency: CPU 0 CPU 1 ========================== ============================ cdns_uart_isr() printk() uart_port_lock(port) console_lock() cdns_uart_console_write() if (!port->sysrq) uart_port_lock(port) uart_handle_break() port->sysrq = ... uart_handle_sysrq_char() printk() console_lock() The fixed commit attempts to avoid this situation by only taking the port lock in cdns_uart_console_write if port->sysrq unset. However, if (as shown above) cdns_uart_console_write runs before port->sysrq is set, then it will try to take the port lock anyway. This may result in a deadlock. Fix this by splitting sysrq handling into two parts. We use the prepare helper under the port lock and defer handling until we release the lock. Fixes: 74ea66d4ca06 ("tty: xuartps: Improve sysrq handling") Signed-off-by: Sean Anderson Cc: stable@vger.kernel.org # c980248179d: serial: xilinx_uartps: Use port lock wrappers Acked-by: John Ogness Link: https://lore.kernel.org/r/20250110213822.2107462-1-sean.anderson@linux.dev Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index beb151be4d32..92ec51870d1d 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -287,7 +287,7 @@ static void cdns_uart_handle_rx(void *dev_id, unsigned int isrstatus) continue; } - if (uart_handle_sysrq_char(port, data)) + if (uart_prepare_sysrq_char(port, data)) continue; if (is_rxbs_support) { @@ -495,7 +495,7 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) !(readl(port->membase + CDNS_UART_CR) & CDNS_UART_CR_RX_DIS)) cdns_uart_handle_rx(dev_id, isrstatus); - uart_port_unlock(port); + uart_unlock_and_check_sysrq(port); return IRQ_HANDLED; } @@ -1380,9 +1380,7 @@ static void cdns_uart_console_write(struct console *co, const char *s, unsigned int imr, ctrl; int locked = 1; - if (port->sysrq) - locked = 0; - else if (oops_in_progress) + if (oops_in_progress) locked = uart_port_trylock_irqsave(port, &flags); else uart_port_lock_irqsave(port, &flags);