From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: KVM PMU virtualization Date: Fri, 26 Feb 2010 12:24:04 +0100 Message-ID: <20100226112404.GG7463@elte.hu> References: <4B86917C.4070102@redhat.com> <20100225173423.GB4246@8bytes.org> <20100226084241.GF15885@elte.hu> <4B87987A.2020302@redhat.com> <20100226103934.GD4246@8bytes.org> <20100226104659.GC7463@elte.hu> <20100226110642.GF4246@8bytes.org> <4B87ADFC.3010102@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Joerg Roedel , Avi Kivity , KVM General , Peter Zijlstra , Zachary Amsden , Gleb Natapov , ming.m.lin@intel.com, "Zhang, Yanmin" , Peter Zijlstra , Thomas Gleixner , "H. Peter Anvin" , Arjan van de Ven , Fr??d??ric Weisbecker , Arnaldo Carvalho de Melo To: Jes Sorensen Return-path: Received: from mx3.mail.elte.hu ([157.181.1.138]:45810 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934763Ab0BZLYQ (ORCPT ); Fri, 26 Feb 2010 06:24:16 -0500 Content-Disposition: inline In-Reply-To: <4B87ADFC.3010102@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: * Jes Sorensen wrote: > On 02/26/10 12:06, Joerg Roedel wrote: > > > Isn't there a cpuid bit indicating the availability of architectural > > perfmon? > > Nope, the perfmon flag is a fake Linux flag, set based on the contents on > cpuid 0x0a There is a way to query the CPU for 'architectural perfmon' though, via CPUID alone - that is how we set the X86_FEATURE_ARCH_PERFMON shortcut. The logic is: if (c->cpuid_level > 9) { unsigned eax = cpuid_eax(10); /* Check for version and the number of counters */ if ((eax & 0xff) && (((eax>>8) & 0xff) > 1)) set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON); } But emulating that doesnt solve the problem: as OSs generally dont key their PMU drivers off the relatively new 'architectural perfmon' CPUID detail, but based on much higher level CPUID attributes. (like Intel/AMD) Ingo