Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 701D3C433EF for ; Thu, 28 Oct 2021 17:00:20 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9CDB16103C for ; Thu, 28 Oct 2021 17:00:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9CDB16103C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CC890834A3; Thu, 28 Oct 2021 19:00:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="riJl3CsY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 67D5283542; Thu, 28 Oct 2021 19:00:15 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D586B834A3 for ; Thu, 28 Oct 2021 19:00:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 0DA276103C; Thu, 28 Oct 2021 17:00:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635440408; bh=AslczzuKdqM/S4q7LY3b4+cJ6aMRdpeHTT5CRd5uemQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=riJl3CsYDO9yeQ9XV/mAj0YyR/wreSR2VNxPvRutEECTxvJyoIHaIgWCHL3Lj4nyU LXu2yHPkB+HGi6vhsMbnExCRB4n2UQ4BJqvwdnsRkDU8PGnJZLzEVcYNRHFjFyeDJy hd/YDEPhOq2s3Al+pOhh9FUouvjNe/AQj4aSXWDQdghSfZ4mEcpWl/TGd5d/csw74f VCT3OvvI+avJY4Y9LenzTg8dchKG5iD35SOZofLZxPcVrAEl/tOZivRTAJA9nzgn2W 1CKobGNsl6GUkexDFSQn7RAvFu1YhJtuD+rSgE2naZ09plKn0KQQ+GVkrPXD0YUIYX FXkuACfTaf/rA== Received: by pali.im (Postfix) id 959EB689; Thu, 28 Oct 2021 19:00:05 +0200 (CEST) Date: Thu, 28 Oct 2021 19:00:05 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Stefan Roese Cc: Marek =?utf-8?B?QmVow7pu?= , u-boot@lists.denx.de, Marek =?utf-8?B?QmVow7pu?= Subject: Re: [PATCH u-boot-marvell 00/13] Yet another kwboot improvements Message-ID: <20211028170005.7cbi5aihp5fjeee5@pali> References: <20211026184824.3g2bup2cwpnxk6a3@pali> <2eae7502-2fb9-cefd-57e8-f14786a626bc@denx.de> <20211027135247.kusaph47hrvieoiq@pali> <20211027141021.kgtby7g3dukmf225@pali> <997dc715-840b-1b25-4b90-5657a099dbb2@denx.de> <20211027210354.pflps6nsxajs2qk7@pali> <5559e553-3135-9bdc-cfcf-7218ed38c3df@denx.de> <20211028110432.iijd4dkdl7x6bs4a@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Thursday 28 October 2021 16:20:11 Stefan Roese wrote: > On 28.10.21 13:04, Pali Rohár wrote: > > On Thursday 28 October 2021 08:16:24 Stefan Roese wrote: > > > On 27.10.21 23:03, Pali Rohár wrote: > > > > On Wednesday 27 October 2021 17:27:41 Stefan Roese wrote: > > > > > Still I see no speed change. But this is a different story... > > > > > > > > Could you try to upload some file in u-boot via xmodem at different > > > > speeds? E.g. via loadx command: > > > > > > > > loadx 921600 > > > > > > > > and > > > > > > > > loadx 115200 > > > > > > loadx & loady are producing nearly the same numbers on my Armada XP > > > target for download (slow of cause). This is really strange. > > > > Ok. So it means that the issue should not be in kwboot, if also U-Boot > > xmodem implementation is affected. > > Agreed. > > > > I also tested with "normal" console actions (logging) with higher > > > baudrates. Here these numbers: > > > > > > time md 2000000 10000: > > > > > > 115200 baud: > > > time: 1 minutes, 32.694 seconds > > > > > > 921600 baud: > > > time: 11.587 seconds > > > > > > 92.7s vs 11.6s -> factor ~8. Which is exactly the baudrate difference. > > > So at least here I see a speed difference, which means that the USB > > > UART converter must be working in general. I really have no idea right > > > now to explain, why this does not any speed differences while > > > downloading. > > > > So this means that USB-UART converter must work also on higher speeds. > > > > My idea is that there is some significant overhead on USB-UART when > > accessing either RX or TX queue. xmodem protocol is: send 132 bytes, > > wait for 1 byte reply, send another 132 bytes, wait again for 1 byte > > reply, ... So if USB-UART has internal overhead which cause that every > > byte is postponed by some delay then it would mean that xmodem is most > > time just waiting, meaning overhead is applied for every one 132-byte > > long packet. Test with md cause continuous stream of data, therefore > > such overhead is applied only at beginning of the md transfer. > > > > Similar issues with can observed also on high speed networks were is > > very big latency when using protocols where each small packet has to be > > acknowledged. TCP is using windowing to prevent such kind of issues. > > > > And kermit protocol too via its streaming mode. So kermit transfer could > > prove if this is really that issue. > > > > Anyway, I have looked at your strace output again and I saw that there > > is a long gap after tcdrain() and end of the read(). So if kernel > > implements tcdrain() for your USB-UART hw it means that it take too much > > time to receive reply byte from USB-UART hw to the kernel. So it could > > be another indication of that overhead. > > Thanks for the input here. > > > > > And compare if xmodem transfer is in U-Boot faster or not. Ideally also > > > > try via kermit protocol at different speeds as kernel supports > > > > streaming. > > > > > > I'm currently struggling to get gkermit working on my Ubuntu machine - > > > so no numbers here yet, sorry. > > > > In U-Boot console call: > > > > loadb _addr_ > > > > And then quit terminal emulator used for U-Boot /dev/ttyUSBX device. > > Then run gkermit with following arguments: > > > > gkermit -i -X -s _file_to_send_ < /dev/ttyUSBX > /dev/ttyUSBX > > > > (redirecting both stdin and stdout is required) > > > > After successful transfer gkermit exit. BEWARE that gkermit does not > > print any progress information and neither any error. So do not kill > > gkermit via CTRL+C prematurely. You can use "time gkermit ..." for > > measuring total transfer time. > > > > If you are going to use different speed than 115200 in u-boot run: > > > > loadb _addr_ _speed_ > > > > And then on host start gkermit with more commands around: > > > > stty -F /dev/ttyUSBX _speed_ > > printf '\015' > /dev/ttyUSBX > > gkermit -i -X -s _file_to_send < /dev/ttyUSBX > /dev/ttyUSBX > > sleep 0.5 > > stty -F /dev/ttyUSBX 115200 > > printf '\033' > /dev/ttyUSBX > > > > Due to absence of progress bar and error information I'm using ckermit > > application for kermit file transfers. But for testing purposes is > > gkermit application here also fine. > > Ah, perfect. Here my number now using these steps and gkermit, with > a file size of 549373 bytes: > > 115200 baud: ~72 sec > 921600 baud: ~11 sec So I think it is clear now. Either USB-UART HW or kernel driver for it has some big overhead for any protocol which needs acknowledgement of received data. So xmodem protocol is not suitable for it. It would require to debug kernel driver and ideally monitor traffic on oscilloscope to see where exactly is the issue. And because bootrom supports only xmodem protocol we cannot do more in kwboot. For other cases it is a good idea to use kermit protocol instead of xmodem. > But: > I see this on my PC on the first use of a baudrate change: > $ stty -F /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A1019EGY-if00-port0 > 921600 > stty: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A1019EGY-if00-port0: unable > to perform all requested operations > > The 2nd call succeeds. Not sure what this means. Perhaps this has > something to do with the speed problem, I'm seeing here on my AXP > target with the FTDI USB-UART controller. Maybe this could indicate bugs in kernel driver. > Thanks, > Stefan