Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp693889pxx; Wed, 28 Oct 2020 14:43:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhvGj7sR2AvAsWq7qYyI+qrdv+76U1gFGHNNrfKZtvuBpKxkYg50vSmWzoFivUr2ViEgR1 X-Received: by 2002:a17:906:f11a:: with SMTP id gv26mr1068792ejb.376.1603921389799; Wed, 28 Oct 2020 14:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603921389; cv=none; d=google.com; s=arc-20160816; b=qgk4ImJy1v9ehdYe5N7U6gbtzJ5zDcapHNYprApS9tUPCmU3T5weh6BAr50OihLmBC OPv0AlL7lYdrKtU52i4RkhceoA+bphD6jm/RGyOr9d7trUAgKJzzt3TPZU6y6Mu9VBkD MaqM9BB1gfEFY9dI8zmQg3LhbX0J2K6/n1z4jqQ0MeCpnF1G09xEJuRuftwtDAHQIhyx RXAAWFRy8P0cHamFjU1TNhA778Hdhc2MNUTe5Vp5s3RtWRB9Sp8epk0vorJe/rOggvdu z7ueSpqgG0TtECriP6A8IZuDthQDVHSeTaVXCoSUMXZrhjXWwI1N81EIFpYlhBHI4YI8 tRbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=EQwkdKrucJ3fx6rOfCUWG/piXam0qXjZ7w9AQ6cUZOQ=; b=z15a3ct6TQ1Hhf0RxKXlu5T1X06QLE7xZG2T0fXOutNypw9eBBMW2jj699wftjmb1L 7ridHcIwQ2vccbvtrF2qKE+8fm6HBeGKtYBBpe0jPQpe5sz2+0aFjK68fgSgxlmIT5Ei LZXRyIG5jiZXWUGJiYNHGcsLlzKjJTcD3YDcpSS2fb+wdF/vDxMMqVZSDbWhWm9+xOLz MksasJ4fZgZzQhlSXBSjncZCM/98pZNbCOvi2EkT8gyVbBagf0NQ4b3vne0r3kQH2upI tcKLdZfGSsvim46KW8M6fexdmR01nsU+bR5qFRalc+sJ5yKICni/hPshI3MIUDuTgjM2 tQeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si577623edu.574.2020.10.28.14.42.47; Wed, 28 Oct 2020 14:43:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725915AbgJ1VkK convert rfc822-to-8bit (ORCPT + 99 others); Wed, 28 Oct 2020 17:40:10 -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-kernel@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