From: Avi Kivity <avi.kivity@gmail.com>
To: Andi Kleen <andi@firstfloor.org>, peterz@infradead.org
Cc: gleb@kernel.org, pbonzini@redhat.com, eranian@google.com,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 4/4] kvm: Implement PEBS virtualization
Date: Sun, 22 Jun 2014 16:57:13 +0300 [thread overview]
Message-ID: <53A6E0B9.10408@gmail.com> (raw)
In-Reply-To: <1401412327-14810-5-git-send-email-andi@firstfloor.org>
On 05/30/2014 04:12 AM, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> PEBS (Precise Event Bases Sampling) profiling is very powerful,
> allowing improved sampling precision and much additional information,
> like address or TSX abort profiling. cycles:p and :pp uses PEBS.
>
> This patch enables PEBS profiling in KVM guests.
>
> PEBS writes profiling records to a virtual address in memory. Since
> the guest controls the virtual address space the PEBS record
> is directly delivered to the guest buffer. We set up the PEBS state
> that is works correctly.The CPU cannot handle any kinds of faults during
> these guest writes.
>
> To avoid any problems with guest pages being swapped by the host we
> pin the pages when the PEBS buffer is setup, by intercepting
> that MSR.
>
> Typically profilers only set up a single page, so pinning that is not
> a big problem. The pinning is limited to 17 pages currently (64K+1)
>
> In theory the guest can change its own page tables after the PEBS
> setup. The host has no way to track that with EPT. But if a guest
> would do that it could only crash itself. It's not expected
> that normal profilers do that.
>
>
Talking a bit with Gleb about this, I think this is impossible.
First, it's not sufficient to pin the debug store area, you also have to
pin the guest page tables that are used to map the debug store. But
even if you do that, as soon as the guest fork()s, it will create a new
pgd which the host will be free to swap out. The processor can then
attempt a PEBS store to an unmapped address which will fail, even though
the guest is configured correctly.
next prev parent reply other threads:[~2014-06-22 13:57 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-30 1:12 Implement PEBS virtualization for Silvermont Andi Kleen
2014-05-30 1:12 ` [PATCH 1/4] perf: Add PEBS virtualization enable " Andi Kleen
2014-05-30 1:12 ` [PATCH 2/4] perf: Allow guest PEBS for KVM owned counters Andi Kleen
2014-05-30 7:31 ` Peter Zijlstra
2014-05-30 16:03 ` Andi Kleen
2014-05-30 16:17 ` Peter Zijlstra
2014-05-30 1:12 ` [PATCH 3/4] perf: Handle guest PEBS events with a fake event Andi Kleen
2014-05-30 7:34 ` Peter Zijlstra
2014-05-30 16:29 ` Andi Kleen
2014-05-30 1:12 ` [PATCH 4/4] kvm: Implement PEBS virtualization Andi Kleen
2014-05-30 8:21 ` Gleb Natapov
2014-05-30 16:24 ` Andi Kleen
2014-06-02 16:45 ` Gleb Natapov
2014-06-02 16:52 ` Andi Kleen
2014-06-02 19:09 ` Marcelo Tosatti
2014-06-02 19:05 ` Eric Northup
2014-06-02 19:57 ` Andi Kleen
2014-06-19 14:39 ` Paolo Bonzini
2014-06-10 18:04 ` Marcelo Tosatti
2014-06-10 19:22 ` Andi Kleen
2014-06-10 21:06 ` Marcelo Tosatti
2014-06-19 14:42 ` Paolo Bonzini
2014-06-19 17:33 ` Andi Kleen
2014-06-19 20:33 ` Paolo Bonzini
2014-06-22 13:57 ` Avi Kivity [this message]
2014-06-22 19:02 ` Andi Kleen
2014-06-24 16:45 ` Marcelo Tosatti
2014-06-25 7:04 ` Avi Kivity
2014-05-30 7:39 ` Implement PEBS virtualization for Silvermont Peter Zijlstra
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=53A6E0B9.10408@gmail.com \
--to=avi.kivity@gmail.com \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=eranian@google.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.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 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).