From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: VMX: Fix repeatlycalling alloc_apic_access_page() Date: Mon, 05 Nov 2007 15:58:09 +0200 Message-ID: <472F2171.9050704@qumranet.com> References: <200711021313.43013.sheng.yang@intel.com> <472D78CA.6080508@qumranet.com> <10EA09EFD8728347A513008B6B0DA77A02557D41@pdsmsx411.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: "Dong, Eddie" Return-path: In-Reply-To: <10EA09EFD8728347A513008B6B0DA77A02557D41-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Dong, Eddie wrote: >>> - if (vm_need_virtualize_apic_accesses(vmx->vcpu.kvm)) >>> + if ((vmx->vcpu.vcpu_id == 0) && >>> + (vm_need_virtualize_apic_accesses(vmx->vcpu.kvm))) >>> if (alloc_apic_access_page(vmx->vcpu.kvm) != 0) >>> return -ENOMEM; >>> >>> >>> >> We may not have vcpu id 0 (though it's very unlikely). >> >> > > Current LAPIC code assume vcpu_id = 0 for BSP. > And even no real support of APIC_ID change. > > How about use (vcpu->apic_base & MSR_IA32_APICBASE_BSP) ? > Taking kvm->mutex and checking avoids hidden dependencies and is necessary anyway. I need to sit down and document the kvm locking rules. -- Any sufficiently difficult bug is indistinguishable from a feature. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/