From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45B69C433EF for ; Thu, 5 May 2022 22:33:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386377AbiEEWhM (ORCPT ); Thu, 5 May 2022 18:37:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386329AbiEEWg4 (ORCPT ); Thu, 5 May 2022 18:36:56 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 934025EDE6 for ; Thu, 5 May 2022 15:33:15 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1651789992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ytVIAaWj8JkkieFnBNn80sd5MHBlsGGI9hhLKU4M3Z8=; b=VAy6FEbOpeb56a7INHKsrf9wsvUNOSo5OmKF/jizF6zYy9jrDiH+sh+x2Yj4l9T+h5Ft6x /M93lCjGJvnbLREe2aIQ7FxJ13ihv+6n7osGG27pl2Hz7864N0h5uhadNiCyRgvb4w2fVZ TGMxOIpx/xSoLcMxJqycJLqJTN5jWs6oJ4JUyk0emud05VKgfQBlFPG5jlIEe+p65m5gQx yM7LsmQxSFK7q5JroqYTOioAs0FcXFNZEpAHTaPbWtLjbK0xZRhZye7VwJ0vgLxwyvx/x9 CQuA/7fZ6f4pJxXVIKCa1rgp817C2iZW9MwWNRLHkYQuy12HW1OZiD6MqnQo+g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1651789992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ytVIAaWj8JkkieFnBNn80sd5MHBlsGGI9hhLKU4M3Z8=; b=hVuRU6SaPQT/sqsKWRakw4yG0K01vOAxP5l3nObGvb02uuuD99UdKwFPIKbgaPf8A+BIsA MH9UFSxf9WdaXYCg== To: Marek Szyprowski , Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , linux-amlogic@lists.infradead.org Subject: Re: [PATCH printk v5 1/1] printk: extend console_lock for per-console locking In-Reply-To: <87a6bwapij.fsf@jogness.linutronix.de> References: <2a82eae7-a256-f70c-fd82-4e510750906e@samsung.com> <87fslyv6y3.fsf@jogness.linutronix.de> <51dfc4a0-f6cf-092f-109f-a04eeb240655@samsung.com> <87k0b6blz2.fsf@jogness.linutronix.de> <32bba8f8-dec7-78aa-f2e5-f62928412eda@samsung.com> <45849b63-d7a8-5cc3-26ad-256a28d09991@samsung.com> <87pmktm2a9.fsf@jogness.linutronix.de> <87a6bwapij.fsf@jogness.linutronix.de> Date: Fri, 06 May 2022 00:39:12 +0206 Message-ID: <87zgjvd2zb.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marek, On 2022-05-05, John Ogness wrote: > I will go through and check if all access to AML_UART_CONTROL is > protected by port->lock. The startup() callback of the uart_ops is not called with the port locked. I'm having difficulties identifying if the startup() callback can occur after the console was already registered via meson_uart_init() and could be actively printing, but I see other serial drivers are protecting their registers in the startup() callback with the port->lock. Could you try booting the meson hardware with the following change? (And removing any previous debug changes I posted?) John diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index 2bf1c57e0981..f551b8603817 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -267,9 +267,12 @@ static void meson_uart_reset(struct uart_port *port) static int meson_uart_startup(struct uart_port *port) { + unsigned long flags; u32 val; int ret = 0; + spin_lock_irqsave(&port->lock, flags); + val = readl(port->membase + AML_UART_CONTROL); val |= AML_UART_CLEAR_ERR; writel(val, port->membase + AML_UART_CONTROL); @@ -285,6 +288,8 @@ static int meson_uart_startup(struct uart_port *port) val = (AML_UART_RECV_IRQ(1) | AML_UART_XMIT_IRQ(port->fifosize / 2)); writel(val, port->membase + AML_UART_MISC); + spin_unlock_irqrestore(&port->lock, flags); + ret = request_irq(port->irq, meson_uart_interrupt, 0, port->name, port);