I was looking into the perf code to enable PEBS sampling for KVM guest. While registering perf_event_attr, I have set exclude_guest = 0 and exclude_host = 1. With this setting I am not receiving any PEBS samples.
After digging into the kernel code, I have found that, in add_atomic_switch_msr function, MSR_IA32_PEBS_ENABLE is being set to 0.
It also states that, "PEBS needs a quiescent period after being disabled (to write a record). Disabling PEBS through VMX MSR swapping doesn't provide that period, so a CPU could write host's record into guest's memory."
Is it possible to enable the PEBS for guest while keeping the host PEBS disabled?