Re: SMP guest boots

Li, Xin B
2007-06-14T01:52:02Z

>Li, Xin B wrote:
>> I've just got x86_64 Linux 2.6.20.3 SMP guest boots on KVM
>with 2 vCPUs
>> (I'm using a x86_64 RHEL5 image but the RHEL5 kernel can't boot.),
>>
>
>I found that an issue with x86-64 is that the mmu picks up an nx shadow

>page for a non-nx guest pte. This is unrelated to smp, but only shows
>up there. It is easily fixed but meanwhile a workaround is to disable
>nx in cpuid.
>
>I have a patch for userspace which does the following:
>
>- set up a kvm main loop outside vl.c and cpu-exec.c.
>- disable signals on ap threads, so that timer and network signals are
>only handled on vcpu 0

I prefer to have a separate thread in qemu to execute asynchronous
logic, like the PIC/IOAPIC code.

>- set up locking so that qemu code is never executed on more than one
thread

Each vCPU has a corresponding thread and can do synchronous IOs, like
IN/OUT and MMIO to a device in DM, basically we don't need lock or
serialize since guest OS device driver should guarantee device access
won't happen on more than one CPU if that's not allowed. For a bad OS,
it just kills its VM, or we may need to serialize accesses to the same
device by using a device only lock. Totally we will have CPU# plus 1
thread.
By this, we can get the best parallelism.

>- hack qemu's apic so it can sipi and ipi other vcpus

I prefer to keep LAPIC logic in KVM only, IOAPIC logic can be in Qemu
side.