[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1267909630.22204.129.camel@pasglop>
Date: Sun, 07 Mar 2010 08:07:10 +1100
From: Benjamin Herrenschmidt <benh@...nel.crashing.org>
To: Russell King - ARM Linux <linux@....linux.org.uk>
Cc: James Bottomley <James.Bottomley@...senPartnership.com>,
Pavel Machek <pavel@....cz>,
Catalin Marinas <catalin.marinas@....com>,
FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
mdharm-kernel@...-eyed-alien.net, linux-usb@...r.kernel.org,
x0082077@...com, sshtylyov@...mvista.com, tom.leiming@...il.com,
bigeasy@...utronix.de, oliver@...kum.org,
linux-kernel@...r.kernel.org, santosh.shilimkar@...com,
greg@...ah.com, linux-arm-kernel@...ts.infradead.org
Subject: Re: USB mass storage and ARM cache coherency
On Sat, 2010-03-06 at 19:36 +0000, Russell King - ARM Linux wrote:
> On Sat, Mar 06, 2010 at 04:17:23PM +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.
>
> No - this is where things get extremely icky.
>
> The problem at this point occurs on SMP architectures. As soon as you
> update the PTE entry, it is visible to other threads of the application.
> If you do I-cache handling after updating the PTE, then there is a window
> where another CPU can execute the page:
Right, we actually hit that bug on powerpc, however, James explanation
is misleading, ie, I think the -code- actually is right and
flush_icache_page() is called before set_pte_at(). However, see my other
email, I have other issues with it as it is, but nothing unfixable.
So for now, I keep my flush in set_pte_at() and ptep_set_access_flags(),
we'll see if I can move that to an improved flush_icache_page(). In
fact, even set_pte_at() isn't a panacea for me, as I want the fault type
as well.
Cheers,
Ben.
> CPU0 CPU1
> speculatively prefetches from page N via kernel
> mapping, loads garbage into I-cache
> attempts to execute P
> page fault
> page N allocated
> set_pte_at
> executes P
> *splat*
> flush I-cache
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists