Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-23 Thread Gleb Natapov
On Fri, Dec 14, 2012 at 11:05:46PM -0200, Marcelo Tosatti wrote:
> On Fri, Dec 14, 2012 at 12:50:09PM +0800, Xiao Guangrong wrote:
> > >>> program a timer interrupt and #GP? 
> > >>
> > >> Could you please explain the detail?
> > > 
> > > Before the instruction which writes continuously to the pagetable, arm
> > > say lapic timer. #GP on the interrupt handler and test with failure.
> > 
> > Sorry, I am confused about this. After Qemu exits due to 
> > KVM_EXIT_INTERNAL_ERROR,
> > the vm is stopped then interrupt can not be injected to guest. Or i missed 
> > something?
> 
> Yes, but without fixed kernel kvm-unit test executable loops continuously.
> Perhaps its more appropriate to fix generically, nevermind.
This will not be the first test that makes kvm-unit-test hang on non
fixed kernels.

--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-23 Thread Gleb Natapov
On Fri, Dec 14, 2012 at 11:05:46PM -0200, Marcelo Tosatti wrote:
 On Fri, Dec 14, 2012 at 12:50:09PM +0800, Xiao Guangrong wrote:
   program a timer interrupt and #GP? 
  
   Could you please explain the detail?
   
   Before the instruction which writes continuously to the pagetable, arm
   say lapic timer. #GP on the interrupt handler and test with failure.
  
  Sorry, I am confused about this. After Qemu exits due to 
  KVM_EXIT_INTERNAL_ERROR,
  the vm is stopped then interrupt can not be injected to guest. Or i missed 
  something?
 
 Yes, but without fixed kernel kvm-unit test executable loops continuously.
 Perhaps its more appropriate to fix generically, nevermind.
This will not be the first test that makes kvm-unit-test hang on non
fixed kernels.

--
Gleb.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-14 Thread Marcelo Tosatti
On Fri, Dec 14, 2012 at 12:50:09PM +0800, Xiao Guangrong wrote:
> >>> program a timer interrupt and #GP? 
> >>
> >> Could you please explain the detail?
> > 
> > Before the instruction which writes continuously to the pagetable, arm
> > say lapic timer. #GP on the interrupt handler and test with failure.
> 
> Sorry, I am confused about this. After Qemu exits due to 
> KVM_EXIT_INTERNAL_ERROR,
> the vm is stopped then interrupt can not be injected to guest. Or i missed 
> something?

Yes, but without fixed kernel kvm-unit test executable loops continuously.
Perhaps its more appropriate to fix generically, nevermind.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-14 Thread Marcelo Tosatti
On Fri, Dec 14, 2012 at 12:50:09PM +0800, Xiao Guangrong wrote:
  program a timer interrupt and #GP? 
 
  Could you please explain the detail?
  
  Before the instruction which writes continuously to the pagetable, arm
  say lapic timer. #GP on the interrupt handler and test with failure.
 
 Sorry, I am confused about this. After Qemu exits due to 
 KVM_EXIT_INTERNAL_ERROR,
 the vm is stopped then interrupt can not be injected to guest. Or i missed 
 something?

Yes, but without fixed kernel kvm-unit test executable loops continuously.
Perhaps its more appropriate to fix generically, nevermind.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-13 Thread Xiao Guangrong
On 12/14/2012 06:54 AM, Marcelo Tosatti wrote:
> On Thu, Dec 13, 2012 at 04:05:55AM +0800, Xiao Guangrong wrote:
>> On 12/12/2012 07:36 AM, Marcelo Tosatti wrote:
>>> On Mon, Dec 10, 2012 at 05:11:35PM +0800, Xiao Guangrong wrote:
 Changelog:
 There are some changes from Marcelo and Gleb's review, thank you all!
 - access indirect_shadow_pages in the protection of mmu-lock
 - fix the issue when unhandleable instruction access on large page
 - add a new test case for large page

 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, these cases can not be detected:
 - for tdp used
   currently, it refused to retry all instructions. If nested npt is used, 
 the
   emulation may be caused by shadow page, it can be fixed by unshadow the
   shadow page.

 - for shadow mmu
   some cases are nested-write-protect, for example, if the page we want to
   write is used as PDE but it chains to itself. Under this case, we should
   stop the emulation and report the case to userspace.

 There are two test cases based on kvm-unit-test can trigger a infinite 
 loop on
 current code (ept = 0), after this patchset, it can report the error to 
 Qemu.

 Subject: [PATCH] access test: test unhandleable instruction

 Test the instruction which can not be handled by kvm

 Signed-off-by: Xiao Guangrong 
>>>
>>> Please submit the test for inclusion. There should be some way to make
>>> it fail.. 
>>
>> Yes.
>>
>> But it is not easy. If the test cases run normally, kvm will report a error 
>> to Qemu
>> then Qemu will exit the vcpu thread after dumping the vcpu state.
>>
>> We need to do something to let guest can be aware that the error report is 
>> triggered.
>> I guess we can add a option in Qemu, say '-notify-guest' and allow Qemu to 
>> inject #GP
>> to guest with a special ERROR_CODE if error is reported.
>>
>>> program a timer interrupt and #GP? 
>>
>> Could you please explain the detail?
> 
> Before the instruction which writes continuously to the pagetable, arm
> say lapic timer. #GP on the interrupt handler and test with failure.

Sorry, I am confused about this. After Qemu exits due to 
KVM_EXIT_INTERNAL_ERROR,
the vm is stopped then interrupt can not be injected to guest. Or i missed 
something?



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-13 Thread Marcelo Tosatti
On Thu, Dec 13, 2012 at 04:05:55AM +0800, Xiao Guangrong wrote:
> On 12/12/2012 07:36 AM, Marcelo Tosatti wrote:
> > On Mon, Dec 10, 2012 at 05:11:35PM +0800, Xiao Guangrong wrote:
> >> Changelog:
> >> There are some changes from Marcelo and Gleb's review, thank you all!
> >> - access indirect_shadow_pages in the protection of mmu-lock
> >> - fix the issue when unhandleable instruction access on large page
> >> - add a new test case for large page
> >>
> >> 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, these cases can not be detected:
> >> - for tdp used
> >>   currently, it refused to retry all instructions. If nested npt is used, 
> >> the
> >>   emulation may be caused by shadow page, it can be fixed by unshadow the
> >>   shadow page.
> >>
> >> - for shadow mmu
> >>   some cases are nested-write-protect, for example, if the page we want to
> >>   write is used as PDE but it chains to itself. Under this case, we should
> >>   stop the emulation and report the case to userspace.
> >>
> >> There are two test cases based on kvm-unit-test can trigger a infinite 
> >> loop on
> >> current code (ept = 0), after this patchset, it can report the error to 
> >> Qemu.
> >>
> >> Subject: [PATCH] access test: test unhandleable instruction
> >>
> >> Test the instruction which can not be handled by kvm
> >>
> >> Signed-off-by: Xiao Guangrong 
> > 
> > Please submit the test for inclusion. There should be some way to make
> > it fail.. 
> 
> Yes.
> 
> But it is not easy. If the test cases run normally, kvm will report a error 
> to Qemu
> then Qemu will exit the vcpu thread after dumping the vcpu state.
> 
> We need to do something to let guest can be aware that the error report is 
> triggered.
> I guess we can add a option in Qemu, say '-notify-guest' and allow Qemu to 
> inject #GP
> to guest with a special ERROR_CODE if error is reported.
> 
> > program a timer interrupt and #GP? 
> 
> Could you please explain the detail?

Before the instruction which writes continuously to the pagetable, arm
say lapic timer. #GP on the interrupt handler and test with failure.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-13 Thread Marcelo Tosatti
On Thu, Dec 13, 2012 at 04:05:55AM +0800, Xiao Guangrong wrote:
 On 12/12/2012 07:36 AM, Marcelo Tosatti wrote:
  On Mon, Dec 10, 2012 at 05:11:35PM +0800, Xiao Guangrong wrote:
  Changelog:
  There are some changes from Marcelo and Gleb's review, thank you all!
  - access indirect_shadow_pages in the protection of mmu-lock
  - fix the issue when unhandleable instruction access on large page
  - add a new test case for large page
 
  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, these cases can not be detected:
  - for tdp used
currently, it refused to retry all instructions. If nested npt is used, 
  the
emulation may be caused by shadow page, it can be fixed by unshadow the
shadow page.
 
  - for shadow mmu
some cases are nested-write-protect, for example, if the page we want to
write is used as PDE but it chains to itself. Under this case, we should
stop the emulation and report the case to userspace.
 
  There are two test cases based on kvm-unit-test can trigger a infinite 
  loop on
  current code (ept = 0), after this patchset, it can report the error to 
  Qemu.
 
  Subject: [PATCH] access test: test unhandleable instruction
 
  Test the instruction which can not be handled by kvm
 
  Signed-off-by: Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com
  
  Please submit the test for inclusion. There should be some way to make
  it fail.. 
 
 Yes.
 
 But it is not easy. If the test cases run normally, kvm will report a error 
 to Qemu
 then Qemu will exit the vcpu thread after dumping the vcpu state.
 
 We need to do something to let guest can be aware that the error report is 
 triggered.
 I guess we can add a option in Qemu, say '-notify-guest' and allow Qemu to 
 inject #GP
 to guest with a special ERROR_CODE if error is reported.
 
  program a timer interrupt and #GP? 
 
 Could you please explain the detail?

Before the instruction which writes continuously to the pagetable, arm
say lapic timer. #GP on the interrupt handler and test with failure.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-13 Thread Xiao Guangrong
On 12/14/2012 06:54 AM, Marcelo Tosatti wrote:
 On Thu, Dec 13, 2012 at 04:05:55AM +0800, Xiao Guangrong wrote:
 On 12/12/2012 07:36 AM, Marcelo Tosatti wrote:
 On Mon, Dec 10, 2012 at 05:11:35PM +0800, Xiao Guangrong wrote:
 Changelog:
 There are some changes from Marcelo and Gleb's review, thank you all!
 - access indirect_shadow_pages in the protection of mmu-lock
 - fix the issue when unhandleable instruction access on large page
 - add a new test case for large page

 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, these cases can not be detected:
 - for tdp used
   currently, it refused to retry all instructions. If nested npt is used, 
 the
   emulation may be caused by shadow page, it can be fixed by unshadow the
   shadow page.

 - for shadow mmu
   some cases are nested-write-protect, for example, if the page we want to
   write is used as PDE but it chains to itself. Under this case, we should
   stop the emulation and report the case to userspace.

 There are two test cases based on kvm-unit-test can trigger a infinite 
 loop on
 current code (ept = 0), after this patchset, it can report the error to 
 Qemu.

 Subject: [PATCH] access test: test unhandleable instruction

 Test the instruction which can not be handled by kvm

 Signed-off-by: Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com

 Please submit the test for inclusion. There should be some way to make
 it fail.. 

 Yes.

 But it is not easy. If the test cases run normally, kvm will report a error 
 to Qemu
 then Qemu will exit the vcpu thread after dumping the vcpu state.

 We need to do something to let guest can be aware that the error report is 
 triggered.
 I guess we can add a option in Qemu, say '-notify-guest' and allow Qemu to 
 inject #GP
 to guest with a special ERROR_CODE if error is reported.

 program a timer interrupt and #GP? 

 Could you please explain the detail?
 
 Before the instruction which writes continuously to the pagetable, arm
 say lapic timer. #GP on the interrupt handler and test with failure.

Sorry, I am confused about this. After Qemu exits due to 
KVM_EXIT_INTERNAL_ERROR,
the vm is stopped then interrupt can not be injected to guest. Or i missed 
something?



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-12 Thread Xiao Guangrong
On 12/12/2012 07:36 AM, Marcelo Tosatti wrote:
> On Mon, Dec 10, 2012 at 05:11:35PM +0800, Xiao Guangrong wrote:
>> Changelog:
>> There are some changes from Marcelo and Gleb's review, thank you all!
>> - access indirect_shadow_pages in the protection of mmu-lock
>> - fix the issue when unhandleable instruction access on large page
>> - add a new test case for large page
>>
>> 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, these cases can not be detected:
>> - for tdp used
>>   currently, it refused to retry all instructions. If nested npt is used, the
>>   emulation may be caused by shadow page, it can be fixed by unshadow the
>>   shadow page.
>>
>> - for shadow mmu
>>   some cases are nested-write-protect, for example, if the page we want to
>>   write is used as PDE but it chains to itself. Under this case, we should
>>   stop the emulation and report the case to userspace.
>>
>> There are two test cases based on kvm-unit-test can trigger a infinite loop 
>> on
>> current code (ept = 0), after this patchset, it can report the error to Qemu.
>>
>> Subject: [PATCH] access test: test unhandleable instruction
>>
>> Test the instruction which can not be handled by kvm
>>
>> Signed-off-by: Xiao Guangrong 
> 
> Please submit the test for inclusion. There should be some way to make
> it fail.. 

Yes.

But it is not easy. If the test cases run normally, kvm will report a error to 
Qemu
then Qemu will exit the vcpu thread after dumping the vcpu state.

We need to do something to let guest can be aware that the error report is 
triggered.
I guess we can add a option in Qemu, say '-notify-guest' and allow Qemu to 
inject #GP
to guest with a special ERROR_CODE if error is reported.

> program a timer interrupt and #GP? 

Could you please explain the detail?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-12 Thread Xiao Guangrong
On 12/12/2012 07:36 AM, Marcelo Tosatti wrote:
 On Mon, Dec 10, 2012 at 05:11:35PM +0800, Xiao Guangrong wrote:
 Changelog:
 There are some changes from Marcelo and Gleb's review, thank you all!
 - access indirect_shadow_pages in the protection of mmu-lock
 - fix the issue when unhandleable instruction access on large page
 - add a new test case for large page

 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, these cases can not be detected:
 - for tdp used
   currently, it refused to retry all instructions. If nested npt is used, the
   emulation may be caused by shadow page, it can be fixed by unshadow the
   shadow page.

 - for shadow mmu
   some cases are nested-write-protect, for example, if the page we want to
   write is used as PDE but it chains to itself. Under this case, we should
   stop the emulation and report the case to userspace.

 There are two test cases based on kvm-unit-test can trigger a infinite loop 
 on
 current code (ept = 0), after this patchset, it can report the error to Qemu.

 Subject: [PATCH] access test: test unhandleable instruction

 Test the instruction which can not be handled by kvm

 Signed-off-by: Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com
 
 Please submit the test for inclusion. There should be some way to make
 it fail.. 

Yes.

But it is not easy. If the test cases run normally, kvm will report a error to 
Qemu
then Qemu will exit the vcpu thread after dumping the vcpu state.

We need to do something to let guest can be aware that the error report is 
triggered.
I guess we can add a option in Qemu, say '-notify-guest' and allow Qemu to 
inject #GP
to guest with a special ERROR_CODE if error is reported.

 program a timer interrupt and #GP? 

Could you please explain the detail?

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-11 Thread Marcelo Tosatti
On Mon, Dec 10, 2012 at 05:11:35PM +0800, Xiao Guangrong wrote:
> Changelog:
> There are some changes from Marcelo and Gleb's review, thank you all!
> - access indirect_shadow_pages in the protection of mmu-lock
> - fix the issue when unhandleable instruction access on large page
> - add a new test case for large page
> 
> 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, these cases can not be detected:
> - for tdp used
>   currently, it refused to retry all instructions. If nested npt is used, the
>   emulation may be caused by shadow page, it can be fixed by unshadow the
>   shadow page.
> 
> - for shadow mmu
>   some cases are nested-write-protect, for example, if the page we want to
>   write is used as PDE but it chains to itself. Under this case, we should
>   stop the emulation and report the case to userspace.
> 
> There are two test cases based on kvm-unit-test can trigger a infinite loop on
> current code (ept = 0), after this patchset, it can report the error to Qemu.
> 
> Subject: [PATCH] access test: test unhandleable instruction
> 
> Test the instruction which can not be handled by kvm
> 
> Signed-off-by: Xiao Guangrong 

Please submit the test for inclusion. There should be some way to make
it fail.. program a timer interrupt and #GP? 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/5] KVM: x86: improve reexecute_instruction

2012-12-11 Thread Marcelo Tosatti
On Mon, Dec 10, 2012 at 05:11:35PM +0800, Xiao Guangrong wrote:
 Changelog:
 There are some changes from Marcelo and Gleb's review, thank you all!
 - access indirect_shadow_pages in the protection of mmu-lock
 - fix the issue when unhandleable instruction access on large page
 - add a new test case for large page
 
 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, these cases can not be detected:
 - for tdp used
   currently, it refused to retry all instructions. If nested npt is used, the
   emulation may be caused by shadow page, it can be fixed by unshadow the
   shadow page.
 
 - for shadow mmu
   some cases are nested-write-protect, for example, if the page we want to
   write is used as PDE but it chains to itself. Under this case, we should
   stop the emulation and report the case to userspace.
 
 There are two test cases based on kvm-unit-test can trigger a infinite loop on
 current code (ept = 0), after this patchset, it can report the error to Qemu.
 
 Subject: [PATCH] access test: test unhandleable instruction
 
 Test the instruction which can not be handled by kvm
 
 Signed-off-by: Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com

Please submit the test for inclusion. There should be some way to make
it fail.. program a timer interrupt and #GP? 

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/