Hi

I was using oprofile to measuring hardware events in Guest, I have turn
on the cpu host-passthrough mode, but it seems that oprofile can get only
one sample.I added some debug info and found that problem is with the
perf_event's sample_period.

host's workflow is:

set counter MSR: set sample_period
  |
create perf_event (first time, sample_period is right)
  |
overflow
  |
release perf_event
  |
create perf_event (sample_period not reset)
  |
set counter MSR: set sample_period (this should be done before create 
perf_event)

I think this is because oprofile doesn't disable pmu and then enable it,
it only reset PMU counter MSR, while this will not reprogram perf_event.
After add the code below to ppro_check_ctrs, oprofile works in guest.

wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
{
    ......
    // reset counter msr
    ......
}
wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0x70000000f);

But I think the better way is to change VPMU mechanism. When set counter msr,
it was needed to reprogram counter as well.
-- 
Thanks
Wang Hui
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to