kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Oprofile doesn't work well in Guest with VPMU
@ 2014-03-30  1:37 Wang Hui
  0 siblings, 0 replies; only message in thread
From: Wang Hui @ 2014-03-30  1:37 UTC (permalink / raw)
  To: Gleb Natapov, kvm

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-30  1:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-30  1:37 Oprofile doesn't work well in Guest with VPMU Wang Hui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).