From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: deactivate fpu when cr0.PE ON? Date: Sat, 11 Apr 2009 14:43:19 +0300 Message-ID: <49E08257.9090503@redhat.com> References: <9832F13BD22FB94A829F798DA4A8280501A4041722@pdsmsx503.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "kvm@vger.kernel.org" To: "Dong, Eddie" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:38039 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751587AbZDKLnl (ORCPT ); Sat, 11 Apr 2009 07:43:41 -0400 In-Reply-To: <9832F13BD22FB94A829F798DA4A8280501A4041722@pdsmsx503.ccr.corp.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Dong, Eddie wrote: > Following code deactivate fpu when CR0.PE is on, any explaination? Rest of code active/deactive fpu based on cr0.TS bit. > > > The idea is, if the guest is doing a context switch, then it will likely set its own lazy fpu code, so we anticipate it and deactivate the cpu. When cr0.pe is cleared, lazy fpu usually doesn't work so we leave it enabled. However the mechanism of deactivating the fpu on cr3 write doesn't work with npt or ept, I'd like to replace it with something better. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.