From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Remove APIC lock Date: Sat, 25 Aug 2007 11:05:26 +0300 Message-ID: <46CFE2C6.5020006@qumranet.com> References: <10EA09EFD8728347A513008B6B0DA77A01F84594@pdsmsx411.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel To: "Dong, Eddie" Return-path: In-Reply-To: <10EA09EFD8728347A513008B6B0DA77A01F84594-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: > Avi: > > apic->lock is used in many place to avoid race condition with apic > timer call back > function which may run on different pCPU. This patch migrate the > apic timer to > same CPU with the one VP runs on, thus the lock is no longer > necessary. > > thx,eddie > > What about preemption: - vcpu executes lapic code in qemu process context - process is preempted - timer fires, touches lapic code Furthermore, I question the necessity of this. Taking a spinlock is a couple dozen cycles on modern processors. Entering the guest is a couple thousand. So what are we saving? (migrating the timer is a good thing though). A different approach might be to wake up the vcpu like we do for irr, with kvm_vcpu_kick(), and let the timer code be handled in process context, so no locks need be taken. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. ------------------------------------------------------------------------- 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/