All of lore.kernel.org
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V4] ARM: handle user space mapped pages in flush_kernel_dcache_page
Date: Mon, 3 Jun 2013 10:33:10 +0100	[thread overview]
Message-ID: <20130603093309.GA32295@arm.com> (raw)
In-Reply-To: <CACVXFVMU+pHrtezStKRNzhhJWg7L1NTBQKwhwLe+-9Yh5JhgiA@mail.gmail.com>

On Sat, Jun 01, 2013 at 11:27:38AM +0100, Ming Lei wrote:
> On Sat, Jun 1, 2013 at 2:54 AM, Simon Baatz <gmbnomis@gmail.com> wrote:
> > On Fri, May 31, 2013 at 05:07:22PM +0800, Ming Lei wrote:
> >> On Sun, May 12, 2013 at 1:35 PM, Simon Baatz <gmbnomis@gmail.com> wrote:
> >> > +                       __flush_kernel_dcache_page(page);
> >>
> >> I am wondering if I-cache should be flushed here since the user mapping
> >> on the page may be executable and I/D coherency should be maintained.
> >
> > Me too. In fact, I wondered so much that I proposed it myself in a
> > previous version of the patch (see [1]) :-) However, this has never
> > been part of flush_kernel_dcache_page() and it is not clear whether
> > the flush for I/D-cache coherency is really needed here (or in
> > flush_dcache_page() for that matter) or whether it is sufficient to
> > do it when mapping the page into user space.
> 
> After reading cachetlb.txt again, looks your patch is correct, because
> this kernel API is called in the situations:
> 
>         It is assumed here that the user has no incoherent cached copies
>        (i.e. the original page was obtained from a mechanism like
> get_user_pages()).
> 
> So only flushing kernel mapping for the page is correct if callers of the API
> obey the rule.

I think we should stick with just the D-cache flushing here. We can
revisit when we see a clear scenario where I-cache maintenance is
needed.

Regarding the 'user has no incoherent cached copies', this would work on
ARMv5 but not on ARMv7 unless you unmap the page from user space
(because of speculative loads into both I and D caches). Since we only
target the D-cache, we just leave flush_kernel_dcache_page() as no-op on
ARMv7 (non-aliasing VIPT).

-- 
Catalin

      reply	other threads:[~2013-06-03  9:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-12  5:35 [PATCH V4] ARM: handle user space mapped pages in flush_kernel_dcache_page Simon Baatz
2013-05-23 10:43 ` Catalin Marinas
2013-05-25  3:53   ` Nicolas Pitre
2013-05-28  9:55     ` Catalin Marinas
2013-05-28 17:52       ` Nicolas Pitre
2013-05-29 10:37         ` Catalin Marinas
2013-05-29 14:39           ` Nicolas Pitre
2013-05-29 16:32             ` Nicolas Pitre
2013-05-29 17:33               ` Catalin Marinas
2013-05-27 21:42   ` Simon Baatz
2013-05-28 10:20     ` Catalin Marinas
2013-05-28 18:50       ` Nicolas Pitre
2013-05-29 11:05 ` Catalin Marinas
2013-05-29 19:16   ` Simon Baatz
2013-05-30 16:43     ` Catalin Marinas
2013-05-31 12:05       ` Jason Cooper
2013-05-31 14:15         ` Catalin Marinas
2013-05-31 14:20           ` Jason Cooper
2013-06-03 17:38           ` Simon Baatz
2013-06-03 18:03             ` Jason Cooper
2013-06-03 19:11               ` Simon Baatz
2013-06-03 19:22               ` Jason Cooper
2013-06-03 20:38                 ` Greg KH
2013-06-05 13:58             ` Catalin Marinas
2013-06-05 19:55               ` Simon Baatz
2013-05-31  9:07 ` Ming Lei
2013-05-31 18:54   ` Simon Baatz
2013-06-01 10:27     ` Ming Lei
2013-06-03  9:33       ` Catalin Marinas [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=20130603093309.GA32295@arm.com \
    --to=catalin.marinas@arm.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.