vCPUs vs Guest OSs

97 views
Skip to first unread message

Anders Kallerdahl

unread,
May 29, 2018, 11:15:56 AM5/29/18
to xvisor...@googlegroups.com
Hi,

I am trying to understand the relation between vCPU and Guest OSs for the Xvisor.
My understanding is that a vCPU is self-contained in terms of Registers, Scheduler, interrupts, etc.
The design document indicates that a Guest OS can have more than one vCPU.

What would be the use-case for a Guest OS with more than one vCPU? Is the only use-case to virtualize OS that support multi-CPU (as opposed to multi-core)?

regards,
Anders

Anup Patel

unread,
May 30, 2018, 3:09:57 AM5/30/18
to Xvisor Devel
Hi Andres,

Guest is the term used for a Virtual Machine (VM) whereas Guest OS is
the term used for SW (Kernel + User space) running inside a Guest/VM.

A Guest/VM is resembles a real world system which is capable of
running an operating system. A real world system tend to have multiple
CPUs so even Guest/VM can have multiple VCPUs.

Having multiple VCPUs for a Guest/VM can be helpful if the SW running
on Guest/VM requires more compute power.

For example, let's say we have multi-core host system on which Xvisor
is running. If a Guest/VM running on Xvisor have just one VCPU then
Guest/VM cannot get compute power more than one core (assuming VCPU is
pinned to a particular core). Now if SW running on Guest requires
compute power beyond one core then we give multiple VCPUs to the
Guest and pin each VCPU to separate host core.

Regards,
Anup
> --
> You received this message because you are subscribed to the Google Groups
> "Xvisor Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to xvisor-devel...@googlegroups.com.
> Visit this group at https://groups.google.com/group/xvisor-devel.
> For more options, visit https://groups.google.com/d/optout.

Anders Kallerdahl

unread,
May 30, 2018, 11:54:21 AM5/30/18
to xvisor...@googlegroups.com
Hi Anup,

thanks for the clarification.

So vCPU can only be mapped to one Core?
And from this model point of view a CPU does not really exists? (i mean, the vCPU maps directly to the core)

Let me give an theoretical example. Lets assume we  have a Cortex A57 with 8 cores.
I have one Android OS and one Linux OS and one FreeRTOS
I want to give power to Android and therefore it will need 4 cores
the Linux 3 cores
FreeRtos 1 core
Android will be mapped to 4 vCPUs, Linux to 3 vCPUs, and FreeRTOS to 1 vCPU?

Another example would be if we have a borad with 2 Cortex A57 with 4 cores each.
This exemplifies my second question above.
Does it make sense to map for example Android OS to 2 CPUs (4 cores on one CPU, and 2 cores on the other CPU). And then Linux on the two left over cores on the second CPU?
Or this use-case is not in scope of the Xvisor?

regards,
Anders






> Visit this group at https://groups.google.com/group/xvisor-devel.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Xvisor Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xvisor-devel+unsubscribe@googlegroups.com.

Anup Patel

unread,
May 30, 2018, 12:23:44 PM5/30/18
to Xvisor Devel
Hi Anders,

Please see my reply inline below...

On Wed, May 30, 2018 at 9:24 PM, Anders Kallerdahl <and...@kallerdahl.se> wrote:
> Hi Anup,
>
> thanks for the clarification.
>
> So vCPU can only be mapped to one Core?

Generally but not necessary. If we have fewer cores in underlying host
system then
we endup running multiple VCPUs on same host core.

> And from this model point of view a CPU does not really exists? (i mean, the
> vCPU maps directly to the core)

Xvisor manages the host cores. In fact, Xvisor is a SMP kernel itself.

When designing Guest/VM, we should only consider the requirements of the
SW that is going to run on Guest/VM. In other words, come up with right
sized Guests/VMs for your use-case and then fit Guests/VMs on your host
system.

>
> Let me give an theoretical example. Lets assume we have a Cortex A57 with 8
> cores.
> I have one Android OS and one Linux OS and one FreeRTOS
> I want to give power to Android and therefore it will need 4 cores
> the Linux 3 cores
> FreeRtos 1 core
> Android will be mapped to 4 vCPUs, Linux to 3 vCPUs, and FreeRTOS to 1 vCPU?

Yes, here your Guests/VMs easily get separate host cores because underlying
host system has total 8 cores.

>
> Another example would be if we have a borad with 2 Cortex A57 with 4 cores
> each.
> This exemplifies my second question above.
> Does it make sense to map for example Android OS to 2 CPUs (4 cores on one
> CPU, and 2 cores on the other CPU). And then Linux on the two left over
> cores on the second CPU?
> Or this use-case is not in scope of the Xvisor?
>

Xvisor is not restricted in anyway by number of cores and clusters in underlying
host system. Users are free to come-up with variety of configuration. The most
important performance tuning in real-life system would be how Guests/VMs are
pinned to different host cores considering cache hierarchies and clusters.

In second example, what I understood is that you have host system with
2 clusters where each cluster has 4 cores. Now if you assign Android OS
2 cores from each cluster then certainly Android OS will get better performance
because it will use L2-cache of both clusters. But this will be at cost of
Linux OS and FreeRTOS because they will be sharing L2-cache with
Android OS on both clusters. Again, there is no restriction from Xvisor
side for this configuration.

We should consider fairness in sharing of caches when coming-up core
assignments for Guests/VMs so that overall system performance remains
good in all conditions.

Regards,
Anup
Reply all
Reply to author
Forward
0 new messages