Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3479216pxb; Mon, 4 Apr 2022 18:17:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyl7GZjd81HARX52iW+jita/BY2vlkNeb96oXrKoZzRuMsOZr+SU1urTWFRvKmpwbFiQdad X-Received: by 2002:a17:90a:4897:b0:1c7:5fce:cbcd with SMTP id b23-20020a17090a489700b001c75fcecbcdmr1218948pjh.45.1649121437382; Mon, 04 Apr 2022 18:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649121437; cv=none; d=google.com; s=arc-20160816; b=dH3Huao47ZNDrRjmqfQMcPZf+/9rpW/FC8Xc1b6HIw8JpdXdDTt2im/QZ3VDdwphcT HZuoqcbcFpPzcLuXAK6za+GfA2OyHiPm9uNImr2SycsYqL/x4OxkWkssuvUrSQCA0sss VSyZfjk0JlHl/+2YQsDYGzEcJryZu6+nh/+ffLaclQDKbH0Qmre3Sx8it6iymedPH2q0 dNhcDsICQ5P+tB0zNgHj5fE86fZfsX2CWBiYUDrHDCrCOEuI3gAflTuoSMmdzPtuPchE jiqR324lJ4AKwGbd74WMv/mw1JstZBmvT20CL0uNpU3wB/7Q0Y7Afs9ByyQhK8GG/D8e iIhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=fA3QEC/J4uwNO/VuL8noIhoYNRgoUgQqydq3qWm/bX8=; b=eSvGOlIO/cm/rXIDuI9RFn7MSK+spWaupeXKei428RFqfj5CYgT5xLabrOqQWg95JL 7x+6AQl8Fuu4cNJgoonQskw3Z0Zw5+25EAU7pH8d5VqjNGfYcLStlzximhkG0xR+8kr3 7Ijr1n3WOG++2WmYFnUKyj2itD290TqKRjh6I4YZ8bW/JrLlcTYX7Wz9dyl+9F3UZbA+ ae5Z3bLDsAoh3+sAAEFdHcHyQlnBFCD+S+oAWqcUkTuG3y8BQhEd2OLTEyeb97wBf94S CNAdU/vYELET47kdY/+e+akfpxUy2pGLJKyAYoIf3ls0xdlIwKJuGT8Lwk7xIyLh0qJR 0x9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E0VQViYn; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ob5-20020a17090b390500b001bd14e03036si777730pjb.14.2022.04.04.18.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:17:17 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E0VQViYn; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0CF5971A26; Mon, 4 Apr 2022 17:20:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351779AbiDDN3m (ORCPT + 99 others); Mon, 4 Apr 2022 09:29:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240002AbiDDN3l (ORCPT ); Mon, 4 Apr 2022 09:29:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AA9893BFB8 for ; Mon, 4 Apr 2022 06:27:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649078864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fA3QEC/J4uwNO/VuL8noIhoYNRgoUgQqydq3qWm/bX8=; b=E0VQViYndtwHxccpEgrWlPOZHBvEdql2eKXkDsHmbFuvNSzxWSmXn9qeGH2JhRZZ+PlOyF E7r7H4P9G61Hh98sbMNFNIfYsP6NYa+oIEq/MBaDX96Yb49Flzvbm++a4WEp2MblWa8jnO MCwvrmEzO+Dey0hyAUi8mIB3UxzovVA= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-207-5K7IwP_qM3CYiTqf6-olmw-1; Mon, 04 Apr 2022 09:27:43 -0400 X-MC-Unique: 5K7IwP_qM3CYiTqf6-olmw-1 Received: by mail-lf1-f69.google.com with SMTP id i33-20020a0565123e2100b0044aa6befbe6so3742073lfv.18 for ; Mon, 04 Apr 2022 06:27:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fA3QEC/J4uwNO/VuL8noIhoYNRgoUgQqydq3qWm/bX8=; b=26ZZKx7lvAQcKvSYL2nKH8/TwzYp89nLnj0sq+SMP8PgzByZkZcaeMo/2g51P8WsAY /FP4AfnP/k197PUekcBXTVZncTJosMHauZBBbWQCtj86bobaa/bZ/J1zdNbSeg+VaWKh KgD7/WCRc+q7WY2hrufS5xgKLdNjASAtmDi+KJExuXBoh8o0B9GCeRVxKjWj0uU2OUtk eTL5pG6M0KqIwnyqXyE9TOcKNMgyCMgJR2vDQbpbQxff05GmXYR5TERdtapf7Est4uOc qp6r58OQK1wEsJ09vMY02VEf3l0c3Ut1ZnPKYrltdrhJKitNfm81PwBM44BoiqGiUZHJ nxFg== X-Gm-Message-State: AOAM533SBB0gEPePSyNg2bWtfVwt5NrOHLqeJY2qmI4yFtDvTz5ZnPZw N4/P/XiUZX5sEW51KVxHfVBUOa/vsvXcxUffHRGC+6C/4viD1rViVP9yMfwJ10DsqMYVAEC/tG6 Vz3qUAMtQOOggYwUGskB66gbqZNwnbr6vs9H+PQry X-Received: by 2002:a05:6512:1585:b0:445:908b:ad71 with SMTP id bp5-20020a056512158500b00445908bad71mr22009169lfb.200.1649078862065; Mon, 04 Apr 2022 06:27:42 -0700 (PDT) X-Received: by 2002:a05:6512:1585:b0:445:908b:ad71 with SMTP id bp5-20020a056512158500b00445908bad71mr22009136lfb.200.1649078861804; Mon, 04 Apr 2022 06:27:41 -0700 (PDT) MIME-Version: 1.0 References: <20220401194645.1738747-1-wander@redhat.com> <20220401194645.1738747-2-wander@redhat.com> In-Reply-To: From: Wander Costa Date: Mon, 4 Apr 2022 10:27:30 -0300 Message-ID: Subject: Re: [PATCH v6] serial/8250: Use fifo in 8250 console driver To: Andy Shevchenko Cc: Wander Lairson Costa , Greg Kroah-Hartman , Jiri Slaby , Johan Hovold , "Maciej W. Rozycki" , Lukas Wunner , =?UTF-8?Q?Pali_Roh=C3=A1r?= , "open list:SERIAL DRIVERS" , open list , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Steven Rostedt , Sergey Senozhatsky , =?UTF-8?Q?Andr=C3=A9_Goddard_Rosa?= , Sudip Mukherjee , David Laight , Jon Hunter , phil@raspberrypi.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 4, 2022 at 6:32 AM Andy Shevchenko wrote: > > On Fri, Apr 01, 2022 at 04:46:42PM -0300, Wander Lairson Costa wrote: > > Note: I am using a small test app + driver located at [0] for the > > problem description. serco is a driver whose write function dispatches > > to the serial controller. sertest is a user-mode app that writes n bytes > > to the serial console using the serco driver. > > > > While investigating a bug in the RHEL kernel, I noticed that the serial > > console throughput is way below the configured speed of 115200 bps in > > a HP Proliant DL380 Gen9. I was expecting something above 10KB/s, but > > I got 2.5KB/s. > > > > $ time ./sertest -n 2500 /tmp/serco > > > > real 0m0.997s > > user 0m0.000s > > sys 0m0.997s > > > > With the help of the function tracer, I then noticed the serial > > controller was taking around 410us seconds to dispatch one single byte: > > > > $ trace-cmd record -p function_graph -g serial8250_console_write \ > > ./sertest -n 1 /tmp/serco > > > > $ trace-cmd report > > > > | serial8250_console_write() { > > 0.384 us | _raw_spin_lock_irqsave(); > > 1.836 us | io_serial_in(); > > 1.667 us | io_serial_out(); > > | uart_console_write() { > > | serial8250_console_putchar() { > > | wait_for_xmitr() { > > 1.870 us | io_serial_in(); > > 2.238 us | } > > 1.737 us | io_serial_out(); > > 4.318 us | } > > 4.675 us | } > > | wait_for_xmitr() { > > 1.635 us | io_serial_in(); > > | __const_udelay() { > > 1.125 us | delay_tsc(); > > 1.429 us | } > > ... > > ... > > ... > > 1.683 us | io_serial_in(); > > | __const_udelay() { > > 1.248 us | delay_tsc(); > > 1.486 us | } > > 1.671 us | io_serial_in(); > > 411.342 us | } > > > > In another machine, I measured a throughput of 11.5KB/s, with the serial > > controller taking between 80-90us to send each byte. That matches the > > expected throughput for a configuration of 115200 bps. > > > > This patch changes the serial8250_console_write to use the 16550 fifo > > if available. In my benchmarks I got around 25% improvement in the slow > > machine, and no performance penalty in the fast machine. > > ... > > > + use_fifo = (up->capabilities & UART_CAP_FIFO) && > > + /* > > + * BCM283x requires to check the fifo > > + * after each byte. > > + */ > > + !(up->capabilities & UART_CAP_MINI) && > > Perhaps you need to also comment why we are using tx_loadsz and not fifosize. > Maybe it is better to document their difference in the struct declaration and not in a random usage. [snip]