From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: kernel device reset support Date: Tue, 09 Oct 2007 11:53:51 +0200 Message-ID: <470B4FAF.9060501@qumranet.com> References: <10EA09EFD8728347A513008B6B0DA77A0231BB36@pdsmsx411.ccr.corp.intel.com> <470A0556.80903@qumranet.com> <10EA09EFD8728347A513008B6B0DA77A0231BD83@pdsmsx411.ccr.corp.intel.com> <470B4B2E.1000500@qumranet.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: <470B4B2E.1000500-atKUWr5tajBWk0Htik3J/w@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 Avi Kivity wrote: >>> >>> >> For a graceful reboot, this one is not needed since every APs are >> already brought to HALT status before BSP issue RESET signal. But in >> case of non-graceful reboot, it is possible the VCPUs are still >> executing guest instruction, so we kick the VCPU and then use this logic >> to force the exception handler to be a heavy VM Exit and execute >> following code at beginning of kvm_vcpu_ioctl_run. (Let >> VCPU_MP_STATE_UNINITIALIZED take effective) >> >> if (unlikely(vcpu->mp_state == VCPU_MP_STATE_UNINITIALIZED)) { >> if (irqchip_in_kernel(vcpu->kvm) && vcpu->apic) >> kvm_lapic_reset(vcpu); >> kvm_vcpu_block(vcpu); >> vcpu_put(vcpu); >> return -EAGAIN; >> } >> >> Whether we need to handle those un-graceful reboot case is up to you :-) >> If not, then those code can be removed. >> >> > > We do need to support ungraceful resets. But this could easily be done > via vcpu->requests. > > To reset a vcpu: > > set_bit(KVM_REQ_RESET, &vcpu->requests) > kvm_vcpu_kick(vcpu); > > And in __vcpu_run(): > > if (vcpu_requests) { > if (test_and_reset_bit(KVM_REQ_RESET, &vcpu->requests)) > .... > } > > To be clear, you can move the reset call to that location ("...") and avoid the need to take a heavyweight exit completely. -- 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/