From patchwork Fri Oct 17 13:13:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Gala X-Patchwork-Id: 5097291 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F19C9C11AC for ; Fri, 17 Oct 2014 13:15:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F669201FA for ; Fri, 17 Oct 2014 13:15:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5B63B2010F for ; Fri, 17 Oct 2014 13:15:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xf7Lb-0004v6-EY; Fri, 17 Oct 2014 13:13:35 +0000 Received: from smtp.codeaurora.org ([198.145.11.231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xf7LX-0004nd-J7 for linux-arm-kernel@lists.infradead.org; Fri, 17 Oct 2014 13:13:32 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id A36F413F9C6; Fri, 17 Oct 2014 13:13:10 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 8FA6F13F9C8; Fri, 17 Oct 2014 13:13:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from galak-ubuntu.qualcomm.com (rrcs-67-52-129-61.west.biz.rr.com [67.52.129.61]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: galak@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B785913F9C6; Fri, 17 Oct 2014 13:13:09 +0000 (UTC) From: Kumar Gala To: gregkh@linuxfoundation.org Subject: [PATCH] tty: serial: msm: Fix lock init issue with earlycon Date: Fri, 17 Oct 2014 08:13:08 -0500 Message-Id: <1413551588-14877-1-git-send-email-galak@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141017_061331_680827_9DD171BA X-CRM114-Status: GOOD ( 11.91 ) X-Spam-Score: 0.0 (/) Cc: linux-arm-msm , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kumar Gala X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP With CONFIG_DEBUG_SPINLOCK enabled we see: BUG: spinlock bad magic on CPU#0, swapper/0 lock: early_console_dev+0x8/0x160, .magic: 00000000, .owner: /-1, .owner_cpu: 0 CPU: 0 PID: 0 Comm: swapper Not tainted 3.17.0-09733-gb446b33-dirty #18 Call trace: [] dump_backtrace+0x0/0x140 [] show_stack+0x10/0x1c [] dump_stack+0x74/0xb8 [] spin_dump+0x78/0x88 [] spin_bug+0x24/0x34 [] do_raw_spin_lock+0x30/0x158 [] _raw_spin_lock+0x1c/0x2c [] __msm_console_write+0x68/0x154 [] msm_serial_early_write_dm+0x14/0x20 [] call_console_drivers.constprop.23+0xa4/0xc4 [] console_unlock+0x2a8/0x330 [] register_console+0x26c/0x338 [] setup_earlycon+0x2c0/0x300 [] msm_serial_dm_setup_earlycon+0x18/0x24 [] do_early_param+0x84/0xd0 [] parse_args+0x2b4/0x3ec [] parse_early_options+0x2c/0x38 [] parse_early_param+0x34/0x50 [] setup_arch+0x290/0x604 [] start_kernel+0x94/0x38c As the earlycon write function for msm requires a lock, we need to init it as part of the setup call. Signed-off-by: Kumar Gala --- drivers/tty/serial/msm_serial.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 4b6c783..8ab27c9 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -973,6 +973,8 @@ msm_serial_early_console_setup(struct earlycon_device *device, const char *opt) if (!device->port.membase) return -ENODEV; + spin_lock_init(&device->port.lock); + device->con->write = msm_serial_early_write; return 0; } @@ -995,6 +997,8 @@ msm_serial_early_console_setup_dm(struct earlycon_device *device, if (!device->port.membase) return -ENODEV; + spin_lock_init(&device->port.lock); + device->con->write = msm_serial_early_write_dm; return 0; }