From: David Chinner <dgc@sgi.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: "David Chinner" <dgc@sgi.com>,
xfs@oss.sgi.com, Xen-devel <xen-devel@lists.xensource.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Mark Williamson" <mark.williamson@cl.cam.ac.uk>,
"Morten Bøgeskov" <xen-users@morten.bogeskov.dk>,
xfs-masters@oss.sgi.com, nickpiggin@yahoo.com.au
Subject: Re: Interaction between Xen and XFS: stray RW mappings
Date: Mon, 15 Oct 2007 08:56:18 +1000 [thread overview]
Message-ID: <20071014225618.GN23367404@sgi.com> (raw)
In-Reply-To: <470FA7C3.90404@goop.org>
On Fri, Oct 12, 2007 at 09:58:43AM -0700, Jeremy Fitzhardinge wrote:
> Hi Dave & other XFS folk,
>
> I'm tracking down a bug which appears to be a bad interaction between XFS
> and Xen. It looks like XFS is holding RW mappings on free pages, which Xen
> is trying to get an exclusive RO mapping on so it can turn them into
> pagetables.
>
> I'm assuming the pages are actually free, and this isn't a use after free
> problem. From a quick poke around, the most likely pieces of XFS code is
> the stuff in xfs_map.c which creates a virtually contiguous mapping of pages
> with vmap, and seems to delay unmapping them.
You mean xfs_buf.c.
And yes, we delay unmapping pages until we have a batch of them
to unmap. vmap and vunmap do not scale, so this is batching helps
alleviate some of the worst of the problems.
> When pinning a pagetable, Xen tries to eliminate any RW aliases of the pages
> its using. This is generally trivial because pages returned by
> get_free_page don't have any mappings aside from the normal kernel mapping.
> High pages, when using CONFIG_HIGHPTE, may have a residual kmap mapping, so
> we clear out the kmap cache if we encounter a highpage in the pagetable.
>
> I guess we could create a special-case interface to do the same thing with
> XFS mappings, but it would be nicer to have something more generic.
*nod*
> Is my analysis correct? Or should XFS not be holding stray mappings? Or is
> there already some kind of generic mechanism I can use to get it to release
> its mappings?
The xfsbufd cleans out any stale mappings - it's woken by the memory
shrinker interface (i.e. calls xfsbufd_wakeup()). Otherwise every
64th buffer being vmap()d will flush out stale mappings.
Realistically, if this delayed release of vmaps is a problem for
Xen, then I think that some generic VM solution is needed to this
problem as vmap() is likely to become more common in future (think
large blocks in filesystems). Nick - any comments?
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
next prev parent reply other threads:[~2007-10-14 22:56 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-12 16:58 Interaction between Xen and XFS: stray RW mappings Jeremy Fitzhardinge
2007-10-12 17:08 ` Jeremy Fitzhardinge
2007-10-14 22:56 ` David Chinner [this message]
2007-10-14 23:12 ` Jeremy Fitzhardinge
2007-10-14 23:33 ` David Chinner
2007-10-15 4:15 ` Nick Piggin
2007-10-15 0:57 ` Jeremy Fitzhardinge
2007-10-15 7:26 ` Nick Piggin
2007-10-15 3:42 ` Jeremy Fitzhardinge
2007-10-15 4:11 ` David Chinner
2007-10-15 4:18 ` Jeremy Fitzhardinge
2007-10-15 4:25 ` David Chinner
2007-10-15 8:31 ` [xfs-masters] " Christoph Hellwig
2007-10-22 3:18 ` dean gaudet
2007-10-22 3:34 ` Jeremy Fitzhardinge
2007-10-22 4:28 ` dean gaudet
2007-10-22 4:39 ` Nick Piggin
2007-10-22 18:37 ` Jeremy Fitzhardinge
2007-10-22 18:32 ` Jeremy Fitzhardinge
2007-10-22 13:47 ` Andi Kleen
2007-10-22 18:40 ` Jeremy Fitzhardinge
2007-10-22 19:07 ` Andi Kleen
2007-10-22 19:11 ` Jeremy Fitzhardinge
2007-10-22 22:32 ` David Chinner
2007-10-22 23:35 ` Andi Kleen
2007-10-23 0:16 ` Zachary Amsden
2007-10-23 0:36 ` David Chinner
2007-10-23 7:04 ` [patch] " David Chinner
2007-10-23 9:30 ` Andi Kleen
2007-10-23 12:41 ` David Chinner
2007-10-23 14:33 ` Jeremy Fitzhardinge
2007-10-24 4:36 ` [PATCH] Allow lazy unmapping by taking extra page references V2 David Chinner
2007-10-24 5:08 ` Jeremy Fitzhardinge
2007-10-24 21:48 ` [PATCH] Allow lazy unmapping by taking extra page references V3 David Chinner
2007-10-24 22:46 ` Jeremy Fitzhardinge
2007-10-24 23:21 ` David Chinner
2007-10-23 9:28 ` Interaction between Xen and XFS: stray RW mappings Andi Kleen
2007-10-15 9:36 ` Andi Kleen
2007-10-15 14:56 ` Nick Piggin
2007-10-15 11:07 ` Andi Kleen
2007-10-15 11:28 ` Nick Piggin
2007-10-15 12:54 ` Andi Kleen
2007-10-21 12:17 ` Dave Airlie
2007-10-21 22:16 ` Benjamin Herrenschmidt
2007-10-22 9:49 ` Andi Kleen
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=20071014225618.GN23367404@sgi.com \
--to=dgc@sgi.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.williamson@cl.cam.ac.uk \
--cc=nickpiggin@yahoo.com.au \
--cc=xen-devel@lists.xensource.com \
--cc=xen-users@morten.bogeskov.dk \
--cc=xfs-masters@oss.sgi.com \
--cc=xfs@oss.sgi.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 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.