From: Ralf Baechle <ralf@linux-mips.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Russell King <rmk+lkml@arm.linux.org.uk>,
David Miller <davem@davemloft.net>,
nickpiggin@yahoo.com.au, Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
anemo@mba.ocn.ne.jp, linux-arch@vger.kernel.org,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
James Bottomley <James.Bottomley@SteelEye.com>
Subject: Re: [PATCH 1/3] Fix COW D-cache aliasing on fork
Date: Fri, 20 Oct 2006 22:41:22 +0100 [thread overview]
Message-ID: <20061020214122.GA29237@linux-mips.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0610201408070.3962@g5.osdl.org>
On Fri, Oct 20, 2006 at 02:12:11PM -0700, Linus Torvalds wrote:
> > Well, looking at do_wp_page() I'm now quite concerned about ARM and COW.
> > I can't see how this code could _possibly_ work with a virtually indexed
> > cache as it stands. Yet, the kernel does appear to work.
>
> It really shouldn't need any extra code, exactly because by the time it
> hits any page-fault, the caches had better be in sync with the physical
> page contents _anyway_ (yes, being virtual, the caches will _duplicate_
> the contents, but since the pages are read-only, that aliasing should be
> perfectly fine).
Until yesterday I also thought multiple read-only copies wouldn't do any
harm. Well, until I learned about the wonderful behaviour of the PA8800
caches. PA8800 has VIPT primary caches, PIPT secondary caches. And the
sinister part - caches are exclusive, that is a cacheline is either in
L1 or L2 but never in both and can migrate between L1 and L2. Now
onsider the following scenario:
o physical address P is mapped to two aliasing addresses V1 and V2
o a load from V1 results in a clean line in L1 caching P at index V1.
o a store to V2 results in a clean line in L1 caching P at index V2.
o the line at V2 is getting written back to memory.
o a victim replacement of the line at V1 results in the _clean_ line
migrating back from L1 to L2.
-> another read from V2 will return stale data.
As consequence flush_cache_mm() on PA (or at least PA8800) currently blows
away the entire cache, as Kyle McMartin just told me. The whole 1.5MB L1
and 32MB of L2 making fork an ultraheavy operation.
> It's just that we weren't quite careful enough at that time (and even
> then, that would only matter for some really really unlikely and strange
> situations that only happen when you fork() from a _threaded_ environment,
> so it shouldn't be anything you'd notice under normal load).
>
> I think.
The flush is there since a very long time. I have it in my tree since
~ 2.1.36 and I get the feeling anybody every has been seriously revisited
the issue since.
Ralf
next prev parent reply other threads:[~2006-10-20 21:41 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-19 16:35 [PATCH 1/3] Fix COW D-cache aliasing on fork Ralf Baechle
2006-10-19 16:35 ` [PATCH 2/3] Pass vma argument to copy_user_highpage() Ralf Baechle
2006-10-19 16:35 ` [PATCH 3/3] MIPS: Fix COW D-cache aliasing on fork Ralf Baechle
2006-10-22 2:32 ` Ralf Baechle
2006-10-19 17:46 ` [PATCH 1/3] " Nick Piggin
2006-10-19 18:13 ` Ralf Baechle
2006-10-19 18:48 ` Nick Piggin
2006-10-19 22:59 ` David Miller
2006-10-20 14:39 ` Nick Piggin
2006-10-20 15:49 ` Linus Torvalds
2006-10-20 15:57 ` Nick Piggin
2006-10-20 16:36 ` Linus Torvalds
2006-10-20 16:47 ` Nick Piggin
2006-10-20 17:16 ` Linus Torvalds
2006-10-20 17:37 ` Nick Piggin
2006-10-21 0:46 ` Ralf Baechle
2006-10-20 19:36 ` David Miller
2006-10-20 19:54 ` Linus Torvalds
2006-10-20 19:58 ` David Miller
2006-10-20 20:10 ` Linus Torvalds
2006-10-20 20:59 ` Russell King
2006-10-20 21:06 ` David Miller
2006-10-20 21:17 ` Russell King
2006-10-20 21:30 ` David Miller
2006-10-20 21:12 ` Linus Torvalds
2006-10-20 21:28 ` Russell King
2006-10-20 21:41 ` Ralf Baechle [this message]
2006-10-21 16:28 ` Atsushi Nemoto
2006-10-20 21:49 ` Ralf Baechle
2006-10-20 22:02 ` Linus Torvalds
2006-10-20 22:22 ` David Miller
2006-10-20 22:51 ` Ralf Baechle
2006-10-20 23:28 ` Linus Torvalds
2006-10-21 0:06 ` Ralf Baechle
2006-10-21 0:38 ` Linus Torvalds
2006-10-21 1:29 ` Paul Mackerras
2006-10-21 2:11 ` David Miller
2006-10-21 2:37 ` Linus Torvalds
2006-10-21 2:46 ` David Miller
2006-10-21 18:27 ` Ralf Baechle
2006-10-22 1:34 ` Ralf Baechle
2006-12-02 9:49 ` Russell King
2006-10-23 8:50 ` Martin Schwidefsky
2006-10-20 16:05 ` Ralf Baechle
2006-10-20 16:30 ` Nick Piggin
2006-10-20 19:23 ` David Miller
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=20061020214122.GA29237@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=James.Bottomley@SteelEye.com \
--cc=akpm@osdl.org \
--cc=anemo@mba.ocn.ne.jp \
--cc=davem@davemloft.net \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=rmk+lkml@arm.linux.org.uk \
--cc=schwidefsky@de.ibm.com \
--cc=torvalds@osdl.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