From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5804DC388F7 for ; Wed, 28 Oct 2020 21:40:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F6AB24680 for ; Wed, 28 Oct 2020 21:40:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727213AbgJ1VkI convert rfc822-to-8bit (ORCPT ); Wed, 28 Oct 2020 17:40:08 -0400 Received: from mslow2.mail.gandi.net ([217.70.178.242]:44330 "EHLO mslow2.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727197AbgJ1VkC (ORCPT ); Wed, 28 Oct 2020 17:40:02 -0400 Received: from relay7-d.mail.gandi.net (unknown [217.70.183.200]) by mslow2.mail.gandi.net (Postfix) with ESMTP id 9CA283B2661; Wed, 28 Oct 2020 17:07:15 +0000 (UTC) X-Originating-IP: 83.193.246.53 Received: from windsurf.home (lfbn-bay-1-165-53.w83-193.abo.wanadoo.fr [83.193.246.53]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 1EC8C20009; Wed, 28 Oct 2020 17:06:51 +0000 (UTC) Date: Wed, 28 Oct 2020 18:06:51 +0100 From: Thomas Petazzoni To: Jan =?UTF-8?B?S3VuZHLDoXQ=?= Cc: Greg Kroah-Hartman , Jiri Slaby , , , Mark Brown , Andy Shevchenko , Subject: Re: [PATCH v2] serial: max310x: rework RX interrupt handling Message-ID: <20201028180651.50ca85d3@windsurf.home> In-Reply-To: <3841e43b-5f16-4b5c-9b43-4d3a90e57723@cesnet.cz> References: <20201001074415.349739-1-thomas.petazzoni@bootlin.com> <3841e43b-5f16-4b5c-9b43-4d3a90e57723@cesnet.cz> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Hello, On Wed, 28 Oct 2020 17:20:24 +0100 Jan Kundrát wrote: > Thanks for taking the time to write this patch. We're using MAX14830 on a > Clearfog Base board via a 26 MHz SPI bus. Our code polls a custom > peripheral over UART at 115200 baud ten times a second; the messages are > typically shorter than 50 chars. Before this patch, `perf top --sort > comm,dso` showed about 28% CPU load for the corresponding SPI kthread, > after applying this patch it's between 3 and 5%. That's cool :). > > Tested-by: Jan Kundrát > Reviewed-by: Jan Kundrát > > (but see below, please) Thanks for your review and testing, and glad to hear that it also improves the CPU load on your use-case. > > + /* Enable LSR, RX FIFO trigger, CTS change interrupts */ > > + val = MAX310X_IRQ_LSR_BIT | MAX310X_IRQ_RXFIFO_BIT | > > MAX310X_IRQ_TXEMPTY_BIT; > > max310x_port_write(port, MAX310X_IRQEN_REG, val | MAX310X_IRQ_CTS_BIT); > > This comment doesn't fully match that code, and also the effective value > that is written to the register is split into two statements. What about > just: > > + /* Enable LSR, RX FIFO trigger, TX FIFO empty, CTS change interrupts */ > + max310x_port_write(port, MAX310X_IRQEN_REG, MAX310X_IRQ_LSR_BIT | > MAX310X_IRQ_RXFIFO_BIT | MAX310X_IRQ_TXEMPTY_BIT | MAX310X_IRQ_CTS_BIT); Indeed, the comment should be updated, I'll fix that. Regarding the effective value computed in two steps, it was already the case in the current code: /* Enable RX, TX, CTS change interrupts */ val = MAX310X_IRQ_RXEMPTY_BIT | MAX310X_IRQ_TXEMPTY_BIT; max310x_port_write(port, MAX310X_IRQEN_REG, val | MAX310X_IRQ_CTS_BIT); but granted, that's not an excuse not to fix it. On my way to send a v3 :-) Thanks again, Thomas -- Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com