|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 09/14] x86/p2m: Switch the two_gfns infrastructure to using gfn_t
Additionally, drop surrounding trailing whitespace.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
CC: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
---
xen/arch/x86/mm/mem_sharing.c | 8 ++++----
xen/include/asm-x86/p2m.h | 21 ++++++++++-----------
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
index 77f0d3f..573d354 100644
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -901,8 +901,8 @@ static int share_pages(struct domain *sd, gfn_t sgfn,
shr_handle_t sh,
struct two_gfns tg;
struct rmap_iterator ri;
- get_two_gfns(sd, gfn_x(sgfn), &smfn_type, NULL, &smfn,
- cd, gfn_x(cgfn), &cmfn_type, NULL, &cmfn,
+ get_two_gfns(sd, sgfn, &smfn_type, NULL, &smfn,
+ cd, cgfn, &cmfn_type, NULL, &cmfn,
0, &tg);
/* This tricky business is to avoid two callers deadlocking if
@@ -1027,8 +1027,8 @@ int mem_sharing_add_to_physmap(struct domain *sd,
unsigned long sgfn, shr_handle
p2m_access_t a;
struct two_gfns tg;
- get_two_gfns(sd, sgfn, &smfn_type, NULL, &smfn,
- cd, cgfn, &cmfn_type, &a, &cmfn,
+ get_two_gfns(sd, _gfn(sgfn), &smfn_type, NULL, &smfn,
+ cd, _gfn(cgfn), &cmfn_type, &a, &cmfn,
0, &tg);
/* Get the source shared page, check and lock */
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 74d0cf6..8bd6f64 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -529,17 +529,15 @@ static inline unsigned long mfn_to_gfn(struct domain *d,
mfn_t mfn)
/* Deadlock-avoidance scheme when calling get_gfn on different gfn's */
struct two_gfns {
- struct domain *first_domain;
- unsigned long first_gfn;
- struct domain *second_domain;
- unsigned long second_gfn;
+ struct domain *first_domain, *second_domain;
+ gfn_t first_gfn, second_gfn;
};
/* Returns mfn, type and access for potential caller consumption, but any
* of those can be NULL */
-static inline void get_two_gfns(struct domain *rd, unsigned long rgfn,
+static inline void get_two_gfns(struct domain *rd, gfn_t rgfn,
p2m_type_t *rt, p2m_access_t *ra, mfn_t *rmfn, struct domain *ld,
- unsigned long lgfn, p2m_type_t *lt, p2m_access_t *la, mfn_t *lmfn,
+ gfn_t lgfn, p2m_type_t *lt, p2m_access_t *la, mfn_t *lmfn,
p2m_query_t q, struct two_gfns *rval)
{
mfn_t *first_mfn, *second_mfn, scratch_mfn;
@@ -557,7 +555,8 @@ do { \
dest ## _t = (source ## t) ?: &scratch_t; \
} while (0)
- if ( (rd->domain_id <= ld->domain_id) || ((rd == ld) && (rgfn <= lgfn)) )
+ if ( (rd->domain_id <= ld->domain_id) ||
+ ((rd == ld) && (gfn_x(rgfn) <= gfn_x(lgfn))) )
{
assign_pointers(first, r);
assign_pointers(second, l);
@@ -570,9 +569,9 @@ do { \
/* Now do the gets */
*first_mfn = get_gfn_type_access(p2m_get_hostp2m(rval->first_domain),
- rval->first_gfn, first_t, first_a, q,
NULL);
+ gfn_x(rval->first_gfn), first_t,
first_a, q, NULL);
*second_mfn = get_gfn_type_access(p2m_get_hostp2m(rval->second_domain),
- rval->second_gfn, second_t, second_a, q,
NULL);
+ gfn_x(rval->second_gfn), second_t,
second_a, q, NULL);
}
static inline void put_two_gfns(struct two_gfns *arg)
@@ -580,8 +579,8 @@ static inline void put_two_gfns(struct two_gfns *arg)
if ( !arg )
return;
- put_gfn(arg->second_domain, arg->second_gfn);
- put_gfn(arg->first_domain, arg->first_gfn);
+ put_gfn(arg->second_domain, gfn_x(arg->second_gfn));
+ put_gfn(arg->first_domain, gfn_x(arg->first_gfn));
}
/* Init the datastructures for later use by the p2m code */
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |