From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 7/9] KVM: Expose the architectural performance monitoring CPUID leaf Date: Wed, 2 Nov 2011 13:18:51 +0200 Message-ID: <20111102111851.GD14726@redhat.com> References: <1319993624-20247-1-git-send-email-gleb@redhat.com> <1319993624-20247-8-git-send-email-gleb@redhat.com> <4EB01507.1020607@gmail.com> <20111101161815.GB16539@redhat.com> <4EB01D49.6010309@gmail.com> <20111101164052.GC16539@redhat.com> <4EB02FB2.3010606@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com, mtosatti@redhat.com, linux-kernel@redhat.com, mingo@elte.hu, a.p.zijlstra@chello.nl, acme@ghostprotocols.net To: David Ahern Return-path: Received: from mx1.redhat.com ([209.132.183.28]:36084 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751655Ab1KBLTH (ORCPT ); Wed, 2 Nov 2011 07:19:07 -0400 Content-Disposition: inline In-Reply-To: <4EB02FB2.3010606@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Nov 01, 2011 at 11:43:14AM -0600, David Ahern wrote: > > > On 11/01/2011 10:40 AM, Gleb Natapov wrote: > >>>> If PERF_EVENTS is disabled in the host kernel will KVM return the right > >>>> thing for the guest that might have PERF_EVENTS enabled? > >>>> > >>> With correct implementation of perf_get_x86_pmu_capability() it should. > >>> PERF_EVENTS disable version should set cap.version to zero, so guest will > >>> find that vcpu does not provide architectural PMU. > >> > >> Ok. > >> > >> I was also thinking about kvm-kmod where newer KVM source is compiled > >> against older kernels - which at one point had PERF_EVENTS as a > >> configurable parameter. In this case it is possible to have perf events > >> disabled host side yet enabled guest side. > >> > > KVM PMU implementation uses host perf events to talk to HW. Without host > > perf infrastructure KVM will not be able to provide PMU to a guest. Or > > are you saying that we should support compiling KVM with !PERF_EVENTS? I'd > > rather just make KVM select PERF_EVENTS. > > Strictly speaking KVM does not require PERF_EVENTS; it only requires it > if a PMU is to be offered to the guest -- which is a new KVM feature. > > Not requiring PERF_EVENTS makes kvm-kmod a bit simpler, a use case where > the kvm source deals with a pre-configured kernel. > Making kvm-kmod life simpler is not consideration for new KVM features and in KVM we usually do note make optional features, but just select required subsystem. That said it shouldn't be hard to make KVM PMU be dependant on PERF_EVENTS, but since I can't disable PERF_EVENTS right now I can't test it either, so for now I'll just add select PERF_EVENTS to KVM. -- Gleb.