Re: [PATCH v1 4/4] KVM/vmx: enable lbr for the guest

From: Wei Wang
Date: Mon Sep 25 2017 - 08:53:57 EST


On 09/25/2017 05:16 PM, Paolo Bonzini wrote:
On 25/09/2017 06:44, Wei Wang wrote:
Passthrough the LBR stack to the guest, and auto switch the stack MSRs
upon VMEntry and VMExit.

Signed-off-by: Wei Wang <wei.w.wang@xxxxxxxxx>
This has to be enabled separately for each guest, because it may prevent
live migration to hosts with a different family/model.

Did you mean trapping MSR_IA32_DEBUGCTLMSR, instead of passing through it?
In that case, we would also need to modify the kernel driver (i.e. the PMI handler)
to check MSR_IA32_DEBUGCTLMSR before reading the LBR MSRs. Then the guest
driver can notice that the feature that is in use has been disabled after live
migration.

This kind of live migration disables features that are being used. Would it be
common in real usage to migrate between different CPU models?

I think this issue isn't specific to the LBR feature. May I know how would other
features be handled in this case? Thanks.

On the other hand, an alternative approach coming up to my mind is that we
can do some kind of feature negotiation at the very beginning of migration, and
fails live migration if the feature negotiation fails.


Best,
Wei