From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH 2/3] kvm: svm: reset cr0 properly on vcpu reset Date: Fri, 19 Mar 2010 16:14:44 +0100 Message-ID: <4BA394E4.3080107@suse.de> References: <1256359800-16893-1-git-send-email-ehabkost@redhat.com> <1256359800-16893-3-git-send-email-ehabkost@redhat.com> <4BA11CBC.7060303@suse.de> <20100317214249.GB21789@blackpad.lan.raisama.net> <669C51E5-982A-4EC8-90E9-789372727129@suse.de> <20100319145112.GE17834@blackpad.lan.raisama.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , kvm@vger.kernel.org To: Eduardo Habkost Return-path: Received: from cantor2.suse.de ([195.135.220.15]:44839 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751079Ab0CSPOq (ORCPT ); Fri, 19 Mar 2010 11:14:46 -0400 In-Reply-To: <20100319145112.GE17834@blackpad.lan.raisama.net> Sender: kvm-owner@vger.kernel.org List-ID: Eduardo Habkost wrote: > On Wed, Mar 17, 2010 at 10:48:23PM +0100, Alexander Graf wrote: > >> On 17.03.2010, at 22:42, Eduardo Habkost wrote: >> >> >>> On Wed, Mar 17, 2010 at 07:17:32PM +0100, Alexander Graf wrote: >>> >>>> Eduardo Habkost wrote: >>>> >>>>> svm_vcpu_reset() was not properly resetting the contents of the guest-visible >>>>> cr0 register, causing the following issue: >>>>> https://bugzilla.redhat.com/show_bug.cgi?id=525699 >>>>> >>>>> Without resetting cr0 properly, the vcpu was running the SIPI bootstrap routine >>>>> with paging enabled, making the vcpu get a pagefault exception while trying to >>>>> run it. >>>>> >>>>> Instead of setting vmcb->save.cr0 directly, the new code just resets >>>>> kvm->arch.cr0 and calls kvm_set_cr0(). The bits that were set/cleared on >>>>> vmcb->save.cr0 (PG, WP, !CD, !NW) will be set properly by svm_set_cr0(). >>>>> >>>>> kvm_set_cr0() is used instead of calling svm_set_cr0() directly to make sure >>>>> kvm_mmu_reset_context() is called to reset the mmu to nonpaging mode. >>>>> >>>>> Signed-off-by: Eduardo Habkost >>>>> >>>>> >>>> Should this go into -stable? >>>> >>> I think so. The patch is from October, was -stable branched before that? >>> >> If I read the diff log correctly 2.6.32 kvm development was branched >> off end of July 2009. The important question is if this patch fixes a >> regression introduced by some speedup magic. >> > > I have just checked git history, and it looks like this is not a > regression. Before this patch, vcpu->cr0 (the guest-visible cr0 value) > was never reset on vcpu reset, but only vcpu->svm->vmcb->save.cr0 (the > actual cr0 value used by the CPU). > Good to know. Thanks for looking into this! Alex