From patchwork Tue Jun 23 19:55:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 191593 Delivered-To: patch@linaro.org Received: by 2002:a54:3249:0:0:0:0:0 with SMTP id g9csp1363497ecs; Tue, 23 Jun 2020 14:18:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwG6y3bB++6qfUGW6CnwOkstoKdfF62a6Eizpb9WkjgAQ5goJ8+Gpkk7BzvPPbzTX84+sD X-Received: by 2002:a17:906:d204:: with SMTP id w4mr22214579ejz.117.1592947090869; Tue, 23 Jun 2020 14:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592947090; cv=none; d=google.com; s=arc-20160816; b=pUvjmEG3Zq/Esqm66E57b6fJ57ZdZwG8qwP/xDV2Et/f/uQTv4z0Exve3SZ+ejdmQB hRFZ43j9EV1jo0Do7WCsa+BFAVXItqPW3DSMTn568B0mUrHnnCFdG+NsivnFX9k35o7b wYiwkiAd7geYmfo+qaboJGV54Y7resVrPfCfyklpCPeWinwoO05HmEyVudn+rwykBP0b e60Xvc/dd++mvePGl5o4j5EXpgCrMGzaCUfRfCM7V49dwLbsViTB76BNtbLP2O9LfoYr NJ++dHseOnGYBE0pSeSvYE//be7VJV9iPemTrAEdYHaKw8paSQJxlHvy1SQd1YgFZhaL OZ5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F5hgvaNvShjL4hnDczgvzi1e9krZ9wzXHEclQq8dRcQ=; b=NoJEnnbEUB14pGQzEdD8Bsh080ZW9ijKaq+E6RRbAVw71drZN7LNt6gHztarTb4t+E Zy0kSH4HcbDlUe3xE+F0cLA0Dg4MFtG4FnZtuF9ZIgwEj2393/h1Vff5BM93oPM4fIPe gxvymoVdUp2veUI0KtvmNvbtbQmX0q3a3sONg0oeta8J/rY3A0WrtmeRzgqzpZkuGORS 7WKe+VTU+qQtPKdW1vTB3sQ2Fg7KpQV/ksBCfnbfWAuLcSLDNUzxVibVsUbSa+4H9Tk6 Lqfm92H46BCnjvM+PvtUycHVu51Ct/k7pzz6Aw2LPL6Oh0+HyPHMBFtfid+bwF8ifSeQ 6gsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YD9HeAsU; spf=pass (google.com: domain of linux-serial-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-serial-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 a24si1478615ejk.208.2020.06.23.14.18.10; Tue, 23 Jun 2020 14:18:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-serial-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YD9HeAsU; spf=pass (google.com: domain of linux-serial-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390643AbgFWVSJ (ORCPT + 1 other); Tue, 23 Jun 2020 17:18:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:45160 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390613AbgFWU0G (ORCPT ); Tue, 23 Jun 2020 16:26:06 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B400C2070E; Tue, 23 Jun 2020 20:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943966; bh=NQ1hh8recCrcz/rnpFxEuovWZ+v8MYePaRwDUH0kfvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YD9HeAsUsQo83mdpTdnp6DNdwtpIGHM/kuZVNRK04/zoAmmzpx+U4crT0wFoAb4J/ vEiN2SOYQbT0ibRqzxhW+NTw4S7KnbYxggnRl3INRUPw7lINqjelS/4OiJB+JqmLXK nmdO/lo9fIsrXisB3ncH9h/rsx/SOB5OMAwWqgE8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Russell King , Jiri Slaby , linux-serial@vger.kernel.org, Valentin Schneider , John Stultz , Sasha Levin Subject: [PATCH 5.4 120/314] serial: amba-pl011: Make sure we initialize the port.lock spinlock Date: Tue, 23 Jun 2020 21:55:15 +0200 Message-Id: <20200623195344.595843911@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: John Stultz [ Upstream commit 8508f4cba308f785b2fd4b8c38849c117b407297 ] Valentine reported seeing: [ 3.626638] INFO: trying to register non-static key. [ 3.626639] the code is fine but needs lockdep annotation. [ 3.626640] turning off the locking correctness validator. [ 3.626644] CPU: 7 PID: 51 Comm: kworker/7:1 Not tainted 5.7.0-rc2-00115-g8c2e9790f196 #116 [ 3.626646] Hardware name: HiKey960 (DT) [ 3.626656] Workqueue: events deferred_probe_work_func [ 3.632476] sd 0:0:0:0: [sda] Optimal transfer size 8192 bytes not a multiple of physical block size (16384 bytes) [ 3.640220] Call trace: [ 3.640225] dump_backtrace+0x0/0x1b8 [ 3.640227] show_stack+0x20/0x30 [ 3.640230] dump_stack+0xec/0x158 [ 3.640234] register_lock_class+0x598/0x5c0 [ 3.640235] __lock_acquire+0x80/0x16c0 [ 3.640236] lock_acquire+0xf4/0x4a0 [ 3.640241] _raw_spin_lock_irqsave+0x70/0xa8 [ 3.640245] uart_add_one_port+0x388/0x4b8 [ 3.640248] pl011_register_port+0x70/0xf0 [ 3.640250] pl011_probe+0x184/0x1b8 [ 3.640254] amba_probe+0xdc/0x180 [ 3.640256] really_probe+0xe0/0x338 [ 3.640257] driver_probe_device+0x60/0xf8 [ 3.640259] __device_attach_driver+0x8c/0xd0 [ 3.640260] bus_for_each_drv+0x84/0xd8 [ 3.640261] __device_attach+0xe4/0x140 [ 3.640263] device_initial_probe+0x1c/0x28 [ 3.640265] bus_probe_device+0xa4/0xb0 [ 3.640266] deferred_probe_work_func+0x7c/0xb8 [ 3.640269] process_one_work+0x2c0/0x768 [ 3.640271] worker_thread+0x4c/0x498 [ 3.640272] kthread+0x14c/0x158 [ 3.640275] ret_from_fork+0x10/0x1c Which seems to be due to the fact that after allocating the uap structure, nothing initializes the spinlock. Its a little confusing, as uart_port_spin_lock_init() is one place where the lock is supposed to be initialized, but it has an exception for the case where the port is a console. This makes it seem like a deeper fix is needed to properly register the console, but I'm not sure what that entails, and Andy suggested that this approach is less invasive. Thus, this patch resolves the issue by initializing the spinlock in the driver, and resolves the resulting warning. Cc: Andy Shevchenko Cc: Russell King Cc: Jiri Slaby Cc: linux-serial@vger.kernel.org Reported-by: Valentin Schneider Reviewed-by: Andy Shevchenko Signed-off-by: John Stultz Reviewed-and-tested-by: Valentin Schneider Link: https://lore.kernel.org/r/20200428184050.6501-1-john.stultz@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/amba-pl011.c | 1 + 1 file changed, 1 insertion(+) -- 2.25.1 diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index b0b6895463952..de3e8c24c03e7 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2585,6 +2585,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, uap->port.fifosize = uap->fifosize; uap->port.flags = UPF_BOOT_AUTOCONF; uap->port.line = index; + spin_lock_init(&uap->port.lock); amba_ports[index] = uap;