From patchwork Fri Aug 16 11:43:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19228 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6F421246AB for ; Fri, 16 Aug 2013 11:45:10 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id j10sf2152911qcx.2 for ; Fri, 16 Aug 2013 04:45:10 -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=jfq0gQfdqxWTcPP/wpt3i0wjX90mq38ikTRwSwMiu1o=; b=f212fZFyNSFioLPAMO+JXKRZPTLIb5gLqkWxvPRyW98DacCcwVcMfLxT6+4LYGEQjM Y/Gc0gGhekrSxD2vULDP2clPcBgOIJr8BQ5IghNTjc7Gcvx3xXFW4KnygRWKHV6cf/Re S5l47TRGZ18pf0SSzNfGmm5SFRxLfI9Z7homeT9+/1AtXaSjX9BgxWNTzo6VlmLt+RGJ ZBRZZuX+WBtXF89FDDZoKKRHy4oSuPUn4lRwAZTjJ+IrcV0G/pqXvaaN7thqGksHmudd 9GMsUhCCJjRa+t12hcpVx8qV8qKKR61vtpgB0FGCgxpfMfjV5QiQrzaG7KchZpXvSuXi rncg== X-Received: by 10.236.53.70 with SMTP id f46mr395448yhc.17.1376653510250; Fri, 16 Aug 2013 04:45:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.1.168 with SMTP id 8ls648397qen.8.gmail; Fri, 16 Aug 2013 04:45:10 -0700 (PDT) X-Received: by 10.220.46.72 with SMTP id i8mr891997vcf.10.1376653510152; Fri, 16 Aug 2013 04:45:10 -0700 (PDT) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id vf5si217525vdc.109.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 04:45:10 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.47 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.47; Received: by mail-vb0-f47.google.com with SMTP id h10so1488605vbh.20 for ; Fri, 16 Aug 2013 04:45:10 -0700 (PDT) X-Gm-Message-State: ALoCoQn3KC1imP7g09sc3E3lZNXM7uuJde8uiK7w146zJL8LOENwcQSKd4q82qYDQemUSGsVXmon X-Received: by 10.52.0.52 with SMTP id 20mr726933vdb.22.1376653510079; Fri, 16 Aug 2013 04:45:10 -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 u4csp64152vcz; Fri, 16 Aug 2013 04:45:09 -0700 (PDT) X-Received: by 10.68.143.199 with SMTP id sg7mr1253209pbb.13.1376653509091; Fri, 16 Aug 2013 04:45:09 -0700 (PDT) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by mx.google.com with ESMTPS id zr1si898917pbc.0.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 04:45:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.169 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.169; Received: by mail-pd0-f169.google.com with SMTP id r10so2165467pdi.0 for ; Fri, 16 Aug 2013 04:45:08 -0700 (PDT) X-Received: by 10.66.191.5 with SMTP id gu5mr2574917pac.126.1376653508700; Fri, 16 Aug 2013 04:45:08 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id fl3sm2865759pad.10.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 16 Aug 2013 04:45:08 -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 Subject: [PATCH 14/25] tty: serial: mfd: drop uart_port->lock before calling tty_flip_buffer_push() Date: Fri, 16 Aug 2013 17:13:15 +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.47 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 Signed-off-by: Viresh Kumar --- drivers/tty/serial/mfd.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c index 4a82267..d3db042 100644 --- a/drivers/tty/serial/mfd.c +++ b/drivers/tty/serial/mfd.c @@ -386,7 +386,7 @@ static void serial_hsu_stop_tx(struct uart_port *port) /* This is always called in spinlock protected mode, so * modify timeout timer is safe here */ -void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts) +void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts, unsigned long *flags) { struct hsu_dma_buffer *dbuf = &up->rxbuf; struct hsu_dma_chan *chan = up->rxc; @@ -438,7 +438,9 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts) | (0x1 << 16) | (0x1 << 24) /* timeout bit, see HSU Errata 1 */ ); + spin_unlock_irqrestore(&up->port.lock, *flags); tty_flip_buffer_push(tport); + spin_lock_irqsave(&up->port.lock, *flags); chan_writel(chan, HSU_CH_CR, 0x3); @@ -459,7 +461,8 @@ static void serial_hsu_stop_rx(struct uart_port *port) } } -static inline void receive_chars(struct uart_hsu_port *up, int *status) +static inline void receive_chars(struct uart_hsu_port *up, int *status, + unsigned long *flags) { unsigned int ch, flag; unsigned int max_count = 256; @@ -519,7 +522,10 @@ static inline void receive_chars(struct uart_hsu_port *up, int *status) ignore_char: *status = serial_in(up, UART_LSR); } while ((*status & UART_LSR_DR) && max_count--); + + spin_unlock_irqrestore(&up->port.lock, *flags); tty_flip_buffer_push(&up->port.state->port); + spin_lock_irqsave(&up->port.lock, *flags); } static void transmit_chars(struct uart_hsu_port *up) @@ -613,7 +619,7 @@ static irqreturn_t port_irq(int irq, void *dev_id) lsr = serial_in(up, UART_LSR); if (lsr & UART_LSR_DR) - receive_chars(up, &lsr); + receive_chars(up, &lsr, &flags); check_modem_status(up); /* lsr will be renewed during the receive_chars */ @@ -643,7 +649,7 @@ static inline void dma_chan_irq(struct hsu_dma_chan *chan) /* Rx channel */ if (chan->dirt == DMA_FROM_DEVICE) - hsu_dma_rx(up, int_sts); + hsu_dma_rx(up, int_sts, &flags); /* Tx channel */ if (chan->dirt == DMA_TO_DEVICE) {