[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a35837f403f54d058dd31c901a007923@AcuMS.aculab.com>
Date: Thu, 29 Nov 2018 13:03:47 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Jose Abreu' <jose.abreu@...opsys.com>,
"linux-snps-arc@...ts.infradead.org"
<linux-snps-arc@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Vineet Gupta <vineet.gupta1@...opsys.com>,
Alexey Brodkin <alexey.brodkin@...opsys.com>,
Joao Pinto <joao.pinto@...opsys.com>,
"Vitor Soares" <vitor.soares@...opsys.com>
Subject: RE: [PATCH] ARC: io.h: Implement reads{x}()/writes{x}()
From: Jose Abreu [mailto:jose.abreu@...opsys.com]
> On 29-11-2018 12:47, David Laight wrote:
> > From: Jose Abreu
> >> Sent: 29 November 2018 12:42
> >>
> >> Some ARC CPU's do not support unaligned loads/stores. Currently, generic
> >> implementation of reads{b/w/l}()/writes{b/w/l}() is being used with ARC.
> >> This can lead to misfunction of some drivers as generic functions do a
> >> plain dereference of a pointer that can be unaligned.
> >>
> >> Let's use {get/put}_unaligned() helper instead of plain dereference of
> >> pointer in order to fix this.
> > Is it worth adding a check for the pointer being aligned?
>
> We could but then we would need to know which CPU version is
> currently running because some ARC processors support unaligned
> accesses.
Eh?
If the CPU supports unaligned accesses you could patch the code
to do unaligned accesses.
I was thinking of the (probably likely) case where the pointer is
actually aligned.
An extra check for ((pointer) & 3) is almost certainly a 'win'
over the byte accesses and shift/mask/or use by get/put_unaligned().
The IO accesses probably dominate making more complex optimisations
less likely to have any benefit.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists