Clean up around domain init/destroy.

Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2007-05-30 17:47:00 +01:00
1 parent d3f7f10c42
commit 603d6a3905
4 files changed
+28 -29

No files matched your search

+12 -14
View File
@@ -343,6 +343,8 @@ int vcpu_initialise(struct vcpu *v)
struct domain *d = v->domain;
int rc;
v->arch.vcpu_info_mfn = INVALID_MFN;
v->arch.flags = TF_kernel_mode;
pae_l3_cache_init(&v->arch.pae_l3_cache);
@@ -384,6 +386,11 @@ void vcpu_destroy(struct vcpu *v)
{
if ( is_pv_32on64_vcpu(v) )
release_compat_l4(v);
unmap_vcpu_info(v);
if ( is_hvm_vcpu(v) )
hvm_vcpu_destroy(v);
}
int arch_domain_create(struct domain *d)
@@ -489,17 +496,8 @@ int arch_domain_create(struct domain *d)
void arch_domain_destroy(struct domain *d)
{
struct vcpu *v;
for_each_vcpu ( d, v )
unmap_vcpu_info(v);
if ( is_hvm_domain(d) )
{
for_each_vcpu ( d, v )
hvm_vcpu_destroy(v);
hvm_domain_destroy(d);
}
paging_final_teardown(d);
@@ -752,14 +750,14 @@ unmap_vcpu_info(struct vcpu *v)
struct domain *d = v->domain;
unsigned long mfn;
if ( v->vcpu_info_mfn == INVALID_MFN )
if ( v->arch.vcpu_info_mfn == INVALID_MFN )
return;
mfn = v->vcpu_info_mfn;
mfn = v->arch.vcpu_info_mfn;
unmap_domain_page_global(v->vcpu_info);
v->vcpu_info = shared_info_addr(d, vcpu_info[v->vcpu_id]);
v->vcpu_info_mfn = INVALID_MFN;
v->arch.vcpu_info_mfn = INVALID_MFN;
put_page_and_type(mfn_to_page(mfn));
}
@@ -781,7 +779,7 @@ map_vcpu_info(struct vcpu *v, unsigned long mfn, unsigned offset)
if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
return -EINVAL;
if ( v->vcpu_info_mfn != INVALID_MFN )
if ( v->arch.vcpu_info_mfn != INVALID_MFN )
return -EINVAL;
/* Run this command on yourself or on other offline VCPUS. */
@@ -805,7 +803,7 @@ map_vcpu_info(struct vcpu *v, unsigned long mfn, unsigned offset)
memcpy(new_info, v->vcpu_info, sizeof(*new_info));
v->vcpu_info = new_info;
v->vcpu_info_mfn = mfn;
v->arch.vcpu_info_mfn = mfn;
/* Set new vcpu_info pointer /before/ setting pending flags. */
wmb();
+13 -14
View File
@@ -69,19 +69,6 @@ struct domain *alloc_domain(domid_t domid)
void free_domain(struct domain *d)
{
struct vcpu *v;
int i;
for ( i = MAX_VIRT_CPUS-1; i >= 0; i-- )
{
if ( (v = d->vcpu[i]) == NULL )
continue;
vcpu_destroy(v);
sched_destroy_vcpu(v);
free_vcpu_struct(v);
}
sched_destroy_domain(d);
xfree(d);
}
@@ -136,7 +123,6 @@ struct vcpu *alloc_vcpu(
v->domain = d;
v->vcpu_id = vcpu_id;
v->vcpu_info_mfn = INVALID_MFN;
v->runstate.state = is_idle_vcpu(v) ? RUNSTATE_running : RUNSTATE_offline;
v->runstate.state_entry_time = NOW();
@@ -472,6 +458,17 @@ void domain_pause_for_debugger(void)
static void complete_domain_destroy(struct rcu_head *head)
{
struct domain *d = container_of(head, struct domain, rcu);
struct vcpu *v;
int i;
for ( i = MAX_VIRT_CPUS-1; i >= 0; i-- )
{
if ( (v = d->vcpu[i]) == NULL )
continue;
vcpu_destroy(v);
sched_destroy_vcpu(v);
free_vcpu_struct(v);
}
acm_domain_destroy(d);
@@ -482,6 +479,8 @@ static void complete_domain_destroy(struct rcu_head *head)
arch_domain_destroy(d);
sched_destroy_domain(d);
free_domain(d);
send_guest_global_virq(dom0, VIRQ_DOM_EXC);
+3
View File
@@ -290,6 +290,9 @@ struct arch_vcpu
unsigned long shadow_ldt_mapcnt;
struct paging_vcpu paging;
/* Guest-specified relocation of vcpu_info. */
unsigned long vcpu_info_mfn;
} __cacheline_aligned;
/* shorthands to improve code legibility */
-1
View File
@@ -75,7 +75,6 @@ struct vcpu
int processor;
vcpu_info_t *vcpu_info;
unsigned long vcpu_info_mfn;
struct domain *domain;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.