From: Guo Ren <guoren@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-arch <linux-arch@vger.kernel.org>,
linux-csky@vger.kernel.org, feng_shizhu@dahuatech.com,
zhang_jian5@dahuatech.com, zheng_xingjian@dahuatech.com,
zhu_peng@dahuatech.com, Guo Ren <ren_guo@c-sky.com>
Subject: Re: [PATCH 1/4] csky: Fixup dma_rmb/wmb synchronization problem
Date: Tue, 30 Jul 2019 23:28:28 +0800 [thread overview]
Message-ID: <CAJF2gTStGrrELOr-Dga98ueNQuSG5WBcYgzAPp_W_RjWnsGXgg@mail.gmail.com> (raw)
In-Reply-To: <CAK8P3a03tXXHQ00QEGg=7p17mmseuJqRhuumWKzS8dCYvXHkBg@mail.gmail.com>
Thx Arnd,
On Tue, Jul 30, 2019 at 9:29 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Tue, Jul 30, 2019 at 2:15 PM <guoren@kernel.org> wrote:
> >
> > From: Guo Ren <ren_guo@c-sky.com>
> >
> > If arch didn't define dma_r/wmb(), linux will use w/rmb instead. Csky
> > use bar.xxx to implement mb() and that will cause problem when sync data
> > with dma device, becasue bar.xxx couldn't guarantee bus transactions
> > finished at outside bus level. We must use sync.s instead of bar.xxx for
> > dma data synchronization and it will guarantee retirement after getting
> > the bus bresponse.
> >
> > Signed-off-by: Guo Ren <ren_guo@c-sky.com>
>
> This change looks good to me, but I think your regular barriers
> (mb, rmb, wmb) are still wrong: These are meant to be the superset
> of dma_{r,w}mb and smp_{,r,w}mb, and synchronize
> against both SMP and DMA interactions.
Wow, thanks for correction, yes! mb, rmb, wmb is the superset of dma
and smp, and I should use sync.s for mb.
I check the arm64, it use dsb for mb and dmb for smp_mb and dma_mb.
I also check the drivers, you are right , a lot of them use mb() to
sync mem data with device.
>
> I suspect you can drop the '.s' for non-SMP builds. What I don't
> see is whether you might need to add '.i' for dma_wmb() or
> dma_rmb().
It's no need for sky, when there is non-SMP, the cpu is in reset mode,
and sync.s is equal to sync in efficient.
--
Best Regards
Guo Ren
ML: https://lore.kernel.org/linux-csky/
prev parent reply other threads:[~2019-07-30 15:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 12:15 [PATCH 1/4] csky: Fixup dma_rmb/wmb synchronization problem guoren
2019-07-30 12:15 ` [PATCH 2/4] csky: Fixup dma_alloc_coherent with PAGE_SO attribute guoren
2019-07-30 12:15 ` [PATCH 3/4] csky/dma: Fixup cache_op failed when cross memory ZONEs guoren
2019-08-06 6:49 ` Christoph Hellwig
2019-08-06 7:11 ` Guo Ren
2019-08-06 7:18 ` Christoph Hellwig
2019-07-30 12:15 ` [PATCH 4/4] csky: Add dma_inv_range for DMA_FROM_DEVICE guoren
2019-07-30 13:43 ` Arnd Bergmann
2019-07-30 15:11 ` Guo Ren
2019-07-30 15:22 ` Arnd Bergmann
2019-07-30 15:48 ` Guo Ren
2019-08-06 6:51 ` Christoph Hellwig
2019-07-30 13:29 ` [PATCH 1/4] csky: Fixup dma_rmb/wmb synchronization problem Arnd Bergmann
2019-07-30 15:15 ` Guo Ren
2019-07-30 15:28 ` Guo Ren [this message]
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=CAJF2gTStGrrELOr-Dga98ueNQuSG5WBcYgzAPp_W_RjWnsGXgg@mail.gmail.com \
--to=guoren@kernel.org \
--cc=arnd@arndb.de \
--cc=feng_shizhu@dahuatech.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ren_guo@c-sky.com \
--cc=zhang_jian5@dahuatech.com \
--cc=zheng_xingjian@dahuatech.com \
--cc=zhu_peng@dahuatech.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;
as well as URLs for NNTP newsgroup(s).