From: Christian Limpach <chris@pin.lu>
To: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel@lists.sourceforge.net, Ian Pratt <Ian.Pratt@cl.cam.ac.uk>
Subject: Re: pagetable pinning question
Date: Wed, 4 Feb 2004 23:19:41 +0100 [thread overview]
Message-ID: <0c8901c3eb6c$fd24d270$070414ac@pin> (raw)
In-Reply-To: E1AoQeE-0006Tx-00@wisbech.cl.cam.ac.uk
> > I think it would. In NetBSD PDs are managed in a cached pool, i.e. the
pool
> > items are initialized by the pool system and must be returned to the
pool in
> > an initialized/clean state. I have the pool item constructor pin the
pages
> > and the destructor unpin the pages. I would expect a problem when the
PD's
> > page is released from the pool (the page is unpinned) while it's still
> > mapped in another PD? It won't fail but leave the page mapped as an L1
page
> > while it's untyped?
>
> That is correct (except it will remain pinned as an L2 table -- many
> people have told me that I have L1 and L2 the wrong way round!).
*think* *think* I did really mean mapped as an L1 page:
PD1 is the current page directory, PD2 is another page directory which is
pinned (L2 type). We enter PD2 as a pagetable in PD1, Xen handles this is a
twisted L2 entry and doesn't reference count PD2. Now we unpin PD2 which
would drop its page's reference count to 0 while the page is still installed
in PD1 as a pagetable.
> > So, for case 1, would you then just increment the page's type count in
> > get_twisted_l2_table an decrement it in mod_l2_entry when put_l1_table
> > fails?
>
> Actually, it now occurs to me that this strategy has a nasty flaw (at
> least it does in the v1.3 page-management code). We can end up with
> circular references: e.g. PD A maps PD B, and vice versa. Unless code
> is added to detect such loops this will mess up page-frame
> reclamation since they hold each other as type 'L2'. :-(
>
> Hmmmm... I think a simple hack that allows these circular references
> is sufficient in 1.2 --- we don't properly do reference-count-based
> reclamation in Xen 1.2. Xen 1.3 is going to need some more thought --
> wet towel time :-)
I can't comment on the 1.3 problem but for 1.2 it would seem to me that
simply increasing the L2's reference count when we map a different L2 table
as a twisted L2 table would keep things sane even in the circular case, as
long as we unmap in the opposite order. Or am I missing something?
I think I can guarantee that the unmap order is correct if I clear the
alternate mapping whenever I switch pagetables (and there's no switches
between a requested mapping and the corresponding unmap). The pool cache
destructor would then also only need to check the current pagetable's
alternate mapping.
> > yes please, I think it is. I have removed the check in my Xen but
without
> > the added ref counting and without the extra cleaning up in the
destructor.
>
> I expect your current hack can lead to reference-count inconsistencies
> within Xen. We need to sort this out as a priority. I'll fix for 1.2
> tomorrow and then think harder about the correct solution for 1.3.
I can't see how... The alternate PD is pinned, so all changes to it will
use mod_l2_entry and all changes to the PT's it references will use
mod_l1_entry. Why would the fact that it's mapped by another pagetable mess
up the ref couting?
christian
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
next prev parent reply other threads:[~2004-02-04 22:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-03 19:21 pagetable pinning question Christian Limpach
2004-02-04 8:11 ` Ian Pratt
2004-02-04 14:43 ` Christian Limpach
2004-02-04 8:16 ` Keir Fraser
2004-02-04 8:21 ` Keir Fraser
2004-02-04 16:29 ` Bin Ren
2004-02-06 1:28 ` Zachary Amsden
2004-02-06 1:43 ` Bin Ren
2004-02-04 14:44 ` Christian Limpach
2004-02-04 17:17 ` Keir Fraser
2004-02-04 22:19 ` Christian Limpach [this message]
2004-02-04 23:06 ` Ian Pratt
2004-02-05 14:35 ` Keir Fraser
2004-02-05 15:25 ` Keir Fraser
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='0c8901c3eb6c$fd24d270$070414ac@pin' \
--to=chris@pin.lu \
--cc=Ian.Pratt@cl.cam.ac.uk \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=xen-devel@lists.sourceforge.net \
/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.