From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Laight Subject: RE: [RFT 00/13] iomap: Constify ioreadX() iomem argument Date: Wed, 8 Jan 2020 17:39:42 +0000 Message-ID: <334434313e1642768995acc03a51214f@AcuMS.aculab.com> References: <1578415992-24054-1-git-send-email-krzk@kernel.org> <2355489c-a207-1927-54cf-85c04b62f18f@c-s.fr> <00a43e5c-0708-d49a-9cc4-eb2ce8b4cf99@c-s.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <00a43e5c-0708-d49a-9cc4-eb2ce8b4cf99@c-s.fr> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" To: 'Christophe Leroy' , Geert Uytterhoeven Cc: Rich Felker , Jiri Slaby , "Michael S. Tsirkin" , David Airlie , "nouveau@lists.freedesktop.org" , DRI Development , "virtualization@lists.linux-foundation.org" , "James E.J. Bottomley" , Paul Mackerras , Linux-Arch , Dave Jiang , Yoshinori Sato , Helge Deller , Linux-sh list , Alexey Brodkin , Krzysztof Kozlowski , Ben Skeggs , Dave Airlie , Matt Turner , arcml , Nick Kossifidis List-Id: linux-arch.vger.kernel.org From: Christophe Leroy > Sent: 08 January 2020 08:49 ... > And as pointed by Arnd, the volatile is really only necessary for the > dereference itself, should the arch use dereferencing. I've had trouble with some versions of gcc and reading of 'volatile unsigned char *'. It tended to follow the memory read with an extra mask with 0xff. (I suspect that internally the value landed into a temporary 'int' variable.) I got better code using memory barriers. So putting an asm barrier for the exact location of the memory read either side of the read should have the desired effect without adding extra instructions. (You might think 'volatile' would mean that - but it doesn't.) David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)