Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4149022ybe; Mon, 16 Sep 2019 07:29:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxppeAkmtCBIg7d6g8ccyu3oNC6ic9fv7rPCrPv/SgGyOVPd+cwFM6rbD/OnIK8+paLMw+X X-Received: by 2002:a17:906:d797:: with SMTP id pj23mr317752ejb.70.1568644149052; Mon, 16 Sep 2019 07:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568644149; cv=none; d=google.com; s=arc-20160816; b=taqWKhR2L97+2eVG4no0/OyW0ikJPUg/JYFW9PDjnS4SwRbVpi7pKbVhkXTcFLNq0C nn+RBfDsaO66VFe3+O/G32cQfEgZOSPQRXNbSrlQUjPbbkIJU0oq0ASdbrw6/EL6Jg/S PjhU1ZfHcM9u5VA+WOvYN7wrPoauexqaTP7c22AasAOTqtTefklZaNtmHM9Bt2pYpU90 TjrWnQxMG89ECh2nSOvbX4Wbsahnt4KQBum2x8M697u8fK+XSa1iBLTvi8GBcqFaz8h0 q2yRAMpGqzxw8182gMfxV+h0/eaSRJNPugw+Xqr9CiEx4M69PdIiwoc/X4E01TZwDLnj ZI2Q== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=P2OOZl0hTRGRiN0SUpAsGQ7s+kmFVThbuHS4t61DwSc=; b=NXjWi+7AKSVNVYKQrgVmrx3DJNr7+N0oYld28Dpbf96kmdF1/MlqUqqlIbuNdyUPPt O3G4PHpZ/4Lc5bduEzz1wNcN84M6zbOovIUXPQd6R4d2fuWUW9X15ML9j8lEDgH3ptMI /rBiwdojVmZG8xfyG3/bxkPSq716rGo+XN2gduUrZ/kfX0H5kJhgC+aI7KIapvnphzKF XGxLePtxnV7BwFr4wEVCFKpfqqylckuq4Q3pwRC1kIBenKT7aUT/Fj/VivYFjyjHDUiG tqXQ0F/tXXcZE1ynPSe3ikCPiZ3QpkzrllG56xdXr0SyOJ7v4/e7V1TQ6fh7VPjQYh5o Zblg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3si19093487ejx.33.2019.09.16.07.28.39; Mon, 16 Sep 2019 07:29:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388633AbfIPOYU (ORCPT + 99 others); Mon, 16 Sep 2019 10:24:20 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:35875 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388541AbfIPOYT (ORCPT ); Mon, 16 Sep 2019 10:24:19 -0400 Received: from kresse.hi.pengutronix.de ([2001:67c:670:100:1d::2a]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1i9rvN-0002y0-MR; Mon, 16 Sep 2019 16:24:17 +0200 Message-ID: Subject: Re: [PATCH 3/4] serial: imx: adapt rx buffer and dma periods From: Lucas Stach To: Philipp Puschmann , linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, jslaby@suse.com, vkoul@kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, gregkh@linuxfoundation.org, dmaengine@vger.kernel.org, dan.j.williams@intel.com, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Date: Mon, 16 Sep 2019 16:24:17 +0200 In-Reply-To: <20190911144943.21554-4-philipp.puschmann@emlix.com> References: <20190911144943.21554-1-philipp.puschmann@emlix.com> <20190911144943.21554-4-philipp.puschmann@emlix.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::2a X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mi, 2019-09-11 at 16:49 +0200, Philipp Puschmann wrote: > Using only 4 DMA periods for UART RX is very few if we have a high > frequency of small transfers - like in our case using Bluetooth with many > small packets via UART - causing many dma transfers but in each only > filling a fraction of a single buffer. Such a case may lead to the > situation that DMA RX transfer is triggered but no buffer is available. > While we have addressed the dma handling already we still want to avoid > UART RX FIFO overrun. So we decrease the size of the buffers and increase > their number and the total buffer size. > > Signed-off-by: Philipp Puschmann Reasoning seems sound: Reviewed-by: Lucas Stach > --- > drivers/tty/serial/imx.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 57d6e6ba556e..cdc51569237c 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -1028,8 +1028,6 @@ static void imx_uart_timeout(struct timer_list *t) > } > } > > -#define RX_BUF_SIZE (PAGE_SIZE) > - > /* > * There are two kinds of RX DMA interrupts(such as in the MX6Q): > * [1] the RX DMA buffer is full. > @@ -1112,7 +1110,8 @@ static void imx_uart_dma_rx_callback(void *data) > } > > /* RX DMA buffer periods */ > -#define RX_DMA_PERIODS 4 > +#define RX_DMA_PERIODS 16 > +#define RX_BUF_SIZE (PAGE_SIZE / 4) > > static int imx_uart_start_rx_dma(struct imx_port *sport) > {