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 59A2ACF6D25 for ; Wed, 2 Oct 2024 13:37:55 +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:Content-Transfer-Encoding: Content-Type:Subject:References:In-Reply-To:Message-Id:Cc:To:From:Date: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ubFC2eTR8KIw4NFn5kW2G/QdiEQyjm89ogkOng+Ssig=; b=kODP3nTVfV0Ri6cnG0FEfJMwZv OVbt1snz7d2kZlLWXwGp6T8u/96ULDMUQ7PzrsExI/youhxGDAtBmFH4/maDeo4bSPj6PlUu91DMB mcOiCBMxm4V17ZECyFJKNWO/qGXe1eovklLizqzYdXDgqRgZxGLM8SeDgWPn1TGFwRUnyliXENOBc vwiyuWAndcl3PkfA5SefV/xo0f6txaGqG/XzcvryPpb2o3tkGqPUSf/rXW2q9h6G1ppQoRcCGJ9KL h6F1xVaSy2mZRhS8Mj+TpXavAvYxMwytKVfJqMsEECgVZ51g28TMMRWh2tnM03XWBoggCdV/HnSqz XXy4P+aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svzY0-00000006A5M-2qmD; Wed, 02 Oct 2024 13:37:44 +0000 Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svzWl-000000069ow-2r7P for linux-arm-kernel@lists.infradead.org; Wed, 02 Oct 2024 13:36:29 +0000 Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 1F4421140170; Wed, 2 Oct 2024 09:36:26 -0400 (EDT) Received: from phl-imap-11 ([10.202.2.101]) by phl-compute-10.internal (MEProxy); Wed, 02 Oct 2024 09:36:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1727876186; x=1727962586; bh=ubFC2eTR8KIw4NFn5kW2G/QdiEQyjm89ogkOng+Ssig=; b= PTlsNepWlqZMv+QnumKAcaNWTWi09hAkyRMMM8Pr/WBVgmhTxchknOhkzeddjvwr g84zjs20ehf3xT2qUNFZq6CnIQ0Y0ObVzKzVtIy+5CKH7/LujmTeeUYGV9MtPTaD bpn4GWvxaXKWTKA60MXVNX+oN9hEUbeYNG5ohsUd8X/E9WHxluaaDTRlsKPUsTQQ 8c0u2lX0ylIcvQ9Sl04PAtzypoVgszKi5HwZ3GSeI+8XoTVXLsrp3XqTcvWLl+A9 9YPPs8S1yV8/UH+vUXGORu+gq1QwxeWggtqv2vy1a3YJ/p8t88bBiRqCMAVk90R3 EdWV/tvBJIk6gaAWt/WMOA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1727876186; x= 1727962586; bh=ubFC2eTR8KIw4NFn5kW2G/QdiEQyjm89ogkOng+Ssig=; b=I m/oD3U3SDM+XLsY9I4ia93GvQ6VzZsaBE4vnmpGiZsbKrYuKk9xoC+2Ljqh4ycEb B8yZ3V/U/RbQSXgltKJLRfMA4e+lTfVf2ny+EyS8xVwEE/dVtCNITKwqsixPo4o8 wDvoLYMqpKdLnraf2g7D8Pwg6nm91t4pel6SYDzRF8gvzsi3B0ayZdm0EiQoz41d ScTeUMgjkiMVB9hdMHn/uGhegTsqiW0NxstwQdloKdxvDaTAlTSDAjYxmUcx1WTZ 0iCI7tcCEKl7KqL0LDVexmmH5IG0Gf/PIjsD4PTrw5MuBfKDMNkQa+7au0/edxoX IfpclJksNEwD1Mnae9BjQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduledgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepofggfffhvfevkfgjfhfutgfgsehtjeertdertddt necuhfhrohhmpedftehrnhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrd guvgeqnecuggftrfgrthhtvghrnhepfefhheetffduvdfgieeghfejtedvkeetkeejfeek keelffejteevvdeghffhiefhnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrhhnugesrghr nhgusgdruggvpdhnsggprhgtphhtthhopedugedpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtohepvghitghhvghsthesghhmrghilhdrtghomhdprhgtphhtthhopehfvghsthgv vhgrmhesghhmrghilhdrtghomhdprhgtphhtthhopegrnhguihdrshhhhihtiheskhgvrh hnvghlrdhorhhgpdhrtghpthhtohepshhhrgifnhhguhhosehkvghrnhgvlhdrohhrghdp rhgtphhtthhopehlihhnuhigqdgrrhhmqdhkvghrnhgvlheslhhishhtshdrihhnfhhrrg guvggrugdrohhrghdprhgtphhtthhopehimhigsehlihhsthhsrdhlihhnuhigrdguvghv pdhrtghpthhtohepfhhrrghnkhdrlhhisehngihprdgtohhmpdhrtghpthhtohepkhgvrh hnvghlsehpvghnghhuthhrohhnihigrdguvgdprhgtphhtthhopehordhrvghmphgvlhes phgvnhhguhhtrhhonhhigidruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 6696C2220071; Wed, 2 Oct 2024 09:36:25 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 Date: Wed, 02 Oct 2024 13:36:04 +0000 From: "Arnd Bergmann" To: "Stefan Eichenberger" 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" Message-Id: In-Reply-To: References: <20241002112020.23913-1-eichest@gmail.com> <20241002112020.23913-4-eichest@gmail.com> <6b070948-cf02-4f13-a220-0f6cfa21c41a@app.fastmail.com> Subject: Re: [PATCH v4 3/4] i2c: imx: use readb_relaxed and writeb_relaxed Content-Type: text/plain Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241002_063627_827652_59924FB5 X-CRM114-Status: GOOD ( 20.58 ) 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 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. Arnd