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

From: Gleb Natapov
Date: Tue Jan 19 2010 - 01:56:18 EST

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, 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 additional 'if' and result were rawly the same:
> >>>>
> >>>> So why not program a different handler address for the #PF/#GP faults
> >>>> and avoid the if all together?
> >>> I would gladly use fault vector reserved by x86 architecture, but I am
> >>> not sure Intel will be happy about it.
> >>>
> >>
> >> That's what it's there for... see Peter Z.'s response.
> >>
> > Do you mean I can use one of exception vectors reserved by Intel
> > (20-31)? What Peter Z says is that I can register my own handler for
> > #PF and avoid the 'if' in non PV case as far as I understand him.
> >
> 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 it is trying
to access is swapped out by the host OS. There is nothing guest can do
about it except schedule another task. So the guest should handle both
type of exceptions: usual #PF when page is not mapped by the guest and
new type of notifications. Ideally we would use one of unused exception
vectors for new type of notifications.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at