From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2 05/11] KVM: Expose a version 1 architectural PMU to guests Date: Tue, 28 Jun 2011 11:15:59 +0300 Message-ID: <4E098DBF.3030006@redhat.com> References: <1307972106-2468-1-git-send-email-avi@redhat.com> <1307972106-2468-6-git-send-email-avi@redhat.com> <4E088FF7.9080304@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Arnaldo Carvalho de Melo To: lidong chen Return-path: Received: from mx1.redhat.com ([209.132.183.28]:6784 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757047Ab1F1IQU (ORCPT ); Tue, 28 Jun 2011 04:16:20 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Please don't top-post. On 06/28/2011 05:54 AM, lidong chen wrote: > but i didn't find intel cpu support exclude_host attribute. > and this method depend on the support of cpu. Look at the "load IA32_PERF_GLOBAL_CTRL" VM-entry and VM-exit controls. > i find the implement of Xenoprof, which inject the nmi interrupt in > nmi_callback. > > maybe we can inject the nmi interrupt like this: What problem are you trying to solve? Posting a bunch of code without an explanation isn't helpful. > static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx) > { > u32 exit_intr_info; > > if (!(vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY > || vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI)) > return; > > vmx->exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); > exit_intr_info = vmx->exit_intr_info; > > /* Handle machine checks before interrupts are enabled */ > if (is_machine_check(exit_intr_info)) > kvm_machine_check(); > > /* We need to handle NMIs before interrupts are enabled */ > if ((exit_intr_info& INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR&& > (exit_intr_info& INTR_INFO_VALID_MASK)) { > kvm_before_handle_nmi(&vmx->vcpu); > > > if ( ) //cause by performance counter > { > kvm_inject_nmi(&vmx->vcpu); > } > > > asm("int $2"); > kvm_after_handle_nmi(&vmx->vcpu); > } > } > > > > > 2011/6/27 Avi Kivity: > > On 06/27/2011 05:10 PM, lidong chen wrote: > >> > >> this patch used perf_event_create_kernel_counter function to setup > >> event in host os. > >> whether the count of event will calculate the part of qemu-kvm > >> userspace, and deliver the nmi interrupt which caused by this part to > >> guest os? > > > > There is a patch by Joerg Roedel that adds a .exclude_host attribute that > > prevents this from happening. Once that patch is merged, I'll change this > > one to make use of it. > > > > -- > > error compiling committee.c: too many arguments to function > > > > -- error compiling committee.c: too many arguments to function