linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Hogan <jhogan@kernel.org>
To: Sinan Kaya <okaya@codeaurora.org>
Cc: linux-mips@linux-mips.org, sulrich@codeaurora.org, arnd@arndb.de,
	linux-arm-msm@vger.kernel.org, timur@codeaurora.org,
	linux-kernel@vger.kernel.org, Ralf Baechle <ralf@linux-mips.org>,
	Paul Burton <paul.burton@mips.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 2/2] MIPS: io: add a barrier after register read in readX()
Date: Thu, 12 Apr 2018 22:51:50 +0100	[thread overview]
Message-ID: <20180412215149.GA27802@saruman> (raw)
In-Reply-To: <1522760109-16497-2-git-send-email-okaya@codeaurora.org>


[-- Attachment #1.1: Type: text/plain, Size: 1041 bytes --]

On Tue, Apr 03, 2018 at 08:55:04AM -0400, Sinan Kaya wrote:
> While a barrier is present in writeX() function before the register write,
> a similar barrier is missing in the readX() function after the register
> read. This could allow memory accesses following readX() to observe
> stale data.
> 
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> Reported-by: Arnd Bergmann <arnd@arndb.de>

Both patches look like obvious improvements to me, so I'm happy to apply
to my fixes branch.

I'm guessing the case of a write to DMA buffer (i.e. reusing it) after a
MMIO readX() (checking DMA complete) being visible to DMA reads prior to
the readX() is precluded by a control dependency (you shouldn't reuse
buffer until you've checked DMA is complete).

But why don't we always use wmb() in the writeX() case? Might not the
cached write to DMA buffer be reordered with the uncached write to MMIO
register from the coherent DMA point of view? I'm waiting on feedback
from MIPS hardware folk on this topic.

Cheers
James

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2018-04-12 21:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-03 12:55 [PATCH v3 1/2] MIPS: io: prevent compiler reordering on the default writeX() implementation Sinan Kaya
2018-04-03 12:55 ` [PATCH v3 2/2] MIPS: io: add a barrier after register read in readX() Sinan Kaya
2018-04-06  1:34   ` Sinan Kaya
2018-04-06 18:15     ` Sinan Kaya
2018-04-06 21:26       ` James Hogan
2018-04-07 21:43         ` Sinan Kaya
2018-04-11 17:10           ` Sinan Kaya
2018-04-11 20:26             ` James Hogan
2018-04-11 20:48               ` Sinan Kaya
2018-04-11 17:04         ` Maciej W. Rozycki
2018-04-12 21:51   ` James Hogan [this message]
2018-04-12 21:58     ` James Hogan
2018-04-12 22:38       ` Sinan Kaya
2018-04-12 22:20     ` Sinan Kaya
2018-04-13 15:41     ` David Laight
2018-04-13 16:36       ` Sinan Kaya

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=20180412215149.GA27802@saruman \
    --to=jhogan@kernel.org \
    --cc=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=okaya@codeaurora.org \
    --cc=paul.burton@mips.com \
    --cc=ralf@linux-mips.org \
    --cc=sulrich@codeaurora.org \
    --cc=timur@codeaurora.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;
as well as URLs for NNTP newsgroup(s).