From patchwork Thu Apr 23 22:00:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 185745 Delivered-To: patches@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2588673ilf; Thu, 23 Apr 2020 15:01:01 -0700 (PDT) X-Received: by 2002:a17:90a:1946:: with SMTP id 6mr3045412pjh.42.1587679261523; Thu, 23 Apr 2020 15:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587679261; cv=none; d=google.com; s=arc-20160816; b=z8znaTNx9fjuNi06hINCGXxQ5UYr4SdSFjaPIgT4+1FhLi4sXOAcRrUD8w26T8SgK8 G+41HOogk+hjaVkFoDv2kJcRSfx61GJiZ+dVa2YQPYETJSqwd/dbM4eKcWeZN0Tm1X0S 1zFyMU3maG95Cgk3q4kqmd7W6HU+JtR3Uk2QLpu8BGWZjfJiv5BX+2Q3QkEOqGMN3HnV Pgg8vXhhAIspV5i/9s8JwlkXGAq1bFZVwe9JnUlHXUi3vnUAgvYAx3rk84SfTP+xJGkY KzT2XsjGbCNyQLnapMzSI6D0MmX04+ujJqGFwKMdelkbh5oi/HBc/h3kQaUXXpZv1lN/ yTFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=hSobCRVgJYv8jTPKwKrXDNHzB+BBFkTsELb63uGxAd8=; b=gkQhj7qUEk4a8QSQfinL9OM2C2veiQZKE+Xu6AKU6n2TaJqRcHkh4ejdk74HVqn3dF c2EGOupGeZSKkhKRnFq9ISPGMXrclHYxQMP4jm8JniP0AYbb38TD04IlYdKhZ1jH18gy qdSOfFEzr3xdzdwlqp6nHjalxLIg3+ST771B4Wb8e2T9GzaBAQb9W7MbxOlchsVlF/sq 7RIFcGyqnZEkUl5VxrPIazNeeliB/83IWQ19JM/DjxwD3NzFUPo4KjvgrFunR7oydRyb GwKWpvI0uz4IPseO68O1/1M5jp1mmwUfSnR4CIq9FYtf2qnHSPs8SrYLobKUI/97I1nv jAZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZYPUz1gx; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id ne4sor5103217pjb.24.2020.04.23.15.00.59 for (Google Transport Security); Thu, 23 Apr 2020 15:01:01 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZYPUz1gx; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=hSobCRVgJYv8jTPKwKrXDNHzB+BBFkTsELb63uGxAd8=; b=ZYPUz1gxAH/HgbgmZdKnWT/BQKippmQ+YUiRwZlCEZGBIAMYAtCRpmhtYm1WAA+3Z6 U1KQ9iddQi7ivCKuN3vwSYdtP/7DdE+9cBZyU6V6I7bXxi3hFy/7Ov7+q+bNHt1WO57r WmK4XRUeHrLsaiBE+XYsZeTSdEGxq/H9jsu2TR8r997KWGr1IeYNZmZ/hE0tQtlY7QVL pGr4lPo/0j7LglSY9w98a2sZKmMz97Wvf1L7i8fSQqqKK9Xm5dJuPmo+49Tj2iDpjtNY Q2qwqDQOFBmZGG0xQBrr/IWmjKA+M1Bs4v1ChRFCyGwuvhSapsQZzxxfpYJIoHPuo6an CeNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hSobCRVgJYv8jTPKwKrXDNHzB+BBFkTsELb63uGxAd8=; b=U/ce3O6HDxKawkKgt9dRvqvYCV9DvVyvyv0krQNrxJg1zeZbywXyyvJSIUeXdiGWr/ G/DyO3fyHUq2f2Faq3447MLE2PZORYZbgTcyZu1A2zdrU0RBpcehYyc9vTTO0P9h0q7n c1yh1aMcxOUUjEinwxAFm4fNoVtHt5T/0X0ZlgxdKO4Dc292m6BCAQcGgUUyNtg7zyW/ PEkCe6WRpLyohHrgs/mNw/NUycjZnBI9MUg61yX4wsXvvlHZuUK70AdVvN8hVCGIuhQU 5PpMR4BKOLkDKhhZl/aoiRP8p9x/wC7ARIVe+U2XO61dE/mErRQsVq77BKeNcP5r9+Rh /DNA== X-Gm-Message-State: AGi0PuaiKmYPmH35ljpy6yxdHxNfj+OFiUjTgYgxnH/c1TsebSzrpLDm Kj57CddQKnc7P80Coq7gPHGFyPzf X-Google-Smtp-Source: APiQypISQERDQ57ZtP48t/sQ5TT49fdM+AomovaRvC1c3Qrxqba75fl6A5M6o5QVA3yDOF0AVnK91Q== X-Received: by 2002:a17:90a:f985:: with SMTP id cq5mr2866956pjb.193.1587679259332; Thu, 23 Apr 2020 15:00:59 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id 135sm3515843pfu.125.2020.04.23.15.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 15:00:58 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Valentin Schneider , Russell King , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org Subject: [RFC][PATCH] serial: amba-pl011: Make sure we initialize the port.lock spinlock Date: Thu, 23 Apr 2020 22:00:56 +0000 Message-Id: <20200423220056.29450-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 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, the pl011 code doesn't initialize the spinlock. This patch fixes it by initializing the spinlock and the warning has gone away. 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(+) -- 2.17.1 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;