* [PATCH 1 of 2] x86/mm: Don't ASSERT() for a valid mfn on paged p2m entries in guest_physmap_add
2012-01-13 5:33 [PATCH 0 of 2] Two p2m bug fixes Andres Lagar-Cavilla
@ 2012-01-13 5:33 ` Andres Lagar-Cavilla
2012-01-13 5:33 ` [PATCH 2 of 2] Correct p2m unlocking during grant table map Andres Lagar-Cavilla
2012-01-19 10:44 ` [PATCH 0 of 2] Two p2m bug fixes Tim Deegan
2 siblings, 0 replies; 4+ messages in thread
From: Andres Lagar-Cavilla @ 2012-01-13 5:33 UTC (permalink / raw)
To: xen-devel; +Cc: andres, tim, adin
xen/arch/x86/mm/p2m.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Signed-off-by: Adin Scannell <adin@scannell.ca>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
diff -r 4aa843efe1ac -r 1ab50ad829d6 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -489,7 +489,7 @@ guest_physmap_add_entry(struct domain *d
return -EINVAL;
}
- else if ( p2m_is_ram(ot) )
+ else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
{
ASSERT(mfn_valid(omfn));
set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
@@ -514,7 +514,7 @@ guest_physmap_add_entry(struct domain *d
P2M_DEBUG("aliased! mfn=%#lx, old gfn=%#lx, new gfn=%#lx\n",
mfn + i, ogfn, gfn + i);
omfn = p2m->get_entry(p2m, ogfn, &ot, &a, p2m_query, NULL);
- if ( p2m_is_ram(ot) )
+ if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
{
ASSERT(mfn_valid(omfn));
P2M_DEBUG("old gfn=%#lx -> mfn %#lx\n",
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2 of 2] Correct p2m unlocking during grant table map
2012-01-13 5:33 [PATCH 0 of 2] Two p2m bug fixes Andres Lagar-Cavilla
2012-01-13 5:33 ` [PATCH 1 of 2] x86/mm: Don't ASSERT() for a valid mfn on paged p2m entries in guest_physmap_add Andres Lagar-Cavilla
@ 2012-01-13 5:33 ` Andres Lagar-Cavilla
2012-01-19 10:44 ` [PATCH 0 of 2] Two p2m bug fixes Tim Deegan
2 siblings, 0 replies; 4+ messages in thread
From: Andres Lagar-Cavilla @ 2012-01-13 5:33 UTC (permalink / raw)
To: xen-devel; +Cc: andres, tim, adin
xen/common/grant_table.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
We were not putting gfn's consistently.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
diff -r 1ab50ad829d6 -r abdb908c0aed xen/common/grant_table.c
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -141,7 +141,7 @@ shared_entry_header(struct grant_table *
#define active_entry(t, e) \
((t)->active[(e)/ACGNT_PER_PAGE][(e)%ACGNT_PER_PAGE])
-/* Check if the page has been paged out */
+/* Check if the page has been paged out. If rc == GNTST_okay, caller must do put_gfn(rd, gfn) */
static int __get_paged_frame(unsigned long gfn, unsigned long *frame, int readonly, struct domain *rd)
{
int rc = GNTST_okay;
@@ -573,7 +573,10 @@ __gnttab_map_grant_ref(
gfn = sha1 ? sha1->frame : sha2->full_page.frame;
rc = __get_paged_frame(gfn, &frame, !!(op->flags & GNTMAP_readonly), rd);
if ( rc != GNTST_okay )
+ {
+ gfn = INVALID_GFN;
goto unlock_out;
+ }
act->gfn = gfn;
act->domid = ld->domain_id;
act->frame = frame;
@@ -700,7 +703,8 @@ __gnttab_map_grant_ref(
op->handle = handle;
op->status = GNTST_okay;
- put_gfn(rd, gfn);
+ if ( gfn != INVALID_GFN )
+ put_gfn(rd, gfn);
rcu_unlock_domain(rd);
return;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 0 of 2] Two p2m bug fixes
2012-01-13 5:33 [PATCH 0 of 2] Two p2m bug fixes Andres Lagar-Cavilla
2012-01-13 5:33 ` [PATCH 1 of 2] x86/mm: Don't ASSERT() for a valid mfn on paged p2m entries in guest_physmap_add Andres Lagar-Cavilla
2012-01-13 5:33 ` [PATCH 2 of 2] Correct p2m unlocking during grant table map Andres Lagar-Cavilla
@ 2012-01-19 10:44 ` Tim Deegan
2 siblings, 0 replies; 4+ messages in thread
From: Tim Deegan @ 2012-01-19 10:44 UTC (permalink / raw)
To: Andres Lagar-Cavilla; +Cc: andres, xen-devel, tim, adin
At 00:33 -0500 on 13 Jan (1326414817), Andres Lagar-Cavilla wrote:
> - An assert for an invalid mfn was being triggered in
> guest_physmap_add_entry, even though the target gfn was paged out.
>
> - Fix how gfn's are put when mapping grants.
Applied, thanks.
Tim.
^ permalink raw reply [flat|nested] 4+ messages in thread