From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/2] KVM: Protect race-condition betweenVMCS and current_vmcs on VMX hardware Date: Tue, 31 Jul 2007 12:22:59 +0300 Message-ID: <46AEFF73.6020904@qumranet.com> References: <10EA09EFD8728347A513008B6B0DA77A01DB6650@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: <10EA09EFD8728347A513008B6B0DA77A01DB6650-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: > kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org wrote: > >> On Thu, 2007-07-26 at 18:03 +0300, Avi Kivity wrote: >> >>> Gregory Haskins wrote: >>> >>>> We need to provide locking around the current_vmcs/VMCS >>>> interactions to protect against race conditions. >>>> >>>> >>>> >>> Can you explain the race? >>> >> Sure. It can happen with two VMs are running simultaneously. >> Lets call >> them VM-a and VM-b. Assume the scenario: VM-a is on CPU-x, gets >> migrated to CPU-y, and VM-b gets scheduled in on CPU-x. There >> is a race >> on CPU-x with the VMCS handling logic between the VM-b process >> context, and the IPI to execute the __vcpu_clear for VM-a. >> > > I may miss something, why does that matter? __vcpu_clear will eventually > get executed though it is a little bit delayed. vmclear will eventually > dump > internal state of VM-a VMCS to memory and VM-b get its own VMCS > loaded. Here the point is vmclear has a parameter to identify which > VM's VMCS to dump, not only a memory address. Jun, please correct me if > I am wrong. > > The vmclear instruction itself cannot race (because, as you say, the vmcs is a parameter). However access to the current_vmcs variable is racy. The race is benign and cannot lead to any problems, so we're not changing any code for that. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- 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/