RE: [RFC PATCH 0/2] KVM: VMX: Fix VM entry failure on PT_MODE_HOST_GUEST while host is using PT
From: Wang, Wei W
Date: Mon Sep 19 2022 - 11:24:46 EST
On Monday, September 19, 2022 10:41 PM, Liang, Kan wrote:
> Another fake event? We have to specially handle it in the perf code. I don't
> think it's a clean way for perf.
We can check the patch later. I think it should be clean, like the LBR side.
>
> > - on VMEnter:
> > -- perf_disable_event_local(host_event);
> > -- perf_enable_event_local(guest_event);
> > - on VMExit:
> > -- perf_disable_event_local(guest_event);
> > -- perf_enable_event_local(host_event);
>
> Why we cannot use the same way as the perf core driver to switch the MSRs in
> the VMCS?
The current MSR switching list from VMCS isn’t fast,
should be the last resort when really necessary.
>
> You just need one generic function, perf_guest_get_msrs(), for both PT and
> core driver. If you have to disable PT explicitly before VMCS, I think you can do
> it in the PT specific perf_guest_get_msrs().
The disable is done via " Clear IA32_RTIT_CTL" VMExit control.
It can ensure PT disabled in time on VMExit, so no need to go through perf_guest_get_msrs.
Thanks,
Wei