On Mon, Jul 08, 2019 at 09:23:17AM +0800, Wei Wang wrote:
When the vCPU is scheduled in:I don't understand a word of that.
- if the lbr feature was used in the last vCPU time slice, set the lbr
stack to be interceptible, so that the host can capture whether the
lbr feature will be used in this time slice;
- if the lbr feature wasn't used in the last vCPU time slice, disable
the vCPU support of the guest lbr switching.
Upon the first access to one of the lbr related MSRs (since the vCPU was
scheduled in):
- record that the guest has used the lbr;
- create a host perf event to help save/restore the guest lbr stack;
- pass the stack through to the guest.
Who cares if the LBR MSRs are touched; the guest expects up-to-date
values when it does reads them.