* deactivate fpu when cr0.PE ON?
@ 2009-04-10 8:19 Dong, Eddie
2009-04-11 11:43 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Dong, Eddie @ 2009-04-10 8:19 UTC (permalink / raw)
To: kvm@vger.kernel.org, Avi Kivity; +Cc: Dong, Eddie
Following code deactivate fpu when CR0.PE is on, any explaination? Rest of code active/deactive fpu based on cr0.TS bit.
thx, eddie
static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
{
unsigned long guest_cr3;
u64 eptp;
guest_cr3 = cr3;
if (enable_ept) {
eptp = construct_eptp(cr3);
vmcs_write64(EPT_POINTER, eptp);
ept_sync_context(eptp);
ept_load_pdptrs(vcpu);
guest_cr3 = is_paging(vcpu) ? vcpu->arch.cr3 :
VMX_EPT_IDENTITY_PAGETABLE_ADDR;
}
vmx_flush_tlb(vcpu);
vmcs_writel(GUEST_CR3, guest_cr3);
if (vcpu->arch.cr0 & X86_CR0_PE)
vmx_fpu_deactivate(vcpu);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: deactivate fpu when cr0.PE ON?
2009-04-10 8:19 deactivate fpu when cr0.PE ON? Dong, Eddie
@ 2009-04-11 11:43 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2009-04-11 11:43 UTC (permalink / raw)
To: Dong, Eddie; +Cc: kvm@vger.kernel.org
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-11 11:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-10 8:19 deactivate fpu when cr0.PE ON? Dong, Eddie
2009-04-11 11:43 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox