Re: VM performance issue in KVM guests.

From: Avi Kivity
Date: Sat Apr 17 2010 - 15:03:16 EST


On 04/16/2010 05:27 AM, Zhang, Xiantao wrote:


When vcpus are pinned to pcpus, there is a 50% chance that a guest's
vcpus will be co-scheduled and spinlocks will perform will.

When vcpus are not pinned, but affine wakeups are disabled, there is a
33% chance that vcpus will be co-scheduled.

When vcpus are not pinned and affine wakeups are enabled there is a 0%
chance that vcpus will be co-scheduled.

Keeping both vcpus on the same core actually makes sense since they
can communicate through the local cache faster than across cores.
What we need is to make sure that they don't spin.

Windows 2008 can report spinlock spinning through a hypercall. Can
you hook to that interface and see if it happens regularly?
Altenatively use a PLE capable host and trace the kvm_vcpu_on_spin()
function.
We only tried windows 2003 for the experiments, and have no data related to windows 2008.
But maybe we can have a try later. Anyway, the key point is we have to enhance the scheduler to let it
Know which threads are vcpu threads to avoid perf loss in this case.

I have two worries about this approach:

1. Affine wakeups were introduced for a reason; if we disable them (even just for vcpus), we lost something. Maybe we can tune the mechanism not to fail, instead of disabling it.

2. Affine wakeups are a scheduler internal detail. How do we explain what it does? the scheduler may not have affine wakeups in a few years, yet we'll have an ABI to disable them.

--
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/