From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: Non-exiting rdpmc on KVM guests? Date: Tue, 21 Apr 2015 18:32:54 +0200 Message-ID: <55367BB6.3050103@redhat.com> References: <20150421150514.GC3182@worktop.meeting.verilan.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: kvm list To: Peter Zijlstra , Andy Lutomirski Return-path: Received: from mail-wi0-f171.google.com ([209.85.212.171]:34779 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932988AbbDUQdA (ORCPT ); Tue, 21 Apr 2015 12:33:00 -0400 Received: by wicmx19 with SMTP id mx19so67835205wic.1 for ; Tue, 21 Apr 2015 09:32:58 -0700 (PDT) In-Reply-To: <20150421150514.GC3182@worktop.meeting.verilan.com> Sender: kvm-owner@vger.kernel.org List-ID: On 21/04/2015 17:05, Peter Zijlstra wrote: > On Mon, Apr 20, 2015 at 05:47:23PM -0700, Andy Lutomirski wrote: >> I just wrote a little perf self-monitoring tool that uses rdpmc to >> count cycles. Performance sucks under KVM (VMX). >> >> How hard would it be to avoid rdpmc exits in cases where the host and >> guest pmu configurations are compatible as seen by rdpmc? I'm mostly >> ignorant of how the PMU counter offsets and such work. > > I'm not sure how all the VMX stuff works. how is rdpmc seem? It it at > all possible to not trap that? Yes, it is. RDPMC is just yet another "exit reason" and you can avoid exiting. However, if you take into account that RDPMC can also be used to read an inactive counter, and that multiple guests "fight" for the same host counters, it's even harder to ensure that the guest counter indices match those on the host. Paolo