aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/grant_table.c
diff options
context:
space:
mode:
authorTim Deegan <Tim.Deegan@citrix.com>2011-06-02 13:16:52 +0100
committerTim Deegan <Tim.Deegan@citrix.com>2011-06-02 13:16:52 +0100
commit8c7d0b26207932a07061b03e1873dc3c8987f568 (patch)
treed26798443d514c1a1b03bb80979a49dd8f16d323 /xen/common/grant_table.c
parent992980732559dc633b85bf661918c3041df36c6e (diff)
downloadxen-8c7d0b26207932a07061b03e1873dc3c8987f568.tar.gz
xen-8c7d0b26207932a07061b03e1873dc3c8987f568.tar.bz2
xen-8c7d0b26207932a07061b03e1873dc3c8987f568.zip
x86/mm/p2m: merge gfn_to_mfn_unshare with other gfn_to_mfn paths.
gfn_to_mfn_unshare() had its own function despite all other lookup types being handled in one place. Merge it into _gfn_to_mfn_type(), so that it gets the benefit of broken-page protection, for example, and tidy its interfaces up to fit. The unsharing code still has a lot of bugs, e.g. - failure to alloc for unshare on a foreign lookup still BUG()s, - at least one race condition in unshare-and-retry - p2m_* lookup types should probably be flags, not enum but it's cleaner and will make later p2m cleanups easier. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Diffstat (limited to 'xen/common/grant_table.c')
-rw-r--r--xen/common/grant_table.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index e3ad8e60c2..ba32a358a5 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -110,7 +110,8 @@ static unsigned inline int max_nr_maptrack_frames(void)
#define gfn_to_mfn_private(_d, _gfn) ({ \
p2m_type_t __p2mt; \
unsigned long __x; \
- __x = mfn_x(gfn_to_mfn_unshare(p2m_get_hostp2m(_d), _gfn, &__p2mt, 1)); \
+ __x = mfn_x(gfn_to_mfn_unshare(p2m_get_hostp2m(_d), _gfn, &__p2mt)); \
+ BUG_ON(p2m_is_shared(__p2mt)); /* XXX fixme */ \
if ( !p2m_is_valid(__p2mt) ) \
__x = INVALID_MFN; \
__x; })
@@ -153,7 +154,12 @@ static int __get_paged_frame(unsigned long gfn, unsigned long *frame, int readon
if ( readonly )
mfn = gfn_to_mfn(p2m, gfn, &p2mt);
else
- mfn = gfn_to_mfn_unshare(p2m, gfn, &p2mt, 1);
+ {
+ mfn = gfn_to_mfn_unshare(p2m, gfn, &p2mt);
+ BUG_ON(p2m_is_shared(p2mt));
+ /* XXX Here, and above in gfn_to_mfn_private, need to handle
+ * XXX failure to unshare. */
+ }
if ( p2m_is_valid(p2mt) ) {
*frame = mfn_x(mfn);