On Mon, Nov 09, 2020 at 10:12:41AM +0800, Like Xu wrote: > With PEBS virtualization, the PEBS records get delivered to the guest, > and host still sees the PEBS overflow PMI from guest PEBS counters. > This would normally result in a spurious host PMI and we needs to inject > that PEBS overflow PMI into the guest, so that the guest PMI handler > can handle the PEBS records. > > Check for this case in the host perf PEBS handler. If a PEBS overflow > PMI occurs and it's not generated from host side (via check host DS), > a fake event will be triggered. The fake event causes the KVM PMI callback > to be called, thereby injecting the PEBS overflow PMI into the guest. > > No matter how many guest PEBS counters are overflowed, only triggering > one fake event is enough. The guest PEBS handler would retrieve the > correct information from its own PEBS records buffer. > > If the counter_freezing is disabled on the host, a guest PEBS overflow > PMI would be missed when a PEBS counter is enabled on the host side > and coincidentally a host PEBS overflow PMI based on host DS_AREA is > also triggered right after vm-exit due to the guest PEBS overflow PMI > based on guest DS_AREA. In that case, KVM will disable guest PEBS before > vm-entry once there's a host PEBS counter enabled on the same CPU.
How does this guest DS crud work? DS_AREA is a host virtual address; ISTR there was lots of fail trying to virtualize it earlier. What's changed? There's 0 clues here. Why are the host and guest DS area separate, why can't we map them to the exact same physical pages?