From: Hugh Dickins <hugh@veritas.com>
To: Gleb Natapov <gleb@minantech.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Petr Vandrovec <vandrove@vc.cvut.cz>,
Nick Piggin <nickpiggin@yahoo.com.au>,
"Michael S. Tsirkin" <mst@mellanox.co.il>,
Badari Pulavarty <pbadari@us.ibm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Nick's core remove PageReserved broke vmware...
Date: Thu, 3 Nov 2005 14:11:46 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.61.0511031333220.22885@goblin.wat.veritas.com> (raw)
In-Reply-To: <20051103081213.GC22185@minantech.com>
On Thu, 3 Nov 2005, Gleb Natapov wrote:
> On Wed, Nov 02, 2005 at 10:02:49PM +0000, Hugh Dickins wrote:
> > On Thu, 3 Nov 2005, Benjamin Herrenschmidt wrote:
> > > On Wed, 2005-11-02 at 21:41 +0000, Hugh Dickins wrote:
> > >
> > > > The only extant problem here is if the pages are private, and you
> > > > fork while this is going on, and the parent user process writes to the
> > > > area before completion: then COW leaves the child with the page being
> > > > DMAed into, giving the parent a copied page which may be incomplete.
> > >
> > > Won't happen, and if it does, it's a user error to rely on that working,
> > > so it doesn't matter.
> >
> > I wish everyone else would see it that way! (But some people do
> > have valid scenarios where it can't just be ruled out completely.)
> >
> I am one of those people :)
>
> Last discussion about this issue ended without resolution, but I remember
> you mentioned the possibility to leave ptes writable in parent during fork
> for private pages mapped for DMA. Is this approach acceptable?
I was toying with that idea back then, but it leaves the pages in a
peculiar limbo between being shared and private, such that it's hard
to think through the consequences. We do already have a case rather
like that (ptrace writing to a write-protected area), but some of us
are a bit worried by that one, so I'd be foolish now to recommend
another such subversion of the rules.
In the time since we discussed before, I've rather come full circle
round to my original position: abandoning such ideas of trying to
handle it from get_user_pages itself, appreciating the simplicity
of the original PROT_DONTCOPY idea from you guys; but sticking to my
initial reaction that this is better done by madvise(MADV_DONTCOPY),
not by the mmap/mprotect route in Michael's patch. (I never bought
the "racy" argument advanced in favour of the mmap flag.)
One of the factors which has swayed me to the DONTCOPY approach, is
Nick's 2.6.14 optimization in fork's copy_page_range, where areas
which can be safely faulted later are not copied pte by pte. But
that doesn't apply to all areas, and in particular cannot apply to
VM_NONLINEAR shared areas. It should be of benefit to apps which
use large such areas, and also do a lot of forking children who don't
need those areas, to be able to mark them VM_DONTCOPY. Or any other
vmas the children won't need. (But there's one big distinction between
the optimization and VM_DONTCOPY: the optimization copies vma but
doesn't fill in its ptes, VM_DONTCOPY doesn't even copy the vma.)
Two warnings if someone would like to post a MADV_DONTCOPY patch.
It should include a matching MADV_DOCOPY to clear the condition, but
that must not be allowed to clear VM_DONTCOPY set originally by driver:
perhaps you'll end up with a VM_UDONTCOPY or something like that.
And Badari has a MADV_REMOVE patch in the works, taking the next
slot (just after MADV_DONTNEED in most of the arches): probably
best for you to base yours on top of his (though yours is simpler
and might jump ahead).
Hugh
next prev parent reply other threads:[~2005-11-03 14:12 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-01 19:30 Petr Vandrovec
2005-11-02 0:34 ` Nick Piggin
2005-11-02 1:17 ` Petr Vandrovec
2005-11-02 2:09 ` Nick Piggin
2005-11-02 12:26 ` Hugh Dickins
2005-11-02 18:06 ` Petr Vandrovec
2005-11-02 21:04 ` Benjamin Herrenschmidt
2005-11-02 21:41 ` Hugh Dickins
2005-11-02 21:45 ` Benjamin Herrenschmidt
2005-11-02 22:02 ` Hugh Dickins
2005-11-02 22:22 ` Benjamin Herrenschmidt
2005-11-03 8:03 ` Gleb Natapov
2005-11-03 13:32 ` Hugh Dickins
2005-11-03 13:55 ` Gleb Natapov
2005-11-03 21:21 ` Benjamin Herrenschmidt
2005-11-02 22:39 ` Petr Vandrovec
2005-11-03 8:12 ` Gleb Natapov
2005-11-03 14:11 ` Hugh Dickins [this message]
2005-11-03 14:22 ` Gleb Natapov
2005-11-03 14:37 ` Michael S. Tsirkin
2005-11-03 14:59 ` Hugh Dickins
2005-11-03 15:09 ` Gleb Natapov
2005-11-03 15:14 ` Michael S. Tsirkin
2005-11-03 15:37 ` Hugh Dickins
2005-11-03 15:53 ` Gleb Natapov
2005-11-03 15:56 ` Michael S. Tsirkin
2005-11-08 21:34 ` Michael S. Tsirkin
2005-11-10 12:35 ` Gleb Natapov
2005-11-10 12:48 ` Michael S. Tsirkin
2005-11-10 12:49 ` Gleb Natapov
2005-11-10 13:16 ` Michael S. Tsirkin
2005-11-10 13:16 ` Gleb Natapov
2005-11-10 13:21 ` Hugh Dickins
2005-11-10 13:26 ` Gleb Natapov
2005-11-10 13:15 ` Hugh Dickins
2005-11-10 13:10 ` Hugh Dickins
2005-11-10 13:37 ` Michael S. Tsirkin
2005-11-10 13:55 ` Hugh Dickins
2005-11-10 14:12 ` Michael S. Tsirkin
2005-11-14 12:25 ` Michael S. Tsirkin
2005-11-14 12:27 ` Gleb Natapov
2005-11-14 12:34 ` Michael S. Tsirkin
2005-11-14 12:40 ` Hugh Dickins
2005-11-14 14:57 ` Michael S. Tsirkin
2005-11-14 15:07 ` Gleb Natapov
2005-11-14 12:41 ` Gleb Natapov
2005-11-14 14:52 ` Michael S. Tsirkin
2005-11-14 15:00 ` Gleb Natapov
2005-11-14 20:23 ` Michael S. Tsirkin
2005-11-15 9:26 ` Gleb Natapov
2005-11-14 15:58 ` Hugh Dickins
2005-11-14 21:17 ` Michael S. Tsirkin
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=Pine.LNX.4.61.0511031333220.22885@goblin.wat.veritas.com \
--to=hugh@veritas.com \
--cc=benh@kernel.crashing.org \
--cc=gleb@minantech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@mellanox.co.il \
--cc=nickpiggin@yahoo.com.au \
--cc=pbadari@us.ibm.com \
--cc=vandrove@vc.cvut.cz \
/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
Powered by JetHome