Re: [PATCH 2/2] KVM: VMX: Initialize vm86 TSS only once.

2011-02-27 Thread Avi Kivity
On 02/21/2011 12:07 PM, Gleb Natapov wrote: Currently vm86 task is initialized on each real mode entry and vcpu reset. Initialization is done by zeroing TSS and updating relevant fields. But since all vcpus are using the same TSS there is a race where one vcpu may use TSS while other vcpu is

Re: [PATCH 2/2] KVM: VMX: Initialize vm86 TSS only once.

2011-02-27 Thread Gleb Natapov
On Sun, Feb 27, 2011 at 05:43:07PM +0200, Avi Kivity wrote: On 02/21/2011 12:07 PM, Gleb Natapov wrote: Currently vm86 task is initialized on each real mode entry and vcpu reset. Initialization is done by zeroing TSS and updating relevant fields. But since all vcpus are using the same TSS

Re: [PATCH 2/2] KVM: VMX: Initialize vm86 TSS only once.

2011-02-27 Thread Avi Kivity
On 02/27/2011 05:52 PM, Gleb Natapov wrote: According to my reading of the code, if KVM_SET_TSS_ADDR is not invoked, the guest would fail both before and after the patch, yes? Hmmm. Actually no. Before the patch guest that doesn't use KVM_SET_TSS_ADDR will use the top of slot zero. Should

Re: [PATCH 2/2] KVM: VMX: Initialize vm86 TSS only once.

2011-02-27 Thread Avi Kivity
On 02/27/2011 05:58 PM, Avi Kivity wrote: The problem with using top of slot zero is that this memory is available for guest use and we do not even put it into e820 map as far as I see. Also there are patches floating around that re-arrange memslots or even put them in a tree. They will break

Re: [PATCH 2/2] KVM: VMX: Initialize vm86 TSS only once.

2011-02-27 Thread Gleb Natapov
On Sun, Feb 27, 2011 at 05:58:54PM +0200, Avi Kivity wrote: On 02/27/2011 05:52 PM, Gleb Natapov wrote: According to my reading of the code, if KVM_SET_TSS_ADDR is not invoked, the guest would fail both before and after the patch, yes? Hmmm. Actually no. Before the patch guest that

Re: [PATCH 2/2] KVM: VMX: Initialize vm86 TSS only once.

2011-02-27 Thread Avi Kivity
On 02/27/2011 06:12 PM, Gleb Natapov wrote: On Sun, Feb 27, 2011 at 05:58:54PM +0200, Avi Kivity wrote: On 02/27/2011 05:52 PM, Gleb Natapov wrote: According to my reading of the code, if KVM_SET_TSS_ADDR is not invoked, the guest would fail both before and after the patch, yes?

Re: [PATCH 2/2] KVM: VMX: Initialize vm86 TSS only once.

2011-02-27 Thread Gleb Natapov
On Sun, Feb 27, 2011 at 06:04:16PM +0200, Avi Kivity wrote: On 02/27/2011 05:58 PM, Avi Kivity wrote: The problem with using top of slot zero is that this memory is available for guest use and we do not even put it into e820 map as far as I see. Also there are patches floating around that

Re: [PATCH 2/2] KVM: VMX: Initialize vm86 TSS only once.

2011-02-27 Thread Avi Kivity
On 02/27/2011 06:27 PM, Gleb Natapov wrote: Or we can keep the old behaviour. If KVM_SET_TSS_ADDR hasn't been called by the time of the first entry into real mode (the first KVM_CREATE_VCPU?), use the top of the first slot. Do we require that KVM_SET_TSS_ADDR is called before first

Re: [PATCH 2/2] KVM: VMX: Initialize vm86 TSS only once.

2011-02-27 Thread Gleb Natapov
On Sun, Feb 27, 2011 at 06:31:13PM +0200, Avi Kivity wrote: On 02/27/2011 06:27 PM, Gleb Natapov wrote: Or we can keep the old behaviour. If KVM_SET_TSS_ADDR hasn't been called by the time of the first entry into real mode (the first KVM_CREATE_VCPU?), use the top of the first slot.