All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Hui <john.whui1985@gmail.com>
To: Gleb Natapov <gleb@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Oprofile doesn't work well in Guest with VPMU
Date: Sun, 30 Mar 2014 09:37:02 +0800	[thread overview]
Message-ID: <5337753E.6040807@gmail.com> (raw)

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

                 reply	other threads:[~2014-03-30  1:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5337753E.6040807@gmail.com \
    --to=john.whui1985@gmail.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.