Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1016413ybe; Thu, 19 Sep 2019 07:25:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpyLWV5T9wVqQgYPizL3xN2ipmBMuwvVmiONZ0JEuCSqfAiSFjJMZL4SWj0qo3OgF/3Z5I X-Received: by 2002:a50:d6db:: with SMTP id l27mr16636951edj.164.1568903156173; Thu, 19 Sep 2019 07:25:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568903156; cv=none; d=google.com; s=arc-20160816; b=ovznNgxUcnvKJRsbSG/J+/GDWnsoWbV5q00pMF0O9Xq8xsD8wyPNqinDlro8O7OUd4 dlJvrdC1JhCD+yc6OhjzBf2UCOZHDd58+XDuXGOVHuODJa7Bia5odhZvcHHMrffJVUSP qKe1/8XSb4oV3HgH6FhcZtjqdMUgmv4+o6436vy0hzHJc3bhfduMsf4YkRBJxTOXfnuj xfdnNzO6O7VaBRaraVhFd16xV6/qCMpVfwcQOyJBVefvM7otUST+TIY/Ho6HlG5X5PjJ 2sKuBO5Vj5kob8Q+GM5gHfRxqozULovy4d7zOUpWD231RKIHfgsoqaN0v/y5cdpiVW0I Z4ag== 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 :message-id:date:subject:cc:to:from; bh=3wmcop/w0533/PNQxYQriJ5dxkOnJHenpop83dFjdRg=; b=wLUpKLbCpCu1FCZevJGDI3dVDLebcPVRHyLRAeYpGApciOObyFo8KnSchx7PsHYnNN aTzsd5hNNvIiPAAlXIKlYCrOa4XrqXsJsXGdrHyK7ioJl9Srj+VZpXXxV8SQXRa4M8xH Fit+wDyJu3K5x9VIcjZEy4OvkzRMcnPjA4vCx3rpSyaY2dTMi9XEpQg605/V4TA5nJo6 ngqZFUAf5ROmUMIZuo07juDV2Jt9PkD7eeYpktgK+67hMMVLfarOPP8EX9fjuBSpEjiF QJADdR87KLqshWJcYPi0r9Nw4KA653MhziZrfMViJ3IzWBN0vZtcMQXrAKx1ao+nsluW bKJw== 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 b44si5423018ede.451.2019.09.19.07.25.32; Thu, 19 Sep 2019 07:25:56 -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 S1731435AbfISK0t (ORCPT + 99 others); Thu, 19 Sep 2019 06:26:49 -0400 Received: from mx1.emlix.com ([188.40.240.192]:57624 "EHLO mx1.emlix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388156AbfISK0t (ORCPT ); Thu, 19 Sep 2019 06:26:49 -0400 Received: from mailer.emlix.com (unknown [81.20.119.6]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id EF3CC603CA; Thu, 19 Sep 2019 12:26:46 +0200 (CEST) From: Philipp Puschmann To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, yibin.gong@nxp.com, fugang.duan@nxp.com, l.stach@pengutronix.de, jslaby@suse.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Philipp Puschmann Subject: [PATCH v2] serial: imx: adapt rx buffer and dma periods Date: Thu, 19 Sep 2019 12:26:28 +0200 Message-Id: <20190919102628.23621-1-philipp.puschmann@emlix.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 free buffer is available. While we have addressed the dma handling already with "dmaengine: imx-sdma: fix dma freezes" 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 Reviewed-by: Lucas Stach --- Changelog v2: - split this patch from series "Fix UART DMA freezes for iMX6" - add Reviewed-by tag 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 87c58f9f6390..51dc19833eab 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1034,8 +1034,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. @@ -1118,7 +1116,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) { -- 2.23.0