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-users

RE: [Xen-users] VCPU and CPU Manipulation

To: "'Omer Khalid'" <Omer.Khalid@xxxxxxx>, "'xen-users list'" <xen-users@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-users] VCPU and CPU Manipulation
From: "Dustin Henning" <Dustin.Henning@xxxxxxxxxxx>
Date: Mon, 6 Oct 2008 08:51:50 -0400
Cc:
Delivery-date: Mon, 06 Oct 2008 05:52:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <77e5896b0810060151n3a93ff7ei2c40fb8c4cc2bfda@xxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Organization: PRD, Inc.
References: <77e5896b0810060151n3a93ff7ei2c40fb8c4cc2bfda@xxxxxxxxxxxxxx>
Reply-to: Dustin.Henning@xxxxxxxxxxx
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcknkMdYtnNVwRtMS52skPPyj7FNywAHeu0w
Omer,
        See my response following your initial post.

--------Original Message--------
From: xen-users-bounces@xxxxxxxxxxxxxxxxxxx 
[mailto:xen-users-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Omer Khalid
Sent: Monday, October 06, 2008 04:51
To: xen-users list
Subject: [Xen-users] VCPU and CPU Manipulation

Hi,
I have a dual core SMP machine ( in total 4 cores). I have been trying to set 
restrict vcpu/cpus for my domU to one core/one vpcu but it have not fully 
worked. As there are two commands "xm vcpu-set" and "xm vcpu-pin". By using 
these commands, i have observed that the sequence in which they are used plays 
a role. e.g. I have the following state in the beginning:
[root@lxb ~]# xm vcpu-list
Name         ID     VCPUs CPU   State Time(s)      CPU Affinity
====         ==     ===== ====  ==== ======     === =====
Domain-0    0       0          3        r--      5593.4        any cpu
Domain-0    0       1          1        -b-     15361.9      any cpu
Domain-0    0       2          0        -b-     10137.5      any cpu
Domain-0    0       3          -         --p     78.9           any cpu
test_lxb      20     0          2         -b-     21169.0     any cpu
What I want to achieve is that my domU (test_lxb) uses one VCPU pinned to one 
CPU. In the above state, both my domU and dom0 are using VCPU 0 (which is 
pinned to use either CPU 3 or 2.) After few "vcpu-set" and "vcpu-pin", I reach 
the following stage where dom0 is pinned to CPU 3 and domU (test_lxb) is pinned 
to CPU 2:
[root@lxb ~]# xm vcpu-list
Name ID VCPUs CPU State Time(s) CPU Affinity
Name         ID     VCPUs CPU   State Time(s)      CPU Affinity
====         ==     ===== ====  ==== ======     ========
Domain-0    0       0         3        r--      5600.4            3
Domain-0    0       1         3        -b-     15372.5           3
Domain-0    0       2         3        -b-     10140.0           3
Domain-0    0       3         -         --p     78.9                3
test_lxb      20     0         2         -b-     21169.5           2 
But domU is still using VCPU 0 which is also used by my domU; now i would like 
to restrict VCPU 0 to CPU 2 only for domU only...I am wondering how to achieve 
this last mile?
Any ideas? Thanks for you help in advance!
Regards
-- 
Omer

-------------------------------------------------------
CERN -- European Organization for Nuclear
Research, IT Department, CH-1211, 
Geneva 23, Switzerland

        You have misinterpreted the meaning VCPU numbers.  VCPU 0 is the first 
virtual CPU for any domain, VCPU 1 is the second virtual CPU for any domain, 
etcetera.  Additional single VCPU domUs will have a VCPU 0 as well.  Each VCPU 
0 is actually a separate VCPU; they are all identified as CPU 0 to a different 
domain, and the VCPU identification just tells you what the domU sees them as 
(minus the V).  CPU indicates which CPU/core a VCPU is currently using, and CPU 
Affinity indicates which ones it is allowed to use.  Furthermore, for 
performance reasons, if you want Dom0 to only use one CPU/core, you should 
assign it only one VCPU (which will be 0, so for what you are trying to do, you 
probably ultimately want output more like this):

Name            ID      VCPU    CPU     State   Time(s) CPU Affinity
Domain-0        0       0       0       r--     5600.4  0
test_lxb        1       0       1       -b-     21169.5 1
test_abc        2       0       2       -b-     21169.5 2
test_def        3       0       3       -b-     21169.5 3

        Obviously state and time will be variable.  Additionally, which 
core/cpu is used for which domain shouldn't matter much.  Regarding getting to 
this state, the number of VCPUs dom0 has initially (and which CPUs/cores they 
use) is configurable (probably /etc/xen/xend-config).  The same is true for 
domUs.  That said, see the example configs in /etc/xen for more info on how to 
do this, but you should be able to cause each domU to start up with the 
CPU/core you want it to use, and then you won't really need to use vcpu-set or 
vcpu-pin.  Finally, if I don't bring it up, someone else probably will, the 
idea behind virtualization is to better use available processing power.  With 
that in mind, your domUs may not each need their own full CPU/core.  (For 
instance, I have a quad-core with four HVMs that have one vcpu each, where each 
uses a separate core, and then my dom0 has four VCPUs, where each uses a 
separate core; even this isn't by any means fully utilizing the hardware, but I 
am more concerned with maintaining optimal performance of my HVMs).  Good luck 
with your project,
        Dustin



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

<Prev in Thread] Current Thread [Next in Thread>