From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
Pavel Machek <pavel@ucw.cz>,
Catalin Marinas <catalin.marinas@arm.com>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
mdharm-kernel@one-eyed-alien.net, linux-usb@vger.kernel.org,
x0082077@ti.com, sshtylyov@ru.mvista.com, tom.leiming@gmail.com,
bigeasy@linutronix.de, oliver@neukum.org,
linux-kernel@vger.kernel.org, santosh.shilimkar@ti.com,
greg@kroah.com, linux-arm-kernel@lists.infradead.org
Subject: Re: USB mass storage and ARM cache coherency
Date: Sun, 07 Mar 2010 09:07:17 +0530 [thread overview]
Message-ID: <1267933038.2812.12.camel@mulgrave.site> (raw)
In-Reply-To: <1267909429.22204.127.camel@pasglop>
On Sun, 2010-03-07 at 08:03 +1100, Benjamin Herrenschmidt wrote:
> On Sat, 2010-03-06 at 16:17 +0530, James Bottomley wrote:
> > On a fault in of exec data, we first try to get the page out of the page
> > cache. If it's not present, we put the faulting process to sleep and
> > fetch it in from storage. When we do the read, on the PIO path, the
> > kernel alias for the page becomes dirty. Some time later, we place the
> > page into the user space (updating the pte entry that caused a fault).
> > At this point, we'll call both flush_icache_page() and
> > update_mmu_cache() ... this is where the I/D resolution should be done.
> > Since it's after any I/O has occurred, it doesn't matter whether the CPU
> > speculatively moved anything in or not. As long as you flush the kernel
> > alias and invalidate the user I and D aliases, we're good to go. Using
> > the page arch flags is really only to optimise this process (defer
> > kernel D alias flushing).
>
> Ok, so while flush_icache_page() looks like something we could use
> instead of set_pte_at() for the icache flushing, it doesn't answer all
> the questions. Off the top of my mind:
OK, so what I was actually trying to get across is the point that we
don't handle I cache problems in the I/O or page cache code ... we
handle them in the mm code, so the mm piece of the above was
deliberately a bit vague.
> - I see the calls to flush_icache_page() in mm/memory.c but I don't see
> them next to all set_pte_at() that insert a valid PTE. For example, we
> don't flush the icache for anonymous pages. While that might seem like a
> good idea, we have been under pressure to "fix" that on powerpc to make
> sure there is no stale icache content from another process leaking into
> userspace.
I'm not entirely sure what flush_icache_page() is supposed to do. On
parisc it flushes the *kernel* icache ... which has got to be wrong.
According to cachetlb.txt it's an obsolete interface.
> - It needs to be done -before- set_pte_at() but I think the code does it
> right, only your explanation above makes it unclear :-)
Sorry, like I said, I only sketched the mm piece. However, at least on
parisc, there's a technical problem with flushing before we have the
pte: On VIPT systems, we need a mapping before the flush will work. I
was experimenting with a mechanism whereby we set aside in the kernel an
aligned region of our congruence size and simply flushed in that region
with the correct mappings, but we haven't got around to implementing it
in the kernel yet.
> - It doesn't take the PTE pointer as an argument, so here goes our trick
> on powerpc of filtering out exec permission rather than flushing when a
> page is accessed by a read fault
>
> - We -still- have the problem of tracking whether the icache has been
> flushed or not yet for a given physical page on archs with PIPT (or non
> aliasing VIPT) like powerpc. Without that tracking, we flush a lot more
> than necessary since we'll end up flushing things like glibc text pages
> for every process they are mapped into which is totally wasteful. Thus
> the idea of using a new PG bit to separate D$ from I$ tracking still
> makes sense.
So, assuming full congruence of user space, can't you use the VMA as an
indicator? i.e. if we have no user space mappings, we have to flush the
icache ... if we have one or more, the icache has been flushed and
placing the same page congruently in a different address space benefits
from that prior flush, so consequently there's no need to flush again?
I also think we've established the relevant facts for the I/O thread
(that we only need to either flush the kernel D cache or mark it as to
be flushed later on PIO reads). We're now into deep technicalities of
how the mm system operates at the architecture level, so perhaps we
should move this to linux-arch?
James
next prev parent reply other threads:[~2010-03-07 3:37 UTC|newest]
Thread overview: 193+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-29 14:34 Catalin Marinas
2010-01-29 16:10 ` Oliver Neukum
2010-01-29 16:23 ` Ming Lei
2010-01-29 16:34 ` Catalin Marinas
2010-01-29 16:41 ` Oliver Neukum
2010-01-29 17:14 ` Catalin Marinas
2010-01-29 17:51 ` Sergei Shtylyov
2010-01-29 18:54 ` Matthew Dharm
2010-01-29 19:35 ` Greg KH
2010-02-01 13:49 ` Catalin Marinas
2010-02-01 17:29 ` Catalin Marinas
2010-02-01 20:14 ` Alan Stern
2010-02-02 4:24 ` Paul Mundt
2010-02-02 9:58 ` Catalin Marinas
2010-02-01 22:30 ` Andreas Mohr
2010-02-02 6:58 ` Oliver Neukum
2010-02-02 9:31 ` Florian Fainelli
2010-02-02 6:39 ` Paul Mundt
2010-02-02 11:05 ` Catalin Marinas
2010-02-02 11:15 ` Paul Mundt
2010-02-02 9:11 ` Sebastian Andrzej Siewior
2010-02-02 11:09 ` Catalin Marinas
2010-02-02 11:48 ` Oliver Neukum
2010-02-02 12:01 ` Catalin Marinas
2010-02-02 12:07 ` Oliver Neukum
2010-02-02 12:11 ` Andreas Mohr
2010-02-02 14:42 ` Clemens Ladisch
2010-02-02 14:52 ` Oliver Neukum
2010-02-02 15:10 ` Andreas Mohr
2010-02-02 15:34 ` Catalin Marinas
2010-02-02 20:38 ` Andreas Mohr
2010-02-02 12:39 ` Catalin Marinas
2010-02-02 13:08 ` Oliver Neukum
2010-02-02 14:34 ` Catalin Marinas
2010-02-02 17:11 ` Alan Stern
2010-02-02 17:20 ` Catalin Marinas
2010-02-02 21:52 ` Andreas Mohr
2010-02-03 15:15 ` Alan Stern
2010-02-08 6:55 ` Pavel Machek
2010-02-02 13:36 ` Ming Lei
2010-02-02 14:35 ` Catalin Marinas
2010-02-08 6:55 ` Pavel Machek
2010-02-08 7:33 ` Andreas Mohr
2010-02-08 10:19 ` Catalin Marinas
2010-02-08 9:51 ` Catalin Marinas
2010-02-08 10:03 ` Andy Green
2010-02-17 9:50 ` Sascha Hauer
2010-02-17 9:57 ` Andy Green
2010-02-08 10:52 ` Pavel Machek
2010-02-08 11:28 ` Catalin Marinas
2010-02-16 7:57 ` Shilimkar, Santosh
2010-02-16 8:22 ` Oliver Neukum
2010-02-16 8:55 ` Shilimkar, Santosh
2010-02-16 9:07 ` Oliver Neukum
2010-02-16 9:39 ` Russell King - ARM Linux
2010-02-16 13:32 ` Oliver Neukum
2010-02-16 13:40 ` Shilimkar, Santosh
2010-02-16 13:46 ` Oliver Neukum
2010-02-16 14:12 ` Shilimkar, Santosh
2010-02-16 14:22 ` Oliver Neukum
2010-02-16 14:45 ` Shilimkar, Santosh
2010-02-16 15:44 ` Alan Stern
2010-02-17 8:55 ` Shilimkar, Santosh
2010-02-17 9:10 ` Oliver Neukum
2010-02-17 9:17 ` Shilimkar, Santosh
2010-02-17 17:02 ` Alan Stern
2010-02-17 20:26 ` Russell King - ARM Linux
2010-02-17 20:30 ` Gadiyar, Anand
2010-02-18 6:56 ` Oliver Neukum
2010-02-18 7:14 ` Gadiyar, Anand
2010-02-17 12:29 ` Jamie Lokier
2010-02-17 3:21 ` Ming Lei
2010-02-17 9:05 ` Benjamin Herrenschmidt
2010-02-17 9:15 ` Oliver Neukum
2010-02-17 9:40 ` Benjamin Herrenschmidt
2010-02-17 10:09 ` Oliver Neukum
2010-02-17 10:18 ` Benjamin Herrenschmidt
2010-02-17 10:23 ` Oliver Neukum
2010-02-17 12:15 ` Benjamin Herrenschmidt
2010-02-17 9:55 ` Russell King - ARM Linux
2010-02-17 10:05 ` Benjamin Herrenschmidt
2010-02-17 15:27 ` Catalin Marinas
2010-02-17 20:37 ` Benjamin Herrenschmidt
2010-02-17 20:44 ` Russell King - ARM Linux
2010-02-17 22:31 ` Benjamin Herrenschmidt
2010-02-19 17:15 ` Catalin Marinas
2010-02-19 17:36 ` Catalin Marinas
2010-02-19 20:53 ` Oliver Neukum
2010-02-24 2:48 ` Benjamin Herrenschmidt
2010-02-24 7:16 ` Oliver Neukum
2010-02-24 21:12 ` Benjamin Herrenschmidt
2010-02-25 3:48 ` Oliver Neukum
2010-02-26 0:22 ` Benjamin Herrenschmidt
2010-02-25 12:36 ` James Bottomley
2010-02-24 2:47 ` Benjamin Herrenschmidt
2010-02-24 16:19 ` Alan Stern
2010-02-24 21:13 ` Benjamin Herrenschmidt
2010-02-24 21:50 ` Alan Stern
2010-02-25 20:52 ` Benjamin Herrenschmidt
2010-02-26 16:00 ` Catalin Marinas
2010-02-26 21:36 ` Benjamin Herrenschmidt
2010-02-26 16:25 ` Catalin Marinas
2010-02-26 16:52 ` Alan Stern
2010-02-26 21:51 ` Benjamin Herrenschmidt
2010-02-26 21:00 ` Russell King - ARM Linux
2010-02-28 0:14 ` Benjamin Herrenschmidt
2010-02-28 5:01 ` James Bottomley
2010-03-01 10:39 ` Catalin Marinas
2010-03-01 11:06 ` Russell King - ARM Linux
2010-03-02 12:11 ` FUJITA Tomonori
2010-03-02 17:05 ` Catalin Marinas
2010-03-02 17:47 ` Catalin Marinas
2010-03-02 23:33 ` Benjamin Herrenschmidt
2010-03-03 10:21 ` Catalin Marinas
2010-03-02 23:29 ` Benjamin Herrenschmidt
2010-03-03 3:47 ` FUJITA Tomonori
2010-03-03 5:10 ` Benjamin Herrenschmidt
2010-03-03 5:40 ` James Bottomley
2010-03-03 9:36 ` Russell King - ARM Linux
2010-03-03 10:24 ` James Bottomley
2010-03-03 19:41 ` Russell King - ARM Linux
2010-03-04 2:00 ` Benjamin Herrenschmidt
2010-03-04 8:26 ` James Bottomley
2010-03-04 21:25 ` Benjamin Herrenschmidt
2010-03-03 6:35 ` FUJITA Tomonori
2010-03-03 10:43 ` Catalin Marinas
2010-03-03 10:40 ` Catalin Marinas
2010-03-03 21:54 ` Pavel Machek
2010-03-04 13:35 ` Catalin Marinas
2010-03-04 13:51 ` Pavel Machek
2010-03-04 14:21 ` James Bottomley
2010-03-04 14:27 ` Russell King - ARM Linux
2010-03-04 15:25 ` Catalin Marinas
2010-03-04 15:34 ` Russell King - ARM Linux
2010-03-04 21:31 ` Benjamin Herrenschmidt
2010-03-06 10:47 ` James Bottomley
2010-03-06 19:36 ` Russell King - ARM Linux
2010-03-06 21:07 ` Benjamin Herrenschmidt
2010-03-07 5:54 ` James Bottomley
2010-03-08 11:17 ` Catalin Marinas
2010-03-06 21:03 ` Benjamin Herrenschmidt
2010-03-07 3:37 ` James Bottomley [this message]
2010-03-08 8:46 ` FUJITA Tomonori
2010-03-09 2:25 ` Benjamin Herrenschmidt
2010-03-04 15:29 ` Catalin Marinas
2010-03-04 15:41 ` Paul Mundt
2010-03-04 16:30 ` Russell King - ARM Linux
2010-03-04 17:34 ` Catalin Marinas
2010-03-04 17:54 ` Russell King - ARM Linux
2010-03-04 22:27 ` Andreas Mohr
2010-03-04 18:07 ` Catalin Marinas
2010-03-04 21:37 ` Benjamin Herrenschmidt
2010-03-04 22:11 ` Catalin Marinas
2010-03-05 4:34 ` Benjamin Herrenschmidt
2010-03-05 9:27 ` Catalin Marinas
2010-03-05 1:17 ` Paul Mundt
2010-03-05 4:44 ` Benjamin Herrenschmidt
2010-03-10 3:52 ` Paul Mundt
2010-03-11 21:44 ` Benjamin Herrenschmidt
2010-03-04 21:34 ` Benjamin Herrenschmidt
2010-03-04 21:28 ` Benjamin Herrenschmidt
2010-03-04 21:40 ` Russell King - ARM Linux
2010-03-05 4:31 ` Benjamin Herrenschmidt
2010-03-04 15:35 ` Catalin Marinas
2010-03-07 8:23 ` Pavel Machek
2010-03-08 10:57 ` Catalin Marinas
2010-03-02 23:26 ` Benjamin Herrenschmidt
2010-03-01 10:42 ` Catalin Marinas
2010-03-03 20:24 ` Jamie Lokier
2010-02-26 21:40 ` Benjamin Herrenschmidt
2010-02-26 21:49 ` Russell King - ARM Linux
2010-02-28 0:24 ` Benjamin Herrenschmidt
2010-02-28 19:17 ` Pavel Machek
2010-03-01 11:10 ` Catalin Marinas
2010-03-02 4:11 ` Benjamin Herrenschmidt
2010-02-24 2:39 ` Benjamin Herrenschmidt
2010-02-26 16:44 ` Catalin Marinas
2010-02-26 21:49 ` Benjamin Herrenschmidt
2010-02-26 22:03 ` Russell King - ARM Linux
2010-02-28 0:29 ` Benjamin Herrenschmidt
2010-02-28 23:20 ` Catalin Marinas
2010-02-28 23:17 ` Catalin Marinas
2010-02-17 15:27 ` Catalin Marinas
2010-02-17 15:39 ` Catalin Marinas
2010-02-17 15:40 ` Catalin Marinas
2010-02-17 15:40 ` Catalin Marinas
2010-02-17 16:19 ` Catalin Marinas
2010-02-17 16:19 ` Catalin Marinas
2010-02-16 8:44 ` Russell King - ARM Linux
2010-02-16 8:51 ` Gadiyar, Anand
2010-02-20 7:21 ` Pete Zaitcev
2010-02-03 23:56 George Spelvin
2010-02-04 4:39 ` Paul Mundt
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=1267933038.2812.12.camel@mulgrave.site \
--to=james.bottomley@hansenpartnership.com \
--cc=benh@kernel.crashing.org \
--cc=bigeasy@linutronix.de \
--cc=catalin.marinas@arm.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=greg@kroah.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mdharm-kernel@one-eyed-alien.net \
--cc=oliver@neukum.org \
--cc=pavel@ucw.cz \
--cc=santosh.shilimkar@ti.com \
--cc=sshtylyov@ru.mvista.com \
--cc=tom.leiming@gmail.com \
--cc=x0082077@ti.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
all inboxes | Powered by JetHome®