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

Re: [Xen-devel] Could Xen hyperviosr be able to invoke Linux systemcalls?

On Tue, Aug 18, 2015 at 3:25 AM Dario Faggioli <dario.faggioli@xxxxxxxxxx> wrote:
On Mon, 2015-08-17 at 00:55 +0000, Kun Cheng wrote:
> On Mon, Aug 17, 2015 at 12:16 AM Frediano Ziglio <freddy77@xxxxxxxxx>
> What I'm planing is adding page migration support for NUMA aware
> scheduling. In such a case the most time I'll be dealing with Xen's
> memory management & scheduling part to make relevant pages migrate to
> another node with their VCPU. However, Linux kernel has already
> implemented some basic mechanisms so the whole work would be better by
> leveraging the kernel's existing code or functions.
No, not at all. As you figured (or at least had intuition about)
yourself, Xen does run below Linux. Actually, it runs below any guest,
including Dom0, which is a special guest but still a guest, and can even
not be a Linux guest.

So there's no code sharing, or no mechanism to invoke Linux code and
have it affect Xen's scheduling or memory management (and never will
be :-P).

Thank you Dario and Frediano.

Not being able to share the existing kernel mechanism is some kind of frustrating......But just as you said it's the point of virtualization. And now I gain a better understanding why you said it would be tough ;) Â (I start to envy KVM guys, LOL)
> More specifically, I want to confirm that could we use the code or
> functions in linux kernel to assist the hypervisor?
No, it's the other way around.

> My guess is not because in my understanding xen hypervisor lies under
> the linux kernel, i.e. dom0's kernel.

> Given that Dom0 is a special domain, if I want to manage & move all
> the machine memory pages, can the kernel be helpful?
The Dom0 kernel doesn't know anything about the memory of other guest.
It basically doesn't even know that they exist... That's the point of
virtualization, isn't it?
Also Linux's and Xen's scheduling and memory management are so different
(and that's by design) that, even for similar (or the same) feature, the
implementation will be different anyway, so sharing the code won't help
at all.

> Hmm, "change the memory from dom0" means we can control the VM's
> memory by using a config file or xl command right?
"changing the memory from dom0" means something like "the dom0 can ask
Xen, via toolstack, to do something to the memory of other guests",
i.e., it has enough privileges to do that, but that's it.

> What if we goes to the code level? I'm really confused now. Is Xen's
> memory management complemented all by itsself or does it also receive
> help from the kernel?
As said, Xen doesn't even know what kernel is actually running in the
various guest, including dom0, and things should remains that way,
especially for core things like scheduling and memory management.

So, in summary, what you're after should be achieved entirely inside
Xen. It is possible than, in the PV guest case, you'd need some help
from the guest. However, that would be in the form of "Xen
asking/forcing the guest to do something on the *guest* *itself*", not
in the form of "Xen asking dom0 to do something on Xen's own
memory/scheduling or (directly) on other guests' memory".

Hope this helps clearing things out for you. :-)

At this point I still have other plans. But 'asking the guest to do something on the guest itself' sounds like exposing the virtual NUMA topology to the guest (vNUMA). I wrote this email because hypervisor is responsible to allocate machine memory for each guest. Then, in a PV case there are P2M and M2P to help address translation (and shadow page tables in HVMs). So what first came to my mind was hypervisor should move the pages for guests and then P2M things should better be renewed somehow. However inside a guest domain, its OS can only manage the guest physical memory, which I don't think is able to be moved to another node by itself.


<<This happens because I choose it to happen!>> (Raistlin Majere)
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Maybe I misunderstood you words... 'asking the guest to do something on the guest itself' confuses me a bit, could you explain more details of your thought if it's convenient for you?

Thank you,
Xen-devel mailing list



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