linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* lsl / lsr possible confusion in v7_flush_dcache_all
@ 2016-09-08  9:15 Vincent Siles
  2016-09-08  9:38 ` Will Deacon
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Siles @ 2016-09-08  9:15 UTC (permalink / raw)
  To: linux-arm-kernel

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160908/ea8d9bbd/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* lsl / lsr possible confusion in v7_flush_dcache_all
  2016-09-08  9:15 lsl / lsr possible confusion in v7_flush_dcache_all Vincent Siles
@ 2016-09-08  9:38 ` Will Deacon
  2016-09-08  9:50   ` Vincent Siles
  0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2016-09-08  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* lsl / lsr possible confusion in v7_flush_dcache_all
  2016-09-08  9:38 ` Will Deacon
@ 2016-09-08  9:50   ` Vincent Siles
  0 siblings, 0 replies; 3+ messages in thread
From: Vincent Siles @ 2016-09-08  9:50 UTC (permalink / raw)
  To: linux-arm-kernel

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160908/0b5292a4/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-08  9:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-08  9:15 lsl / lsr possible confusion in v7_flush_dcache_all Vincent Siles
2016-09-08  9:38 ` Will Deacon
2016-09-08  9:50   ` Vincent Siles

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).