Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-21 Thread Avi Kivity
On 01/20/2010 07:18 PM, Rik van Riel wrote: On 01/20/2010 07:00 AM, Avi Kivity wrote: On 01/20/2010 12:02 PM, Gleb Natapov wrote: I can inject the event as HW interrupt on vector greater then 32 but not go through APIC so EOI will not be required. This sounds non-architectural and I am not

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-21 Thread Avi Kivity
On 01/20/2010 08:45 PM, H. Peter Anvin wrote: On 01/20/2010 04:00 AM, Avi Kivity wrote: On 01/20/2010 12:02 PM, Gleb Natapov wrote: I can inject the event as HW interrupt on vector greater then 32 but not go through APIC so EOI will not be required. This sounds non-architectural and

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-21 Thread Avi Kivity
On 01/20/2010 07:43 PM, H. Peter Anvin wrote: On 01/20/2010 02:02 AM, Gleb Natapov wrote: You can have the guest OS take an exception on a vector above 31 just fine; you just need it to tell the hypervisor which vector it, the OS, assigned for this purpose. VMX doesn't allow to inject

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-21 Thread Gleb Natapov
On Thu, Jan 21, 2010 at 11:02:19AM +0200, Avi Kivity wrote: On 01/20/2010 07:43 PM, H. Peter Anvin wrote: On 01/20/2010 02:02 AM, Gleb Natapov wrote: You can have the guest OS take an exception on a vector above 31 just fine; you just need it to tell the hypervisor which vector it, the OS,

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-21 Thread Avi Kivity
On 01/21/2010 11:04 AM, Gleb Natapov wrote: Do you mean create the stack frame manually? I'd really like to avoid that for many reasons, one of which is performance (need to do all the virt-to-phys walks manually), the other is that we're certain to end up with something horribly

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-21 Thread H. Peter Anvin
On 01/21/2010 01:02 AM, Avi Kivity wrote: You can also just emulate the state transition -- since you know you're dealing with a flat protected-mode or long-mode OS (and just make that a condition of enabling the feature) you don't have to deal with all the strange combinations of directions

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-21 Thread Gleb Natapov
On Thu, Jan 21, 2010 at 07:47:22AM -0800, H. Peter Anvin wrote: On 01/21/2010 01:02 AM, Avi Kivity wrote: You can also just emulate the state transition -- since you know you're dealing with a flat protected-mode or long-mode OS (and just make that a condition of enabling the feature) you

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-20 Thread Gleb Natapov
On Tue, Jan 19, 2010 at 12:10:17PM -0800, H. Peter Anvin wrote: On 01/19/2010 09:44 AM, Gleb Natapov wrote: Yes it can be done this way and I'll look into it once more. Using exception vector is more convenient for three reasons: it allows to pass additional data in error code, it

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-20 Thread Avi Kivity
On 01/20/2010 12:02 PM, Gleb Natapov wrote: I can inject the event as HW interrupt on vector greater then 32 but not go through APIC so EOI will not be required. This sounds non-architectural and I am not sure kernel has entry point code for this kind of event, it has one for exception and one

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-20 Thread Rik van Riel
On 01/20/2010 07:00 AM, Avi Kivity wrote: On 01/20/2010 12:02 PM, Gleb Natapov wrote: I can inject the event as HW interrupt on vector greater then 32 but not go through APIC so EOI will not be required. This sounds non-architectural and I am not sure kernel has entry point code for this kind

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-20 Thread H. Peter Anvin
On 01/20/2010 02:02 AM, Gleb Natapov wrote: You can have the guest OS take an exception on a vector above 31 just fine; you just need it to tell the hypervisor which vector it, the OS, assigned for this purpose. VMX doesn't allow to inject hardware exception with vector greater then 31. SDM

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-20 Thread H. Peter Anvin
On 01/20/2010 04:00 AM, Avi Kivity wrote: On 01/20/2010 12:02 PM, Gleb Natapov wrote: I can inject the event as HW interrupt on vector greater then 32 but not go through APIC so EOI will not be required. This sounds non-architectural and I am not sure kernel has entry point code for this

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-19 Thread H. Peter Anvin
On 01/18/2010 10:55 PM, Gleb Natapov wrote: What I mean is that vector 14 is page faults -- that's what it is all about. Why on Earth do you need another vector? Because this is not usual pagefault that tell the OS that page is not mapped. This is a notification to a guest OS that the page

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-19 Thread Gleb Natapov
On Tue, Jan 19, 2010 at 09:03:20AM -0800, H. Peter Anvin wrote: On 01/18/2010 10:55 PM, Gleb Natapov wrote: What I mean is that vector 14 is page faults -- that's what it is all about. Why on Earth do you need another vector? Because this is not usual pagefault that tell the OS that

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-19 Thread H. Peter Anvin
On 01/19/2010 09:44 AM, Gleb Natapov wrote: Yes it can be done this way and I'll look into it once more. Using exception vector is more convenient for three reasons: it allows to pass additional data in error code, it doesn't require guest to issue EOI, exception can be injected when

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-18 Thread H. Peter Anvin
On 01/17/2010 06:44 AM, Gleb Natapov wrote: On Thu, Jan 14, 2010 at 06:31:07PM +0100, Peter Zijlstra wrote: On Tue, 2010-01-05 at 16:12 +0200, Gleb Natapov wrote: Allow paravirtualized guest to do special handling for some page faults. The patch adds one 'if' to do_page_fault() function. The

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-18 Thread Gleb Natapov
On Mon, Jan 18, 2010 at 12:34:16AM -0800, H. Peter Anvin wrote: On 01/17/2010 06:44 AM, Gleb Natapov wrote: On Thu, Jan 14, 2010 at 06:31:07PM +0100, Peter Zijlstra wrote: On Tue, 2010-01-05 at 16:12 +0200, Gleb Natapov wrote: Allow paravirtualized guest to do special handling for some page

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-18 Thread Andi Kleen
Peter Zijlstra pet...@infradead.org writes: Whatever are we doing to end up in do_page_fault() as it stands? Surely we can tell the CPU to go elsewhere to handle faults? Isn't that as simple as calling set_intr_gate(14, my_page_fault) somewhere on the cpuinit instead of the regular

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-18 Thread H. Peter Anvin
On 01/18/2010 12:50 AM, Gleb Natapov wrote: On Mon, Jan 18, 2010 at 12:34:16AM -0800, H. Peter Anvin wrote: On 01/17/2010 06:44 AM, Gleb Natapov wrote: On Thu, Jan 14, 2010 at 06:31:07PM +0100, Peter Zijlstra wrote: On Tue, 2010-01-05 at 16:12 +0200, Gleb Natapov wrote: Allow paravirtualized

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-18 Thread Gleb Natapov
On Mon, Jan 18, 2010 at 05:53:53PM -0800, H. Peter Anvin wrote: On 01/18/2010 12:50 AM, Gleb Natapov wrote: On Mon, Jan 18, 2010 at 12:34:16AM -0800, H. Peter Anvin wrote: On 01/17/2010 06:44 AM, Gleb Natapov wrote: On Thu, Jan 14, 2010 at 06:31:07PM +0100, Peter Zijlstra wrote: On Tue,

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-17 Thread Gleb Natapov
On Thu, Jan 14, 2010 at 06:31:07PM +0100, Peter Zijlstra wrote: On Tue, 2010-01-05 at 16:12 +0200, Gleb Natapov wrote: Allow paravirtualized guest to do special handling for some page faults. The patch adds one 'if' to do_page_fault() function. The call is patched out when running on

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-17 Thread Peter Zijlstra
On Sun, 2010-01-17 at 16:44 +0200, Gleb Natapov wrote: On Thu, Jan 14, 2010 at 06:31:07PM +0100, Peter Zijlstra wrote: On Tue, 2010-01-05 at 16:12 +0200, Gleb Natapov wrote: Allow paravirtualized guest to do special handling for some page faults. The patch adds one 'if' to

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-17 Thread Gleb Natapov
On Sun, Jan 17, 2010 at 04:09:40PM +0100, Peter Zijlstra wrote: On Sun, 2010-01-17 at 16:44 +0200, Gleb Natapov wrote: On Thu, Jan 14, 2010 at 06:31:07PM +0100, Peter Zijlstra wrote: On Tue, 2010-01-05 at 16:12 +0200, Gleb Natapov wrote: Allow paravirtualized guest to do special handling

Re: [PATCH v3 04/12] Add handle page fault PV helper.

2010-01-14 Thread Peter Zijlstra
On Tue, 2010-01-05 at 16:12 +0200, Gleb Natapov wrote: Allow paravirtualized guest to do special handling for some page faults. The patch adds one 'if' to do_page_fault() function. The call is patched out when running on physical HW. I ran kernbech on the kernel with and without that

[PATCH v3 04/12] Add handle page fault PV helper.

2010-01-05 Thread Gleb Natapov
Allow paravirtualized guest to do special handling for some page faults. The patch adds one 'if' to do_page_fault() function. The call is patched out when running on physical HW. I ran kernbech on the kernel with and without that additional 'if' and result were rawly the same: With 'if':