From patchwork Fri Aug 16 11:43:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19237 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f198.google.com (mail-gh0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 95B44246AB for ; Fri, 16 Aug 2013 11:46:11 +0000 (UTC) Received: by mail-gh0-f198.google.com with SMTP id r13sf2014256ghr.1 for ; Fri, 16 Aug 2013 04:46:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=7Zpi7jkl9XVsE7uMfb+3sF4WKN4TMlKrwJrejNBzu90=; b=GHOsv5UpLthSOp1+hKDjYaBunbv3mvkBwU5m0Dtqc4zdy01CaM59PhTpVtQnooelzX NTy9me3RY63b20M/8YnR+TvtfwbzqEbA+4IXvnSqwxT5EpAOrd4Z5f+TUjtTif8EkU4s p+/h2uU6A4nqBAGtm3FK1n0wHBuXjXPsZBAPZmzi78Kzo+lYHKYqnZGijPlAGtD2aJRK XoBVXI/m0JDTPFkTdXPANX6Jcx/8Ghk/8QlQSZkVN62ZoOZy853bRTt1MfBJBH1BL9V8 SoTQvfg//qv917XkT6quiqxmp6GsK6zhHyHFdNV3kClsD3mIOHc6doyoK3WWjynUwk77 irQQ== X-Received: by 10.236.200.135 with SMTP id z7mr374290yhn.41.1376653571341; Fri, 16 Aug 2013 04:46:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.4 with SMTP id d4ls523155qez.76.gmail; Fri, 16 Aug 2013 04:46:11 -0700 (PDT) X-Received: by 10.221.51.206 with SMTP id vj14mr876064vcb.17.1376653571220; Fri, 16 Aug 2013 04:46:11 -0700 (PDT) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id he13si230726veb.7.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 04:46:11 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.42; Received: by mail-vb0-f42.google.com with SMTP id e12so1567617vbg.1 for ; Fri, 16 Aug 2013 04:46:11 -0700 (PDT) X-Gm-Message-State: ALoCoQlFXCkrch4A5oXZpYVOmVguKr7jBykwjM+yJoXFzUMLpFDfcq/Ai8bqndFX4ziOzk8qqhmz X-Received: by 10.220.198.133 with SMTP id eo5mr183119vcb.24.1376653571146; Fri, 16 Aug 2013 04:46:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp64190vcz; Fri, 16 Aug 2013 04:46:10 -0700 (PDT) X-Received: by 10.66.146.199 with SMTP id te7mr2666532pab.106.1376653570318; Fri, 16 Aug 2013 04:46:10 -0700 (PDT) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by mx.google.com with ESMTPS id tw4si828704pbc.331.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 04:46:10 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.43 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.43; Received: by mail-pa0-f43.google.com with SMTP id hz10so1787078pad.16 for ; Fri, 16 Aug 2013 04:46:10 -0700 (PDT) X-Received: by 10.66.221.8 with SMTP id qa8mr639006pac.188.1376653569934; Fri, 16 Aug 2013 04:46:09 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id w6sm1665886pbt.32.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 16 Aug 2013 04:46:09 -0700 (PDT) From: Viresh Kumar To: gregkh@linuxfoundation.org, jslaby@suse.cz Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, linux-serial@vger.kernel.org, Viresh Kumar , Stephen Warren Subject: [PATCH 23/25] tty: serial: tegra: drop uart_port->lock before calling tty_flip_buffer_push() Date: Fri, 16 Aug 2013 17:13:24 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The -rt patch triggers a lockdep warning for serial drivers if tty_flip_buffer_push() is called with uart_port->lock locked. This never shows up on UP kernels. Release the port lock before calling tty_flip_buffer_push() and reacquire it after the call. Similar stuff was already done for few other drivers in the past, like: commit 2389b272168ceec056ca1d8a870a97fa9c26e11a Author: Thomas Gleixner Date: Tue May 29 21:53:50 2007 +0100 [ARM] 4417/1: Serial: Fix AMBA drivers locking Cc: Stephen Warren Signed-off-by: Viresh Kumar --- drivers/tty/serial/serial-tegra.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c index ee7c812..82846cf 100644 --- a/drivers/tty/serial/serial-tegra.c +++ b/drivers/tty/serial/serial-tegra.c @@ -571,7 +571,9 @@ static void tegra_uart_rx_dma_complete(void *args) tegra_uart_handle_rx_pio(tup, port); if (tty) { + spin_unlock_irqrestore(&u->lock, flags); tty_flip_buffer_push(port); + spin_lock_irqsave(&u->lock, flags); tty_kref_put(tty); } tegra_uart_start_rx_dma(tup); @@ -583,11 +585,13 @@ static void tegra_uart_rx_dma_complete(void *args) spin_unlock_irqrestore(&u->lock, flags); } -static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup) +static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup, + unsigned long *flags) { struct dma_tx_state state; struct tty_struct *tty = tty_port_tty_get(&tup->uport.state->port); struct tty_port *port = &tup->uport.state->port; + struct uart_port *u = &tup->uport; int count; /* Deactivate flow control to stop sender */ @@ -604,7 +608,9 @@ static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup) tegra_uart_handle_rx_pio(tup, port); if (tty) { + spin_unlock_irqrestore(&u->lock, *flags); tty_flip_buffer_push(port); + spin_lock_irqsave(&u->lock, *flags); tty_kref_put(tty); } tegra_uart_start_rx_dma(tup); @@ -671,7 +677,7 @@ static irqreturn_t tegra_uart_isr(int irq, void *data) iir = tegra_uart_read(tup, UART_IIR); if (iir & UART_IIR_NO_INT) { if (is_rx_int) { - tegra_uart_handle_rx_dma(tup); + tegra_uart_handle_rx_dma(tup, &flags); if (tup->rx_in_progress) { ier = tup->ier_shadow; ier |= (UART_IER_RLSI | UART_IER_RTOIE |