mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jose Abreu <jose.abreu@synopsys.com>
To: David Laight <David.Laight@ACULAB.COM>,
	'Jose Abreu' <jose.abreu@synopsys.com>,
	"linux-snps-arc@lists.infradead.org" 
	<linux-snps-arc@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Vineet Gupta <vineet.gupta1@synopsys.com>,
	Alexey Brodkin <alexey.brodkin@synopsys.com>,
	Joao Pinto <joao.pinto@synopsys.com>,
	"Vitor Soares" <vitor.soares@synopsys.com>
Subject: Re: [PATCH] ARC: io.h: Implement reads{x}()/writes{x}()
Date: Thu, 29 Nov 2018 13:11:13 +0000	[thread overview]
Message-ID: <e2c8c8e0-ae78-053f-0a80-311cd55927e1@synopsys.com> (raw)
In-Reply-To: <a35837f403f54d058dd31c901a007923@AcuMS.aculab.com>

On 29-11-2018 13:03, David Laight wrote:
> From: Jose Abreu [mailto:jose.abreu@synopsys.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.

*Some* ARC CPU versions support unaligned memory access. The one
we tested this on does not support 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)


  reply	other threads:[~2018-11-29 13:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29 12:42 Jose Abreu
2018-11-29 12:47 ` David Laight
2018-11-29 12:53   ` Jose Abreu
2018-11-29 13:03     ` David Laight
2018-11-29 13:11       ` Jose Abreu [this message]
2018-11-29 13:19         ` Jose Abreu
2018-11-29 12:55 ` Alexey Brodkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2c8c8e0-ae78-053f-0a80-311cd55927e1@synopsys.com \
    --to=jose.abreu@synopsys.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=alexey.brodkin@synopsys.com \
    --cc=joao.pinto@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=vineet.gupta1@synopsys.com \
    --cc=vitor.soares@synopsys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®