Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-12-03 Thread Xiao Guangrong
Hi Marcelo, Thanks for your patience. I was reading your reply over and over again, i would like to argue it more :). Please see below. On 11/29/2012 08:21 AM, Marcelo Tosatti wrote: https://lkml.org/lkml/2012/11/17/75 Does unshadowing work with large sptes at reexecute_instruction? That

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-12-03 Thread Marcelo Tosatti
On Mon, Dec 03, 2012 at 04:33:01PM +0800, Xiao Guangrong wrote: Hi Marcelo, Thanks for your patience. I was reading your reply over and over again, i would like to argue it more :). Please see below. On 11/29/2012 08:21 AM, Marcelo Tosatti wrote:

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-28 Thread Gleb Natapov
On Tue, Nov 27, 2012 at 11:30:24AM +0800, Xiao Guangrong wrote: On 11/27/2012 06:41 AM, Marcelo Tosatti wrote: - return false; +again: + page_fault_count = ACCESS_ONCE(vcpu-kvm-arch.page_fault_count); + + /* + * if emulation was due to access to shadowed page table + *

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-28 Thread Xiao Guangrong
On 11/28/2012 10:12 PM, Gleb Natapov wrote: On Tue, Nov 27, 2012 at 11:30:24AM +0800, Xiao Guangrong wrote: On 11/27/2012 06:41 AM, Marcelo Tosatti wrote: - return false; +again: + page_fault_count = ACCESS_ONCE(vcpu-kvm-arch.page_fault_count); + + /* + * if emulation was due to

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-28 Thread Marcelo Tosatti
On Wed, Nov 28, 2012 at 10:59:35PM +0800, Xiao Guangrong wrote: On 11/28/2012 10:12 PM, Gleb Natapov wrote: On Tue, Nov 27, 2012 at 11:30:24AM +0800, Xiao Guangrong wrote: On 11/27/2012 06:41 AM, Marcelo Tosatti wrote: -return false; +again: +page_fault_count =

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-28 Thread Xiao Guangrong
On 11/29/2012 05:57 AM, Marcelo Tosatti wrote: On Wed, Nov 28, 2012 at 10:59:35PM +0800, Xiao Guangrong wrote: On 11/28/2012 10:12 PM, Gleb Natapov wrote: On Tue, Nov 27, 2012 at 11:30:24AM +0800, Xiao Guangrong wrote: On 11/27/2012 06:41 AM, Marcelo Tosatti wrote: -return false;

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-28 Thread Xiao Guangrong
On 11/29/2012 06:40 AM, Xiao Guangrong wrote: On 11/29/2012 05:57 AM, Marcelo Tosatti wrote: On Wed, Nov 28, 2012 at 10:59:35PM +0800, Xiao Guangrong wrote: On 11/28/2012 10:12 PM, Gleb Natapov wrote: On Tue, Nov 27, 2012 at 11:30:24AM +0800, Xiao Guangrong wrote: On 11/27/2012 06:41 AM,

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-28 Thread Marcelo Tosatti
On Thu, Nov 29, 2012 at 06:40:51AM +0800, Xiao Guangrong wrote: On 11/29/2012 05:57 AM, Marcelo Tosatti wrote: On Wed, Nov 28, 2012 at 10:59:35PM +0800, Xiao Guangrong wrote: On 11/28/2012 10:12 PM, Gleb Natapov wrote: On Tue, Nov 27, 2012 at 11:30:24AM +0800, Xiao Guangrong wrote: On

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-28 Thread Marcelo Tosatti
On Thu, Nov 29, 2012 at 07:16:50AM +0800, Xiao Guangrong wrote: On 11/29/2012 06:40 AM, Xiao Guangrong wrote: On 11/29/2012 05:57 AM, Marcelo Tosatti wrote: On Wed, Nov 28, 2012 at 10:59:35PM +0800, Xiao Guangrong wrote: On 11/28/2012 10:12 PM, Gleb Natapov wrote: On Tue, Nov 27, 2012 at

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-27 Thread Marcelo Tosatti
On Tue, Nov 27, 2012 at 11:30:24AM +0800, Xiao Guangrong wrote: On 11/27/2012 06:41 AM, Marcelo Tosatti wrote: - return false; +again: + page_fault_count = ACCESS_ONCE(vcpu-kvm-arch.page_fault_count); + + /* + * if emulation was due to access to shadowed page table + *

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-27 Thread Xiao Guangrong
On 11/28/2012 07:42 AM, Marcelo Tosatti wrote: On Tue, Nov 27, 2012 at 11:30:24AM +0800, Xiao Guangrong wrote: On 11/27/2012 06:41 AM, Marcelo Tosatti wrote: - return false; +again: + page_fault_count = ACCESS_ONCE(vcpu-kvm-arch.page_fault_count); + + /* + * if emulation was due to

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-26 Thread Marcelo Tosatti
On Tue, Nov 20, 2012 at 07:59:53AM +0800, Xiao Guangrong wrote: The current reexecute_instruction can not well detect the failed instruction emulation. It allows guest to retry all the instructions except it accesses on error pfn. For example, some cases are nested-write-protect - if the

Re: [PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-26 Thread Xiao Guangrong
On 11/27/2012 06:41 AM, Marcelo Tosatti wrote: -return false; +again: +page_fault_count = ACCESS_ONCE(vcpu-kvm-arch.page_fault_count); + +/* + * if emulation was due to access to shadowed page table + * and it failed try to unshadow page and re-enter the + * guest

[PATCH 3/3] KVM: x86: improve reexecute_instruction

2012-11-19 Thread Xiao Guangrong
The current reexecute_instruction can not well detect the failed instruction emulation. It allows guest to retry all the instructions except it accesses on error pfn. For example, some cases are nested-write-protect - if the page we want to write is used as PDE but it chains to itself. Under this