All of lore.kernel.org
 help / color / mirror / Atom feed
From: gdavis@mvista.com (George G. Davis)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: V6 MPCore v6_dma_inv_range RWFO fix
Date: Wed, 24 Nov 2010 10:14:18 -0500	[thread overview]
Message-ID: <20101124151418.GF31572@mvista.com> (raw)
In-Reply-To: <AANLkTikcpK0X3JT0Whx-F1GohddAUpATQS7MfrwKRMGW@mail.gmail.com>

On Wed, Nov 24, 2010 at 10:32:08AM +0000, Catalin Marinas wrote:
> On 24 November 2010 00:24, George G. Davis <gdavis@mvista.com> wrote:
> > On Tue, Nov 23, 2010 at 10:42:37PM +0000, Russell King - ARM Linux wrote:
> >> On Wed, Nov 24, 2010 at 01:28:06AM +0300, Valentine Barshak wrote:
> >> > Cache ownership must be acqired by reading/writing data from the
> >> > cache line to make cache operation have the desired effect on the
> >> > SMP MPCore CPU. However, the ownership is never aquired in the
> >> > v6_dma_inv_range function when cleaning the first line and
> >> > flushing the last one, in case the address is not aligned
> >> > to D_CACHE_LINE_SIZE boundary.
> >> > Fix this by reading/writing data if needed, before performing
> >> > cache operations.
> >>
> >> You should do this on the data _inside_ the requested buffer. ?We don't
> >> know if the overlapping cache line shares itself with some atomic
> >> variable, and doing a read-write on it could undo other updates to it.
> >
> > OK, how about this (untested interdiff):
> >
> > diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
> > index e0e5c6b..e778f2a 100644
> > --- a/arch/arm/mm/cache-v6.S
> > +++ b/arch/arm/mm/cache-v6.S
> > @@ -206,8 +206,8 @@ v6_dma_inv_range:
> > ? ? ? ?tst ? ? r0, #D_CACHE_LINE_SIZE - 1
> > ? ? ? ?bic ? ? r0, r0, #D_CACHE_LINE_SIZE - 1
> > ?#ifdef CONFIG_DMA_CACHE_RWFO
> > - ? ? ? ldr ? ? r2, [r0] ? ? ? ? ? ? ? ? ? ? ? ?@ read for ownership
> > - ? ? ? str ? ? r2, [r0] ? ? ? ? ? ? ? ? ? ? ? ?@ write for ownership
> > + ? ? ? ldr ? ? r2, [r0, #D_CACHE_LINE_SIZE - 4] ? ? ? ?@ read for ownership
> > + ? ? ? str ? ? r2, [r0, #D_CACHE_LINE_SIZE - 4] ? ? ? ?@ write for ownership
> > ?#endif
> 
> r0 here is already aligned to a cache line, so you still read from the
> same cache line, I don't see any difference.

Assuming "start" was not cache line aligned to begin with but let's say
it was initially at cache offset 24, then the above meets the contraint
that it is inside the buffer and doesn't touch any data which was
outside the DMA buffer.  I also had a paranoia that start and end may
not even be word aligned which is why these RWFOs are placed after those
BICs.

Thanks!

--
Regards,
George

> 
> -- 
> Catalin

  reply	other threads:[~2010-11-24 15:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 22:28 [PATCH] ARM: V6 MPCore v6_dma_inv_range RWFO fix Valentine Barshak
2010-11-23 22:42 ` Russell King - ARM Linux
2010-11-24  0:24   ` George G. Davis
2010-11-24 10:32     ` Catalin Marinas
2010-11-24 15:14       ` George G. Davis [this message]
2010-11-24 10:42   ` Catalin Marinas
2010-11-24 15:10     ` George G. Davis
2010-11-24 15:35       ` Catalin Marinas
2010-11-24 17:33     ` Russell King - ARM Linux
2010-11-24 17:46       ` Catalin Marinas
2010-11-24 18:01         ` Russell King - ARM Linux
2010-11-24 18:07           ` Catalin Marinas
2010-11-24 18:39             ` [PATCH] ARM: V6 MPCore v6_dma_inv_range and v6_dma_flush_range " Valentine Barshak
2010-12-08 10:25               ` Valentine Barshak
2010-12-09 16:04               ` Catalin Marinas
2010-12-09 17:04                 ` Valentine Barshak
2010-12-09 22:07                 ` Stephen Boyd
2010-12-10  5:44                   ` George G. Davis
2010-12-10  5:26               ` George G. Davis
2010-12-10  9:50                 ` Catalin Marinas
2010-12-10 12:29                   ` Valentine Barshak
2010-12-10 16:49                     ` George G. Davis
2010-11-29 15:28             ` Valentine Barshak
2010-11-24 17:40   ` [PATCH] ARM: V6 MPCore v6_dma_inv_range " Valentine Barshak

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=20101124151418.GF31572@mvista.com \
    --to=gdavis@mvista.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.