Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1478971 > unrolled thread

lsl / lsr possible confusion in v7_flush_dcache_all

Started byVincent Siles <vincent.siles@provenrun.com>
First post2016-09-08 11:40 +0200
Last post2016-09-08 12:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  lsl / lsr possible confusion in v7_flush_dcache_all Vincent Siles <vincent.siles@provenrun.com> - 2016-09-08 11:40 +0200
    Re: lsl / lsr possible confusion in v7_flush_dcache_all Will Deacon <will.deacon@arm.com> - 2016-09-08 11:40 +0200
      Re: lsl / lsr possible confusion in v7_flush_dcache_all Vincent Siles <vincent.siles@provenrun.com> - 2016-09-08 12:00 +0200

#1478971 — lsl / lsr possible confusion in v7_flush_dcache_all

FromVincent Siles <vincent.siles@provenrun.com>
Date2016-09-08 11:40 +0200
Subjectlsl / lsr possible confusion in v7_flush_dcache_all
Message-ID<sf3Yl-417-7@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

Hi !
While reading the v7_flush_dcache_all (arch/arm/mm/cache-v7.S), I
stumbled upon this line:

# r10 is the current cache level
127: add    r2, r10, r10, lsr #1	    @ work out 3x current cache level

If we want r2 to be 3 * r10, we should compute r10 + (r10 << 1), which
is lsl, not lsr.

I check for a recent kernel, the issue seems to still be here:
repo:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
revision:   d71f058617564750261b673ea9b3352382b9cde4

Best regards,
Vincent Siles

[toc] | [next] | [standalone]


#1478972

FromWill Deacon <will.deacon@arm.com>
Date2016-09-08 11:40 +0200
Message-ID<sf3Yl-417-13@gated-at.bofh.it>
In reply to#1478971
On Thu, Sep 08, 2016 at 11:15:20AM +0200, Vincent Siles wrote:
> While reading the v7_flush_dcache_all (arch/arm/mm/cache-v7.S), I
> stumbled upon this line:
> 
> # r10 is the current cache level
> 127: add    r2, r10, r10, lsr #1	    @ work out 3x current cache level
> 
> If we want r2 to be 3 * r10, we should compute r10 + (r10 << 1), which
> is lsl, not lsr.
> 
> I check for a recent kernel, the issue seems to still be here:
> repo:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> revision:   d71f058617564750261b673ea9b3352382b9cde4

This code is take pretty much verbatim from the ARM ARM and, despite
being fairly obfuscated, does what it says on the tin. r10 is incremented
by 2 each time round the loop, so this is basically doing 2i + (2i / 2).

Will

[toc] | [prev] | [next] | [standalone]


#1479006

FromVincent Siles <vincent.siles@provenrun.com>
Date2016-09-08 12:00 +0200
Message-ID<sf4hI-47K-29@gated-at.bofh.it>
In reply to#1478972

[Multipart message — attachments visible in raw view] — view raw

Oh, right. I missed that !

Thank you for the help.
Best,
Vincent

On 08-09-16 10:38:01, Will Deacon wrote:
> On Thu, Sep 08, 2016 at 11:15:20AM +0200, Vincent Siles wrote:
> > While reading the v7_flush_dcache_all (arch/arm/mm/cache-v7.S), I
> > stumbled upon this line:
> > 
> > # r10 is the current cache level
> > 127: add    r2, r10, r10, lsr #1	    @ work out 3x current cache level
> > 
> > If we want r2 to be 3 * r10, we should compute r10 + (r10 << 1), which
> > is lsl, not lsr.
> > 
> > I check for a recent kernel, the issue seems to still be here:
> > repo:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > revision:   d71f058617564750261b673ea9b3352382b9cde4
> 
> This code is take pretty much verbatim from the ARM ARM and, despite
> being fairly obfuscated, does what it says on the tin. r10 is incremented
> by 2 each time round the loop, so this is basically doing 2i + (2i / 2).
> 
> Will

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web