Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4615771iob; Sun, 8 May 2022 19:19:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTtgbHI1Ye2zv2HX5ik70pmVdT6RAWf20avsb5BeqZ15qrYqY4UP2AHcHI2EqVXp6ivz9I X-Received: by 2002:a17:903:22c6:b0:15f:14e1:1518 with SMTP id y6-20020a17090322c600b0015f14e11518mr2236274plg.116.1652062761267; Sun, 08 May 2022 19:19:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652062761; cv=none; d=google.com; s=arc-20160816; b=QfP4Qjq8GGIKPmACT7sxxX/jZ0wbdo9l0meihnOcW2hLyG2WAHlutB3BAn84LwbHog IIywdGQr3/W9xSY42pEChpEgL1oAqzyo3bwpXsjOA73X3InjiOPJLInX1pbwhAgNsvmK QOcwAiRl0qxndPwLHMLjauu5vdV5JNGX6B2QOo3/W8hJvaWNAIioR/uLcYc2+J0CA9v/ f10udQjr4JfsQ5kkuCuxZ7lR7xxq5N/Ml1Xi0jsey6s+xFGLKm+bLAsOl//khlGeR8CS 9JVxUYF9zHjfFSJXG+JMbrsguO/sAgqihuC74iAuOYCm9gWrAQzVgqYe++Gb0xdXVFNO 8dtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=ytVIAaWj8JkkieFnBNn80sd5MHBlsGGI9hhLKU4M3Z8=; b=hv5fCndZmQCdzl5V+Za2XRx12DPxYmpye82Ykt3TiCHDY8Yg28WBfVv7Br79SxERtx 4zkZtNGcFXn2jeh57dMvVscat/Zt9WsLG0rzsn7iJSKxbb1X+dmhvMIr5dCow65H0VUi K4geUe+cPituMusKKY+wS8ez57Z/dp4Nzfj6fNEl+TKgsdvuxlfkwmEAP7TyDDDek6Zr bVC7yBSkbbHp7m8Yu/WS2ECXHGxd3TPxK38+5EeU34gz5b7dh4+c3wQaYCn4TKDdAGb4 tpBRS3V3NaP7kkxJjXIknyOUeRABanZ6TltKg2CbezuiCLQ7Q2GrYD+xkhwskALloc+j Be8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VAy6FEbO; dkim=neutral (no key) header.i=@linutronix.de header.b=hVuRU6Sa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y7-20020a17090a8b0700b001dc21334694si17970024pjn.42.2022.05.08.19.19.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 19:19:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VAy6FEbO; dkim=neutral (no key) header.i=@linutronix.de header.b=hVuRU6Sa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0B2DD59BB4; Sun, 8 May 2022 19:19:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386340AbiEEWhM (ORCPT + 99 others); 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 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INVALID_DATE_TZ_ABSURD,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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);