domain: skip more stuff for idle's vCPU-s in vcpu_create()
PATCH 1/1 domain: skip more stuff for idle's vCPU-s in vcpu_create()
Nothing hypercall-related needs setting up there. Nor do we need to check whether the idle domain is shutting down - it never will.
---
For vmtrace_alloc_buffer() adding the conditional may be questionable: The function checks d->vmtrace_size first thing, bailing immediately when it's zero (which it always will be for the idle domain).
xen/common/domain.c +9 -8
@@ -427,12 +427,6 @@ struct vcpu *vcpu_create(struct domain * v->vcpu_id = vcpu_id; v->dirty_cpu =VCPU_CPU_CLEAN ; -rwlock_init (&v->virq_lock); - -tasklet_init (&v->continue_hypercall_tasklet,NULL ,NULL ); - -grant_table_init_vcpu (v); -if (is_idle_domain (d) ) { v->runstate.state = RUNSTATE_running;
@@ -440,6 +434,12 @@ struct vcpu *vcpu_create(struct domain * }else { +rwlock_init (&v->virq_lock); + +tasklet_init (&v->continue_hypercall_tasklet,NULL ,NULL ); + +grant_table_init_vcpu (v); + v->runstate.state = RUNSTATE_offline; v->runstate.state_entry_time =NOW ();set_bit (_VPF_down, &v->pause_flags);
@@ -450,7 +450,7 @@ struct vcpu *vcpu_create(struct domain *if (sched_init_vcpu (v) !=0 ) goto fail_wq; -if (vmtrace_alloc_buffer (v) !=0 ) +if ( !is_idle_domain (d) &&vmtrace_alloc_buffer (v) !=0 ) goto fail_wq;if (arch_vcpu_create (v) !=0 )
@@ -468,7 +468,8 @@ struct vcpu *vcpu_create(struct domain * }/* Must be called after making new vcpu visible to for_each_vcpu(). */ -vcpu_check_shutdown (v); +if ( !is_idle_domain (d) ) +vcpu_check_shutdown (v);return v;
Quoted 8 lines · Jan Beulich
Nothing hypercall-related needs setting up there. Nor do we need to check whether the idle domain is shutting down - it never will.
Signed-off-by Jan Beulich <[email protected]>---
Forvmtrace_alloc_buffer()adding the conditional may be questionable: The function checksd->vmtrace_sizefirst thing, bailing immediately when it's zero (which it always will be for the idle domain).
Oh, I notice this now (after having written the comment below). I would then add a comment rather than the extra check. And possibly an ASSERT(!is_idle_domain(d)); inside of vmtrace_alloc_buffer() after the vmtrace_size check.
Quoted 29 lines
xen/common/domain.c +6
-6@@ -427,12 +427,6 @@ struct vcpu *vcpu_create(struct domain * v->vcpu_id = vcpu_id; v->dirty_cpu =VCPU_CPU_CLEAN ; -rwlock_init (&v->virq_lock); - -tasklet_init (&v->continue_hypercall_tasklet,NULL ,NULL ); - -grant_table_init_vcpu (v); -if (is_idle_domain (d) ) { v->runstate.state = RUNSTATE_running;@@ -440,6 +434,12 @@ struct vcpu *vcpu_create(struct domain * }else { +rwlock_init (&v->virq_lock); + +tasklet_init (&v->continue_hypercall_tasklet,NULL ,NULL ); + +grant_table_init_vcpu (v); + v->runstate.state = RUNSTATE_offline; v->runstate.state_entry_time =NOW ();set_bit (_VPF_down, &v->pause_flags);
xen/common/domain.c struct vcpu *vcpu_create(struct domain * · line 454
Quoted 6 lines
xen/common/domain.c +1
-1@@ -450,7 +450,7 @@ struct vcpu *vcpu_create(struct domain *if (sched_init_vcpu (v) !=0 ) goto fail_wq; -if (vmtrace_alloc_buffer (v) !=0 ) +if ( !is_idle_domain (d) &&vmtrace_alloc_buffer (v) !=0 ) goto fail_wq;
There's an existing issue here, the usage of fail_rq is wrong here. It should use fail_sched instead. However I wonder whether we want to move the vmtrace_alloc_buffer() call inside the existing else { branch of the is_idle_domain() condition, as to avoid this extra is_idle_domain() check here?
Thanks, Roger.
Quoted 10 lines · Roger Pau Monné
Quoted 8 lines · Jan Beulich
Nothing hypercall-related needs setting up there. Nor do we need to check whether the idle domain is shutting down - it never will.
Signed-off-by Jan Beulich <[email protected]>---
Forvmtrace_alloc_buffer()adding the conditional may be questionable: The function checksd->vmtrace_sizefirst thing, bailing immediately when it's zero (which it always will be for the idle domain).
Quoted 4 lines
Oh, I notice this now (after having written the comment below). I would then add a comment rather than the extra check. And possibly an ASSERT(!is_idle_domain(d)); inside of
vmtrace_alloc_buffer()after thevmtrace_sizecheck.
Hmm, we could move the call anyway, as you ...
Quoted 4 lines
Quoted 4 lines
xen/common/domain.c +0
-0@@ -450,7 +450,7 @@ struct vcpu *vcpu_create(struct domain *if (sched_init_vcpu (v) !=0 ) goto fail_wq;
Quoted 9 lines
xen/common/domain.c struct vcpu *vcpu_create(struct domain * · line 454
Quoted 3 lines
xen/common/domain.c +1
-1-if (vmtrace_alloc_buffer (v) !=0 ) +if ( !is_idle_domain (d) &&vmtrace_alloc_buffer (v) !=0 ) goto fail_wq;There's an existing issue here, the usage of
fail_rqis wrong here. It should usefail_schedinstead. However I wonder whether we want to move thevmtrace_alloc_buffer()call inside the existingelse {branch of theis_idle_domain()condition, as to avoid this extrais_idle_domain()check here?
... suggest here, thus dealing with the wrong label use at the same time. Since this change will want backporting, I guess I'll move that to a separate patch, though. (I don't think I'll bother with adding an assertion in the function.)
Jan