WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] RE: [PATCH] Don't assume the vcpu_id is continous in alloc_v

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] RE: [PATCH] Don't assume the vcpu_id is continous in alloc_vcpu
From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Date: Thu, 12 Nov 2009 23:27:05 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc:
Delivery-date: Thu, 12 Nov 2009 07:27:30 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C721BB9B.19F7A%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C721A2AE.19F60%keir.fraser@xxxxxxxxxxxxx> <C721BB9B.19F7A%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcpjiGc6hZlnMOBYRPSWYjjerzo1vQAA1c0HAAO2138ABCG/kA==
Thread-topic: [PATCH] Don't assume the vcpu_id is continous in alloc_vcpu
Keir Fraser wrote:
> On 12/11/2009 11:31, "Keir Fraser" <keir.fraser@xxxxxxxxxxxxx> wrote:
> 
>>> Currently in alloc_vcpu, it assumes the vcpu is allocated with
>>> vcpu_id is continous. When cpu hot-added, this assumption is broken
>>> because the hot-added CPU may be brougt online by dom0 in arbitrary
>>> order. This patch try to link the new vcpu to the end of the link. 
>>> 
>>> Signed-off-by: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>
>> 
>> Is this something to do with allocating vcpus for the idle domain?
>> 
>> If so, I suggest we just allocate vcpu_ids sequentially on-demand. I
>> can work up a patch for you to test if you like.
> 
> I was wrong, that was a bad idea since idle_vcpu[] is also the
> idle domain's
> vcpu pointer array. Actually I also have been able to revert
> c/s 20045 since
> I was mistaken about that being needed. And I've applied your
> patch as c/s
> 20433, but I rewrote it to keep vcpus in ascending order of
> vcpuid (not sure
> it's necessary really, but it's nice to do).

Thanks for your changes very much.
I just noticed I missed get a lock for this change.
Originally I thought the XEN_DOMCTL_max_vcpus will be synced, but seems no. So 
alloc_vcpu() may have race condition. (for idle_vcpu or dom0, it should be safe 
already)

I'm also wondering if we need take lock at XEN_DOMCTL_max_vcpus, because 
following checking may failed if two hypercall at most same time. Or, we need 
depends on user space tools to keep this synced?
       if ( (d->max_vcpus > 0) && (max > d->max_vcpus) )
            goto maxvcpu_out;

Thanks
Yunhong Jiang
> 
> -- Keir
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel