From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Muckle Subject: IO access and *_relaxed macros Date: Thu, 24 Mar 2011 11:22:11 -0700 Message-ID: <4D8B8BD3.5070403@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from wolverine01.qualcomm.com ([199.106.114.254]:14866 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756953Ab1CXSWS (ORCPT ); Thu, 24 Mar 2011 14:22:18 -0400 Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: LAKML , Catalin Marinas , Russell King - ARM Linux Cc: Linux ARM MSM Hi, On ARMv7 the readl and writel macros (and readb, etc) include memory barriers (dmb or dsb, unless defined otherwise by the machine) due to CONFIG_ARM_DMA_MEM_BUFFERABLE being defined by default. Likewise the ioread* and iowrite* macros also include memory barriers. The barriers in the io accessor macros are only on one side, and the reads and writes have them on different sides, so it's easy to slip up if you're relying on these macros to perform memory barriers in certain locations. They also have a noticeable effect on performance. To obtain best performance in drivers it would seem appropriate to use the *_relaxed io accessor macros which lack memory barriers and manage the memory barriers directly, inserting them only when strictly required. Usage of the *_relaxed macros doesn't seem to be especially prevalent however so I thought I'd see if others had thoughts or concerns on this. thanks, Steve -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.