Re: [PATCHv3 00/10] KVM in-guest performance monitoring

From: Peter Zijlstra
Date: Thu Nov 17 2011 - 04:30:32 EST


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.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/