[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [question] bug in cpu_schedule_up?



On Wed, 2012-01-18 at 08:13 +0000, Kai Huang wrote:
> Hi,
> 
> I see below code in cpu_schedule_up in xen-unstable hg repository
> (xen/common/schedule.c).
> 
>     if ( idle_vcpu[cpu] == NULL )
>         alloc_vcpu(idle_vcpu[0]->domain, cpu, cpu);
>     if ( idle_vcpu[cpu] == NULL )
>         return -ENOMEM;
> 
> Seems it's a bug? Should be like this?
> 
>     if ( idle_vcpu[cpu] == NULL )
>         idle_vcpu[cpu] = alloc_vcpu(idle_vcpu[0]->domain, cpu, cpu);
>     if ( idle_vcpu[cpu] == NULL )
>         return -ENOMEM;

alloc_vcpu will set idle_vcpu[0]->domain->vcpu[cpu] to the newly
allocated vcpu. idle_vcpu[0]->domain == idle_domain and
idle_vcpu[0]->domain->vcpu == idle_vcpu (both are by construction in
scheduler_init). Therefore idle_vcpu[cpu] is already being set inside
alloc_vcpu.

The return value of alloc_vcpu is to save code which wants a local
handle on the newly allocated vcpu to perform further setup from doing
the lookup itself.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.