Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3058649ybt; Mon, 29 Jun 2020 14:11:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXCRXgP+kop0Sini+0aVaIWyfB4AkwWohxIyCylg1GjCyZQDevpqumAJr+jdUN3CcGfXIb X-Received: by 2002:a05:6402:31ba:: with SMTP id dj26mr13090154edb.181.1593465064161; Mon, 29 Jun 2020 14:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593465064; cv=none; d=google.com; s=arc-20160816; b=cMDesRJDyW4OAEae4fNRFsM7tWGY4vOf9qdqLAEs8MEuOihhsrND+Qov35S8rgcq4o u53aMPxAHNXUcMV4YCDMAF9G0vRcbscH7IX9/siCBaO52JgeC2Q3+C0tcBSVnWwEHZzy 2m/+Zna8/zHnWmfEbhV8Kh5nnqHAngiwp9HaDNsES1E8gJ/qMeadKHbK3ty8sEmtTIdK nxks0htrCKsPmh+xYDHfQlXGjaKDRBGVy5g16FYviA7ASthRd+Pa4x13nTlCICgBylRi l5XnXp1t79ZLY0o9tOjkpEbnbYGbwauplT17ddHLqfMmn73wrmxkrAGGll5FF0NsbWnx 36ZQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RhxTcrwYXtwo3gAiPE0l4rmSSZ65Gthg+1G9lwPi7hE=; b=j3JE9Jw5Q7IFxpXoqiS5+lnDIcd7PjBXipDeIhBdex8aOMj55NLV2bAsXCm3g+E8kX kKglwGjHE8qrrQaxSE5eONxfRGPtsFhlOChDuyXBU96ehD2qc01L9JlCmQnv6ZwGcoz0 Mnqu69zRic1iAqu0Cg3LRnGuu+mOnYt703R+hcjPaDdipRpcEX/QE+SUsqPqUaO/7rKG 2+ulimignmcECEQv0NN4VdaYdZ0mU1aKUwubPPjXoTpvQXs5qk34otkbV37IjQDd49uQ Hlrmxjb954FCq6Mi7m6OxEhv0lAdIcFcRb7LqJb0jb/rTF6ji6QjR9HPHdWTiQD0ZTTU VFrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rb1BzWSr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb4si364538ejb.173.2020.06.29.14.10.41; Mon, 29 Jun 2020 14:11:04 -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; dkim=pass header.i=@kernel.org header.s=default header.b=rb1BzWSr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390363AbgF2VHX (ORCPT + 99 others); Mon, 29 Jun 2020 17:07:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:53740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730952AbgF2TKR (ORCPT ); Mon, 29 Jun 2020 15:10:17 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 51091254C1; Mon, 29 Jun 2020 15:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593446017; bh=OnfXXT+AQvrD+v/2vMYn5PqETvnzchA6CKbftUpsUns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rb1BzWSrIWEiUyIkWEz3GPQdWFibicExBLA9UB69/Hee8OFVLbdhf9CLY+LHSZFFv SaiWa0OTxpynsAtwFVW9+EPwlY77HI8L90lWVgTRYiefr8lRIApVNtekaKQgQ2uTqq GkNcwJxSR89z+cI9tfpJgxYpbg4TXKz551ddU2s4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: John Stultz , Andy Shevchenko , Russell King , Jiri Slaby , linux-serial@vger.kernel.org, Valentin Schneider , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 4.4 024/135] serial: amba-pl011: Make sure we initialize the port.lock spinlock Date: Mon, 29 Jun 2020 11:51:18 -0400 Message-Id: <20200629155309.2495516-25-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629155309.2495516-1-sashal@kernel.org> References: <20200629155309.2495516-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.229-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.4.229-rc1 X-KernelTest-Deadline: 2020-07-01T15:53+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 899a77187bdea..c5da46f7b9093 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2323,6 +2323,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; -- 2.25.1