From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: Issue with file transfers to a mass storage device on SMP system
Date: Tue, 27 Jul 2010 17:07:10 +0100 [thread overview]
Message-ID: <20100727160710.GF11468@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <EAF47CD23C76F840A9E7FCE10091EFAB02C62EF91F@dbde02.ent.ti.com>
On Tue, Jul 27, 2010 at 07:59:17PM +0530, Shilimkar, Santosh wrote:
> Once it's pushed out of L2X WB, it will hit the memory. Just to give an additional data point, with CATC analyzer what we see that only those
> 16 bytes CDB are 0x0. This buffer was memset to 0x0 just before the
> memcpy.
>
> I am just wondering who will issue a barrier(wmb) on this buffer before DMA
> start if we don't use dma-mapping APIs? May be for dma_alloc_coherent
> buffers, we need to explicitly issue the barrier.
wmb's don't take addresses - they're a global thing. All stores before
the wmb() take effect before stores after the wmb().
The wmb() is issued by Catalin's IO ordering patches:
+#define writeb(v,c) ({ wmb(); writeb_relaxed(v,c); })
+#define writew(v,c) ({ wmb(); writew_relaxed(v,c); })
+#define writel(v,c) ({ wmb(); writel_relaxed(v,c); })
So, the wmb() is issued to ensure that all stores to (eg) buffers
allocated by dma_alloc_coherent() hit memory prior to the store to
the device.
Now, if you're writing to registers using something other than write[bwl](),
you'll miss the wmb(), and therefore your DMA buffer won't be up to date.
And this _is_ the problem:
drivers/usb/musb/musb_io.h:static inline void musb_writew(void __iomem *addr, unsigned offset, u16 data)
drivers/usb/musb/musb_io.h: { __raw_writew(data, addr + offset); }
drivers/usb/musb/musb_io.h:static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data)
drivers/usb/musb/musb_io.h: { __raw_writel(data, addr + offset); }
drivers/usb/musb/musb_io.h:static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data)
drivers/usb/musb/musb_io.h: __raw_writew(tmp, addr + (offset & ~1));
drivers/usb/musb/musb_io.h:static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data)
drivers/usb/musb/musb_io.h: { __raw_writeb(data, addr + offset); }
All IO performed by musb misses out on the barriers - so what you
need to do is either add wmb()s to these, or you need to ensure
that the driver has the various necessary memory barriers in place.
The latter solution will be more efficient.
next prev parent reply other threads:[~2010-07-27 16:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-27 6:34 Issue with file transfers to a mass storage device on SMP system Maulik
2010-07-27 7:05 ` Ming Lei
2010-07-27 9:38 ` Shilimkar, Santosh
2010-07-27 10:01 ` Russell King - ARM Linux
2010-07-27 10:19 ` Shilimkar, Santosh
2010-07-27 10:41 ` Russell King - ARM Linux
2010-07-27 12:00 ` Shilimkar, Santosh
2010-07-27 13:45 ` Shilimkar, Santosh
2010-07-27 13:59 ` Russell King - ARM Linux
2010-07-27 14:14 ` Shilimkar, Santosh
2010-07-27 14:21 ` Russell King - ARM Linux
2010-07-27 14:29 ` Shilimkar, Santosh
2010-07-27 16:07 ` Russell King - ARM Linux [this message]
2010-07-28 5:15 ` Shilimkar, Santosh
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=20100727160710.GF11468@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox