Re: [PATCH 2/3] Add a vcpu_migrated statistic

Avi Kivity
2007-03-03T08:58:04Z

Leonard Norrgard wrote:
> The previous patch introduces an IPI on every vcpu migration on SMP
> machines to find out the TSC value on the previous cpu. We might be
> able to avoid this IPI on systems that have a synchronized TSC by
> checking for it in svm/vmx_vcpu_load:
>
> + /* If this isn't the first vcpu_load and if the TSC
> + doesn't run at a constant rate, we must handle TSC
> + offsets. */
> + if (vcpu->cpu != -1
> + && !boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) {
>
> Wether this is actually reliable and working in the intended way is
> not know yet.

Reading the documentation for X86_FEATURE_CONSTANT_TSC, I'm not sure either.

> In the meantime, introduce a statistic for vcpu
> migration, so we get some decision support for the needs for such an
> optimization.
>
>

The statistic is great (vcpu migrations are very expensive, we should
know when they happen), but why two unrelated changes in a patch? I
think you can drop the constant tsc optimization for now, given we
aren't certain it works as we expect.

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.