[lkml]   [2006]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 0/7] KVM: Kernel-based Virtual Machine
Muli Ben-Yehuda wrote:
> Hi,
> Looks pretty interesting! some comments:
> - patch 4/7 hasn't made it to the list?

Probably too big. It's also the ugliest. I'll split it and resend (not
through thunderbird though... ate all my tabs!).

> - it would be useful for reviewing this if you could post example code
> making use of the /dev/kvm interfaces - they seem fairly complex.

Working code is fairly hairy, since it's emulating a PC. That'll be on
sourceforge once they approve my new project.

In general one does

ioctl(KVM_SET_MEMORY_REGION) for main memory
ioctl(KVM_SET_MEMORY_REGION) for the framebuffer
ioctl(KVM_CREATE_VCPU) for the obvious reason
if (debugger)
ioctl(KVM_DEBUG_GUEST) to singlestep or breakpoint the guest
while (1) {
switch (exit reason) {
handle mmio, I/O etc. might call
ioctl(KVM_INTERRUPT) to queue an external interrupt
ioctl(KVM_{GET,SET}_{REGS,SREGS}) to query/modify registers
ioctl(KVM_GET_DIRTY_LOG) to see which guest memory pages
have changed
I have some simple test code, I'll clean it up and post it.

> - why do it this way rather than through a virtual machine monitor
> such as Xen? what do you gain from having the virtual machines
> encapsulated as Linux processes?

- architectural simplicity: instead of splitting memory management and
scheduling between Xen and domain 0, use just the Linux memory
management and scheduler
- use standard tools (top(1), kill(1)) and security model (permissions
on /dev/kvm)
- much smaller codebase (although paravirtualization is not included (yet))
- no changes to core code
- easy to upgrade an existing system
- easier for drive-by virtualization (modprobe kvm; do-your-stuff;
ctrl-C; rmmod kvm)
- longer term, better performance since there's no need to switch to
domain 0 for I/O (instead just switch to user mode of the VM's process)
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-10-19 20:03    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean