Re: [PATCH 4/4] kvm: Implement PEBS virtualization

From: Paolo Bonzini
Date: Thu Jun 19 2014 - 10:43:30 EST


Il 10/06/2014 23:06, Marcelo Tosatti ha scritto:
> BTW how about general PMU migration? As far as I can tell there
> is no code to save/restore the state for that currently, right?

Paolo wrote support for it, recently. Paolo?

Yes, on the KVM side all that is needed is to special case MSR reads and writes that have side effects, for example:

case MSR_CORE_PERF_GLOBAL_STATUS:
if (msr_info->host_initiated) {
pmu->global_status = data;
return 0;
}
break; /* RO MSR */
case MSR_CORE_PERF_GLOBAL_OVF_CTRL:
if (!(data & (pmu->global_ctrl_mask & ~(3ull<<62)))) {
if (!msr_info->host_initiated)
pmu->global_status &= ~data;
pmu->global_ovf_ctrl = data;
return 0;
}
break;

Right now this is only needed for writes.

Userspace then can read/write these MSRs, and add them to the migration stream. QEMU has code for that.

Paolo
--
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/