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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9C52ACF6D2C for ; Wed, 2 Oct 2024 14:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SYBnqtvGiQjaRMTgNULW741gmtqnFsMn0VCfba+rg+A=; b=ZOFizQjdmjjRrJCx2JCIt3OxNt xkcS+8F6rKA1Bqrphy7lzFmOl+2G/hty/d7lis6y9LD/+br1vb37aQE5RLlBJMY1kHWwXSELlTpYL jRv69/4LnH1tJWIAP2kiZmvxSbC/IKrWwWjjnsKORXOMWOsnAwn/r+dFIg1mwN9AqKzJNWu5SsY8P guuWk3LR1dIszC5wObR39Y5zpRV3F1MHNS/EtILezXbOqozQ/gr+54rh6uRcM8U4xvN54r7W8KF5+ ZjX052NoVgXnCVi8k2t1DzTc6vjfLw2tB+2s6IBUNggg8b7gtdSC/nYH0bcQdUDDQDrU50qPK+0z1 DlO0h59A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sw0WP-00000006QyY-15zP; Wed, 02 Oct 2024 14:40:09 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sw0SX-00000006Q1E-2kNK for linux-arm-kernel@lists.infradead.org; Wed, 02 Oct 2024 14:36:11 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5398e3f43f3so5035265e87.2 for ; Wed, 02 Oct 2024 07:36:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727879768; x=1728484568; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SYBnqtvGiQjaRMTgNULW741gmtqnFsMn0VCfba+rg+A=; b=fs7lOAEOZrp7y46UevUcspejsYoBKPtTT4vX24i/pP4+lBYmaly7xv9HHJ8NSfaMLg U71M9N0W4cPre8p3lfvP3krOBOKxM4/K0sD/ECOHangO9386212c0V13KCMa9gEKc9pu 7WbsghhtW6Ind+iwVZejnorsu0O0iulZoW2BWRRJlx8JwzqBQVOFL9xu2Rs3AIgZ1iD3 RimZ+by4ShyNuzJrZYhS+3vohX6KKgU+/jsOwkEUD3ScuPK+lOpPZ7NZ6JtHgWDSNjyO s5+DZv/yfDuc4Ft+ORFj0IIEFUZby2i7vE/1v4DRItY4Zs8J0SoBIdCjX0kxIkPMnE5G 3auA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727879768; x=1728484568; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SYBnqtvGiQjaRMTgNULW741gmtqnFsMn0VCfba+rg+A=; b=p/bAWsTeyCZg8An+8P1yZYaofUM4qJnGYNzgm4FCAqZA6zNv9AW6tqy6FPApr2db1h SuxziWXVsJSOC1oisYeWTqIAy3fiv9q/XjQMzztdtB8Suld8Yv0brgxbqpRusNbR2kMf prDHgtHSnO6bXvbw1RpwQD1J2IXfRRqiPpBFYrLHq+RaYzuW1Yz1I5voH2byuBR7IdUV 3VXBbyMleS2jl3OhCjd0VROgKNf35MIF2vbmrDoploXDNiEh5wm+3g1gKsDa0s1tRe8o yirsCvzpGWBvQd237bB1a/DOEePBVoKjkWz2mCDZQmRdPCuzoOne9SGnydSCoH7UHIxs ZJRA== X-Forwarded-Encrypted: i=1; AJvYcCUXonIOlDYcNtXZ9YVAaXbfi7Fe6SyVDW7NfnbMVb7s6JrFEkxvJ/KGYZewxvmdbp5PWxIMXX6vQC+eePe429dI@lists.infradead.org X-Gm-Message-State: AOJu0Yyhyo5oCFPVqHg4+aJ+ih1iWe2CXdFK4hOXzE7ULjCgZFQBsCrn UEBo18V8DqxmvAzUgoUgWVSVmac0qxYVFhkjv5Mv4mn61Zj2jtvP X-Google-Smtp-Source: AGHT+IELBe44nDd0xVmrlmK9UvO9iyEJQmLMZHrBr23Zi+FleF6chln+t/rRwOksZLaeO0i19LgsDQ== X-Received: by 2002:a05:6512:31c8:b0:52c:a5cb:69e4 with SMTP id 2adb3069b0e04-539a07a3603mr2013252e87.54.1727879767296; Wed, 02 Oct 2024 07:36:07 -0700 (PDT) Received: from eichest-laptop (31-10-206-125.static.upc.ch. [31.10.206.125]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f79ff460dsm20084135e9.32.2024.10.02.07.36.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 07:36:06 -0700 (PDT) Date: Wed, 2 Oct 2024 16:36:05 +0200 From: Stefan Eichenberger To: Arnd Bergmann Cc: o.rempel@pengutronix.de, Pengutronix Kernel Team , Andi Shyti , Shawn Guo , Sascha Hauer , Fabio Estevam , Frank Li , linux-i2c@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Francesco Dolcini , Stefan Eichenberger Subject: Re: [PATCH v4 3/4] i2c: imx: use readb_relaxed and writeb_relaxed Message-ID: References: <20241002112020.23913-1-eichest@gmail.com> <20241002112020.23913-4-eichest@gmail.com> <6b070948-cf02-4f13-a220-0f6cfa21c41a@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241002_073609_716310_868918DD X-CRM114-Status: GOOD ( 31.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 02, 2024 at 01:36:04PM +0000, Arnd Bergmann wrote: > On Wed, Oct 2, 2024, at 13:08, Stefan Eichenberger wrote: > > On Wed, Oct 02, 2024 at 11:51:22AM +0000, Arnd Bergmann wrote: > >> On Wed, Oct 2, 2024, at 11:19, Stefan Eichenberger wrote: > >> > From: Stefan Eichenberger > >> > > >> > Use the relaxed version of readb and writeb to reduce overhead. It is > >> > safe to use the relaxed version because we either do not rely on dma > >> > completion, or we use a dma callback to ensure that the dma transfer is > >> > complete before we continue. > >> > >> I would still consider this a bug in general, you should > >> never default to the unsafe variants. > >> > >> If there is a codepath that needs the barrierless version, > >> please add imx_i2c_write_reg_relaxed()/imx_i2c_read_reg_relaxed() > >> helpers that use those only in the places where it makes > >> a measurable difference, with a comment that explains > >> the usage. > > > > I added the patch because of the following dicussion: > > https://lore.kernel.org/linux-i2c/ZpVWXlR6j2i0ZtVQ@lizhi-Precision-Tower-5810/ > > > > I can't determine if the relaxed version improves performance. The > > 'normal' version worked well for our use case too. Therefore, dropping > > the change would be acceptable for us. Another potential solution could > > be to use the relaxed version only inside the ISR. Would that be an > > acceptable solution? What is your impression, Frank Li > > ? > > I'm pretty sure that Frank meant to use readb_relaxed()/writeb_relaxed() > inside of the FIFO access loop, not for everything else. This > makes a lot of sense, since the FIFO read in particular is > clearly performance sensitive and already serialized by the > implied control dependency. > > If you can read multiple bytes, the best interface to use > would in fact be readsb() or possibly readsl() to read > four bytes with each access. > > It appears that you did not implement the suggestion to > read the entire FIFO though, so you can probably just skip > the _relaxed() change entirely. This makes sense, it appears this was a misunderstanding. If no one objects, I will drop the patch in the next version. Thank you for the clarification. Regards, Stefan