Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2338016ybz; Thu, 23 Apr 2020 16:17:34 -0700 (PDT) X-Google-Smtp-Source: APiQypKbihuGYLuYyH1eA7p43INlW4eE7dzg9Zzq78LRzwBcpcyprl+f2iI99zTm4s7nIWmo5bGj X-Received: by 2002:a05:6402:16d5:: with SMTP id r21mr5167232edx.150.1587683853708; Thu, 23 Apr 2020 16:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587683853; cv=none; d=google.com; s=arc-20160816; b=i/dDHqclKS13bn/RY2gd1KbEerQvQ/oPanRRUwNiVCUsl40VXgPAJrWNkczKtbiQPG P8J5S2FsoLyFhnOLwLZofIDrMorvrdM8CTlpjbJMhV7ZFYGVU9gNLRM8rCGRX6zS69eY CBaEkdYDScpuxffmeIQG5LyIps/O8sXkzoK9FWDOZT3YBOqZiZwmqHwkVPZi7ul9ZV7Y aXXQlT80vKsQd7sCiey+ZxdtC8D8cqqL82tmIo1pLf5TF41HBaxDYFg1xvScJjea3QQe F9K9q5NzpnoFBH2GgouU2S40Q6leaP8xE/zGiHzHtc7DbqF2TB1xKoPhUzd6xg7vpVzv NyUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references; bh=wWk/iHg5FY92lyOBDLxvogElT95qE/KEp64Dy3CYHBU=; b=VsCAj8DKHz0zCt3HxtyW9t3ZB2aPDH3lP+nxXh46j/I7EKh+fSYqL2AxSLVE2XkMo+ BkJZ3YDZ1HhNdJTCnok0z1PTMYv6A1FFXFn3L7is2L/f7TrOom8kUwk7MTulRZUi3dJo srYOByMK5ZeyKo04swsVOfxLXlNEPwLMtKfM2OvHudXRWZSBEYXSTvrWBNYwnplWar0P sEcXcXvtLhvA8wJ+fBagLMAxpPtDqqO/R/2Bb8c90n+454aO2w3OqdDsA+eoqPdwFLlD 9TC4MnDYxmu00F/FPJsmxnuijYX+ZBR22KQ5UaVAUph+Q/247Ssv18SozipKpQ+kRSEb lajQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kt5si1912597ejb.455.2020.04.23.16.17.10; Thu, 23 Apr 2020 16:17:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729544AbgDWXO5 (ORCPT + 99 others); Thu, 23 Apr 2020 19:14:57 -0400 Received: from foss.arm.com ([217.140.110.172]:49276 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728441AbgDWXOy (ORCPT ); Thu, 23 Apr 2020 19:14:54 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3DA7430E; Thu, 23 Apr 2020 16:14:53 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 57B033F68F; Thu, 23 Apr 2020 16:14:52 -0700 (PDT) References: <20200423220056.29450-1-john.stultz@linaro.org> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: John Stultz Cc: lkml , Russell King , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org Subject: Re: [RFC][PATCH] serial: amba-pl011: Make sure we initialize the port.lock spinlock In-reply-to: <20200423220056.29450-1-john.stultz@linaro.org> Date: Fri, 24 Apr 2020 00:14:46 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi John, On 23/04/20 23:00, John Stultz wrote: > Which seems to be due to the fact that after allocating the uap > structure, the pl011 code doesn't initialize the spinlock. > > This patch fixes it by initializing the spinlock and the warning > has gone away. > Thanks for having a look. It does seem like the reasonable thing to do, and I no longer get the warning on h960. That said, I got more curious as this doesn't show up on my Juno (same Image). Digging into it I see that uart_add_one_port() has a call to uart_port_spin_lock_init() a few lines before uart_configure_port() (in which the above warning gets triggered). That thing says: * Ensure that the serial console lock is initialised early. * If this port is a console, then the spinlock is already initialised. Which requires me to ask: are we doing the right thing here? > CC: Valentin Schneider > Cc: Russell King > Cc: Greg Kroah-Hartman > Cc: Jiri Slaby > Cc: linux-serial@vger.kernel.org > Reported-by: Valentin Schneider > Signed-off-by: John Stultz > --- > drivers/tty/serial/amba-pl011.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c > index 2296bb0f9578..458fc3d9d48c 100644 > --- a/drivers/tty/serial/amba-pl011.c > +++ b/drivers/tty/serial/amba-pl011.c > @@ -2575,6 +2575,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, > uap->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_AMBA_PL011_CONSOLE); > uap->port.flags = UPF_BOOT_AUTOCONF; > uap->port.line = index; > + spin_lock_init(&uap->port.lock); > > amba_ports[index] = uap;