From: okaya@codeaurora.org
To: Huacai Chen <chenhc@lemote.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
James Hogan <james.hogan@mips.com>,
linux-mips@linux-mips.org, Fuxin Zhang <zhangfx@lemote.com>,
Zhangjin Wu <wuzhangjin@gmail.com>,
Huacai Chen <chenhuacai@gmail.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] MIPS: io: Add barrier after register read in inX()
Date: Mon, 23 Apr 2018 00:31:24 -0400 [thread overview]
Message-ID: <c5a26d6f1e6ba35a4d45450adfa36aa3@codeaurora.org> (raw)
In-Reply-To: <1524455600-30384-1-git-send-email-chenhc@lemote.com>
On 2018-04-22 23:53, Huacai Chen wrote:
> While a barrier is present in the outX() functions before the register
> write, a similar barrier is missing in the inX() functions after the
> register read. This could allow memory accesses following inX() to
> observe stale data.
>
> This patch is very similar to commit a1cc7034e33d12dc1 ("MIPS: io: Add
> barrier after register read in readX()"). Because war_io_reorder_wmb()
> is both used by writeX() and outX(), if readX() need a barrier then so
> does inX().
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Huacai Chen <chenhc@lemote.com>
> ---
> arch/mips/include/asm/io.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
> index a7d0b83..cea8ad8 100644
> --- a/arch/mips/include/asm/io.h
> +++ b/arch/mips/include/asm/io.h
> @@ -414,6 +414,8 @@ static inline type pfx##in##bwlq##p(unsigned long
> port) \
> __val = *__addr; \
> slow; \
> \
> + /* prevent prefetching of coherent DMA data prematurely */ \
> + rmb(); \
> return pfx##ioswab##bwlq(__addr, __val); \
> }
Typically read barrier is applied after register read.
next prev parent reply other threads:[~2018-04-23 4:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-23 3:53 [PATCH] MIPS: io: Add barrier after register read in inX() Huacai Chen
2018-04-23 4:31 ` okaya [this message]
2018-04-23 4:51 ` Huacai Chen
2018-04-23 11:58 ` okaya
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=c5a26d6f1e6ba35a4d45450adfa36aa3@codeaurora.org \
--to=okaya@codeaurora.org \
--cc=chenhc@lemote.com \
--cc=chenhuacai@gmail.com \
--cc=james.hogan@mips.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=stable@vger.kernel.org \
--cc=wuzhangjin@gmail.com \
--cc=zhangfx@lemote.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).