From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Ian Campbell <Ian.Campbell@eu.citrix.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jeremy@goop.org" <jeremy@goop.org>,
"hpa@zytor.com" <hpa@zytor.com>,
Konrad Rzeszutek Wilk <konrad@kernel.org>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
Jan Beulich <JBeulich@novell.com>
Subject: Re: [Xen-devel] [RFC PATCH v1] Consider void entries in the P2M as 1-1 mapping.
Date: Wed, 22 Dec 2010 13:01:09 -0500 [thread overview]
Message-ID: <20101222180109.GB24483@dumpdata.com> (raw)
In-Reply-To: <1293035176.4500.3742.camel@zakaz.uk.xensource.com>
> > OK, but they would be marked as E820 RAM regions, right?
>
> Yes. There's no special E820 type for ballooned out RAM.
Wheew, good.
>
> > It has. For regions that are small, or already allocated it would
> > stuff the INVALID_P2M_ENTRY in it. For larger areas (so more than 1MB or so)
> > if there has not been a top entry allocated for it, it will attach
> > the p2m_mid_missing to it which has pointes to p2m_missing, which in
> > turn is filled iwht INVALID_P2M_ENTRY.
>
> Hrm, I think I'm probably just confused by the missing vs. invalid vs.
> void terminology and conflating it all with IDENTITY/INVALID_P2M_ENTRY
> and getting in a mess.
I should do a better job explaining this. Will attach some pictures next
time.
>
> > > the safer default since we are (maybe) more likely to catch an
> > > INVALID_P2M_ENTRY before handing it to the hypervisor and getting
> > > ourselves shot.
> >
> > When I think entry, I think the lowel-level of the tree, not the
> > top or middle which are the ones that are by default now considered
> > "identity".
>
> "now" before this series or "now" after?
After.
>
> I think the default value for a lookup of an uninitialised entry should
> be the same regardless of whether the mid levels of the tree happen to
> be filled in (or pointing to common placeholder entries) or not. Is that
> the case?
Yes. But there are no uninitialized entry. All of them are either
INVALID_P2M_ENTRY or have a PFN value (with some potential flags attached to them).
Nothing else is allowed.
>
> > FYI, the p2m_identity is stuffed with INVALID_P2M_ENTRY
> > so if somebody does get a hold of the value there somehow without
> > first trying to set it, we would catch it and do this:
>
> p2m_identity is filled with INVALID_P2M_ENTRY? No wonder I'm confused by
> the names ;-) Why isn't it either called p2m_invalid or filled with
I am using both 'p2m_missing' and 'p2m_identity' pointers as a way
to figure out if the entries are considered missing (so up for balloon
graps) or identity PFNs. If it is neither p2m_missing nor p2m_identity it means
it has been allocated (probably via alloc_p2m) and contains PFNs (which
might be INVALID_P2M_ENTRY if balloon plucks that page out, a PFN,
or an 1-1 if the E820 gap or reserved region falls within that entry).
The contents of both pages (p2m_missing and p2m_identity) is INVALID_P2M_ENTRY.
> IDENTITY_P2M_ENTRY?
The value 0 would make the toolstack during migrate throw a fit.
>
> > It might not be.. but it would end up in the same logic path (in
> > the pte_pfn_to_mfn function).
>
> Sure.
>
> My concern is about this bit but rather about what accesses to unknown
> entries return. Currently I think they return INVALID_P2M_ENTRY but you
> are proposing that they return identity instead, which seems wrong for
Correct.
> anything which isn't explicitly initialised as I/O (or identity for any
> other reason).
Aha! And this is what we are fixing. You see, a lot of drivers don't explicitly
initialize their vmap's as I/O (or do as VM_IO but actually use real RAM). This
makes it possible to work with those guys.
I think what you are saying is to be more conservative and only set those implicit
1-1 mappings on E820 gaps, and on non-RAM E820 regions.
Everything else should be considered missing so that we will return for
pfn_to_mfn(MAX_P2M_PFN) == INVALID_P2M_ENTRY instead of MAX_P2M_PFN?
>
> > >
> > > > The xen/mmu.c code where it deals with _PAGE_IOMAP can be removed, but
> > > > to guard against regressions or bugs lets take it one patchset at a
> > > > time.
> > >
> > > Could we have a WARN_ON(_PAGE_IOMAP && !PAGE_IDENTITY) (or whatever the
> > > predicates really are) in some relevant places in mmu.c?
> >
> > The PAGE_IDENTITY or (IDENTITY_P2M_ENTRY) is never set anywhere.
>
> So how is it used? I don't see it apart from in a single BUG_ON and some
> comments. Do you just rely on IDENTITY_P2M_ENTRY==0 and things being
> filed with 0 by default?
No. INVALID_P2M_ENTRY.
Now that I think of it, I am not sure why I even introduced the
IDENTITY_P2M_ENTRY. It sure is confusing.
prev parent reply other threads:[~2010-12-22 18:01 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-21 21:37 [RFC PATCH v1] Consider void entries in the P2M as 1-1 mapping Konrad Rzeszutek Wilk
2010-12-21 21:37 ` [PATCH 01/10] xen: Make all reserved pages for the balloon be INVALID_P2M_ENTRY Konrad Rzeszutek Wilk
2010-12-21 22:19 ` Jeremy Fitzhardinge
2010-12-21 23:22 ` H. Peter Anvin
2010-12-22 8:47 ` Ian Campbell
2010-12-22 14:53 ` Konrad Rzeszutek Wilk
2010-12-22 15:46 ` Jeremy Fitzhardinge
2010-12-21 21:37 ` [PATCH 02/10] xen/p2m: change p2m_missing_* to p2m_identity_* Konrad Rzeszutek Wilk
2010-12-21 22:41 ` Jeremy Fitzhardinge
2010-12-22 14:59 ` Konrad Rzeszutek Wilk
2010-12-22 20:36 ` [SPAM] " Jeremy Fitzhardinge
2010-12-21 21:37 ` [PATCH 03/10] xen/mmu: Add the notion of IDENTITY_P2M_ENTRY Konrad Rzeszutek Wilk
2010-12-22 8:44 ` Ian Campbell
2010-12-21 21:37 ` [PATCH 04/10] xen/mmu: For 1-1 mapping, automatically set _PAGE_IOMAP Konrad Rzeszutek Wilk
2010-12-21 22:29 ` Jeremy Fitzhardinge
2010-12-22 15:02 ` Konrad Rzeszutek Wilk
2010-12-22 16:27 ` [Xen-devel] " Ian Campbell
2010-12-21 21:37 ` [PATCH 05/10] xen/setup: Set identity mapping for non-RAM E820 and E820 gaps Konrad Rzeszutek Wilk
2010-12-21 22:34 ` Jeremy Fitzhardinge
2010-12-22 15:04 ` Konrad Rzeszutek Wilk
2010-12-22 8:49 ` [Xen-devel] " Ian Campbell
2010-12-21 21:37 ` [PATCH 06/10] xen/setup: Only set identity mapping in E820 regions when privileged Konrad Rzeszutek Wilk
2010-12-21 22:37 ` Jeremy Fitzhardinge
2010-12-22 15:07 ` Konrad Rzeszutek Wilk
2010-12-21 21:37 ` [PATCH 07/10] xen/mmu: Work with 1-1 mappings when allocating new top/middle entries Konrad Rzeszutek Wilk
2010-12-21 22:37 ` Jeremy Fitzhardinge
2010-12-22 15:10 ` Konrad Rzeszutek Wilk
2010-12-22 8:54 ` [Xen-devel] " Ian Campbell
2010-12-22 17:47 ` Konrad Rzeszutek Wilk
2010-12-21 21:37 ` [PATCH 08/10] xen/mmu: Bugfix. Fill the top entry page with appropriate middle layer pointers Konrad Rzeszutek Wilk
2010-12-21 22:38 ` Jeremy Fitzhardinge
2010-12-22 15:11 ` Konrad Rzeszutek Wilk
2010-12-21 21:37 ` [PATCH 09/10] xen/mmu: Be aware of p2m_[mid_|]missing when saving/restore Konrad Rzeszutek Wilk
2010-12-21 21:37 ` [PATCH 10/10] xen/mmu: Warn against races Konrad Rzeszutek Wilk
2010-12-22 8:36 ` [Xen-devel] [RFC PATCH v1] Consider void entries in the P2M as 1-1 mapping Ian Campbell
2010-12-22 15:06 ` Konrad Rzeszutek Wilk
2010-12-22 16:26 ` Ian Campbell
2010-12-22 18:01 ` Konrad Rzeszutek Wilk [this message]
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=20101222180109.GB24483@dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=JBeulich@novell.com \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=konrad@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xensource.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).