# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 475e2a8493b803916b63a68712a4e49abebe1026
# Parent 9d9b75569d0ee8c55d353f7d8ced8dc93485f5f5
Flush writable pagetable state whenever a domain is
synchronously paused (by Xen or by domain0), or when
it shuts down.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
diff -r 9d9b75569d0e -r 475e2a8493b8 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Sat Oct 15 15:26:03 2005
+++ b/xen/arch/x86/mm.c Sat Oct 15 16:19:43 2005
@@ -1755,7 +1755,7 @@
goto pin_page;
case MMUEXT_UNPIN_TABLE:
- if ( unlikely(!(okay = get_page_from_pagenr(mfn, FOREIGNDOM))) )
+ if ( unlikely(!(okay = get_page_from_pagenr(mfn, d))) )
{
MEM_LOG("Mfn %lx bad domain (dom=%p)",
mfn, page_get_owner(page));
@@ -2908,6 +2908,7 @@
{
l1_pgentry_t ol1e, nl1e;
int modified = 0, i;
+ struct vcpu *v;
for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
{
@@ -2940,7 +2941,11 @@
*/
memcpy(&l1page[i], &snapshot[i],
(L1_PAGETABLE_ENTRIES - i) * sizeof(l1_pgentry_t));
- domain_crash();
+
+ /* Crash the offending domain. */
+ set_bit(_DOMF_ctrl_pause, &d->domain_flags);
+ for_each_vcpu ( d, v )
+ vcpu_sleep_nosync(v);
break;
}
@@ -3019,8 +3024,8 @@
modified = revalidate_l1(d, pl1e, d->arch.ptwr[which].page);
unmap_domain_page(pl1e);
perfc_incr_histo(wpt_updates, modified, PT_UPDATES);
- ptwr_eip_stat_update( d->arch.ptwr[which].eip, d->domain_id, modified);
- d->arch.ptwr[which].prev_nr_updates = modified;
+ ptwr_eip_stat_update(d->arch.ptwr[which].eip, d->domain_id, modified);
+ d->arch.ptwr[which].prev_nr_updates = modified;
/*
* STEP 3. Reattach the L1 p.t. page into the current address space.
@@ -3369,7 +3374,9 @@
void ptwr_destroy(struct domain *d)
{
+ LOCK_BIGLOCK(d);
cleanup_writable_pagetable(d);
+ UNLOCK_BIGLOCK(d);
free_xenheap_page(d->arch.ptwr[PTWR_PT_ACTIVE].page);
free_xenheap_page(d->arch.ptwr[PTWR_PT_INACTIVE].page);
}
diff -r 9d9b75569d0e -r 475e2a8493b8 xen/common/domain.c
--- a/xen/common/domain.c Sat Oct 15 15:26:03 2005
+++ b/xen/common/domain.c Sat Oct 15 16:19:43 2005
@@ -290,6 +290,8 @@
atomic_inc(&v->pausecnt);
vcpu_sleep_sync(v);
}
+
+ sync_pagetable_state(d);
}
void vcpu_unpause(struct vcpu *v)
@@ -318,6 +320,8 @@
for_each_vcpu ( d, v )
vcpu_sleep_sync(v);
}
+
+ sync_pagetable_state(d);
}
void domain_unpause_by_systemcontroller(struct domain *d)
diff -r 9d9b75569d0e -r 475e2a8493b8 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h Sat Oct 15 15:26:03 2005
+++ b/xen/include/asm-x86/mm.h Sat Oct 15 16:19:43 2005
@@ -336,7 +336,12 @@
int revalidate_l1(struct domain *, l1_pgentry_t *, l1_pgentry_t *);
void cleanup_writable_pagetable(struct domain *d);
-#define sync_pagetable_state(d) cleanup_writable_pagetable(d)
+#define sync_pagetable_state(d) \
+ do { \
+ LOCK_BIGLOCK(d); \
+ cleanup_writable_pagetable(d); \
+ UNLOCK_BIGLOCK(d); \
+ } while ( 0 )
int audit_adjust_pgtables(struct domain *d, int dir, int noisy);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|