Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4143834ybb; Tue, 7 Apr 2020 01:26:02 -0700 (PDT) X-Google-Smtp-Source: APiQypLFFqCtdAciNZ21U+9HosE25WNlhlMjdtGVeYTXagCZFxerk2xuDRSZBNTpS9VpocCMqgGV X-Received: by 2002:a05:6830:19ee:: with SMTP id t14mr642699ott.287.1586247962156; Tue, 07 Apr 2020 01:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586247962; cv=none; d=google.com; s=arc-20160816; b=RESDP38NhlJ3woSfYyhcEUQJ5K/03ZXyPca905hzk+6rIOh/U5aWZNQ8WpM3hNCeqG IkmSkMxbRW1pwn2/Sr4W/8fzbzrfNo8UBf4sbKJ4wqXzlzdSnu57uGOXGvjmhz/vUrR3 jeM0WtZzhcspHYNPkUK5e9bZdHu2DYkeO3TIZgxkXtaHrfxbYJZyve4xGnk0n6yMD6vY MbO7zFPtwRyOTZFK9X0DKMuW3sZTh/7NAb8WxwGO1Fw58jMxVP7AqZMoinJ57JrhAEsk a9QTe9MEFJC+XMzurtDDMpLC6S50nv5OBmpxnh7a3ZWnrQxk5a77cryHK/7GG0YxI0y6 XtDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=1JwMO73BO+ht0ZeZ99MfRPNn0BvS5rQyAUZjSPAKJqI=; b=IyP1wZVkRLdrBmB2IbEXRyhnNEN/Zb5e51SRqVHtFmUgVerINbdnDu77cfFH2G3D1d t0h1JUu1bfA1BVPiuOfrvJNCZBsNYs9fITNkk1h1j8MCgrqErn+0uZJMHqm4G8g5ugrP pzCh3RFGPyHLnYYaEwJJ4HVMx07n8XmIP7b6HijS+LCDJL1VNm8IzCsa7r9WJfMJF8vI QxJezrZFlLh9NcAZOfhUlHJhAE3cmrNlslCkaArgThEfiVvw8khoyguHORicWbxMA4uI Pgap1OQIxVvfh0NLCjc27pJZEgt3/tCTzjUOucOAd64Aem+nrQyDRka7NCgbD2eJ9soa Zzwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ynnn9jZa; 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 h19si923876otq.86.2020.04.07.01.25.48; Tue, 07 Apr 2020 01:26:02 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ynnn9jZa; 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 S1726721AbgDGIY7 (ORCPT + 99 others); Tue, 7 Apr 2020 04:24:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:47178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725883AbgDGIY6 (ORCPT ); Tue, 7 Apr 2020 04:24:58 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 351A2206F5; Tue, 7 Apr 2020 08:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586247896; bh=IYb2+hXmpvqAeqxl3BbYye9bnfH9byYpN4dj42j/PW0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ynnn9jZaCGXhbzmY63rVaQFUK6H2S+7lQvJnbYjaIqQyW6rbxw5ZXCJtmDM4d8rm4 A432RuZIMP4yy2FOz3mf4WBcUytQyIoP5DKoqeg53zT9GSsjvmfYBysYHSyo7/JhAp 0WnTFz+qXA+BGrqQaA6y66f5xBPCTOul1IcxO0qs= Date: Tue, 7 Apr 2020 10:24:54 +0200 From: Greg Kroah-Hartman To: gianluca Cc: jslaby@suse.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Gianluca Renzi , dimka@embeddedalley.com, linux@rempel-privat.de Subject: Re: Serial data loss Message-ID: <20200407082454.GA299198@kroah.com> References: <960c5054-48b0-fedc-4f3a-7246d84da832@eurek.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <960c5054-48b0-fedc-4f3a-7246d84da832@eurek.it> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 07, 2020 at 09:30:21AM +0200, gianluca wrote: > I have a BIG trouble having dataloss when using two internal serial ports of > my boards based on NXP/FreeScale iMX28 SoC ARMv5Te ARM920ej-s architecture. > > It runs at 454Mhz. > > Kernel used 4.9.x That's a very old kernel, you are going to have to get support for that from the vendor you bought it from :( > When using my test case unit software between two serial ports connect each > other by a null modem cable, it fails when the speed rate are different, Of course, how would that work? > and > dataloss is increasing higher the speed rate. What type of flow control are you using? > I suppose to have overruns (now I am modifying my software to check them > too), but I think it is due the way the ISR is called and all data are > passed to the uart circular buffer within the interrupt routine. Are you using flow control? > I am talking about the high latency from the IRQ up to the service routine > when flushing the FIFO and another IRQ is called by another uart in the same > time at different speed. > > The code I was looking is: drivers/tty/serial/mxs-auart.c __but__ all other > serial drivers are acting in the same way: they are reading one character at > time from the FIFO (if it exists) and put it into the circular buffer so > serial/tty driver can pass them to the user read routine. > > Each function call has some overhead and it is time-consuming, and if > another interrupt is invoked by the same UART Core but from another serial > port (different context) the continuos insertion done by hardware UART into > the FIFO cannot be served fast enough to have an overrun. I think this can > be applied __almost__ to every serial driver as they are written in the same > way. > > And it is __NOT__ an issue because of the CPU and its speed! Using two > serial converter (FTDI and Prolific PL2303 based) on each board, the problem > does not appear at all even after 24 hours running at more than 115200!!! usb-serial devices are totally different and send data to the host in a completly different way. Your hardware might just not be able to handle really high baud rates at a continous stream, what baud rate were you using? And again, this is what flow control was designed for, please use it. > It does work fine if I am using two different serial devices: one internal > uart (mxs-auart) and an external uart (ttyUSB). Again, different interrupt and protocols being used for the USB stuff. thanks, greg k-h