From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCHv3 00/10] KVM in-guest performance monitoring Date: Thu, 17 Nov 2011 10:30:00 +0100 Message-ID: <1321522200.27735.27.camel@twins> References: <1320929850-10480-1-git-send-email-gleb@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, avi@redhat.com, mtosatti@redhat.com, mingo@elte.hu, acme@ghostprotocols.net To: Gleb Natapov Return-path: In-Reply-To: <1320929850-10480-1-git-send-email-gleb@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Thu, 2011-11-10 at 14:57 +0200, Gleb Natapov wrote: > This patchset exposes an emulated version 2 architectural performance > monitoring unit to KVM guests. The PMU is emulated using perf_events, > so the host kernel can multiplex host-wide, host-user, and the > guest on available resources. > > The patches are against next branch on kvm.git. > > If you want to try running perf in a guest you need to apply the patch > below to qemu-kvm and use -cpu host on qemu command line. But DO NOT > TRY those patches without applying [1][2] to the host kernel first. > Don't tell me I didn't warn you! > > [1] https://lkml.org/lkml/2011/10/18/390 > [2] https://lkml.org/lkml/2011/10/23/163 > > Changelog: > v1->v2 > - put index into struct kvm_pmc instead of calculating it > - use locked version of bitops > - inject pmi from irq work if vcpu was not in a guest mode during NMI > - providing stub for perf_get_x86_pmu_capability() for !PERF_EVENTS > v2->v3 > - minor style change/comment clarification > - add perf patch to disable arch event not supported by a CPU > - create perf events as pinned On the pinned thing, do check event->state, if it hits PERF_EVENT_STATE_ERROR you're up shit creek and the counter didn't get scheduled. This can happen because eg. cpu-pinned events have higher precedence than task-pinned events. I've taken the two perf patches from this (6 and 7), the rest I gather should go through the KVM tree. I've only cursory looked at the other patches but didn't spot anything very curious.