WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Execution Flow when Guest Page Fault

To: "Peter Teoh" <tthtlc@xxxxxxxxxxxxxx>,<xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Execution Flow when Guest Page Fault
From: Mats Petersson <mats@xxxxxxxxxxxxxxxxx>
Date: Sun, 29 Jul 2007 23:06:00 +0100
Delivery-date: Mon, 30 Jul 2007 10:01:58 -0700
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:x-mailer:date:to:from:subject:in-reply-to:references:mime-version:content-type:sender:message-id; b=n3JYvPTcB8oJssE9de2RHiNZj+qcADevMOWN2eN7i2DLlC7iwPDXkUVNg4QrsHLUX49wPqpZA7s2AuFcvInXSVcg+/VKU4dS8Igw0gqLt9grhIpmds0bCnyrzFhIWftbdOVQ2hFHvAIv1kwCuJ5QMIf7w6vk4GG7jxAyrJBMEs4=
Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:x-mailer:date:to:from:subject:in-reply-to:references:mime-version:content-type:sender:message-id; b=a2Ghrg23ryGy+qXhY/qNrmikVlBhOEN/PBjWOXp+Btvxcgj689Zr8phyYU7cTdj2tH1/2iPwDunuyW5d/6W1y1e8kAW0lu+SRf0oe34FJyBZQqKPqGzTUHTGULOg1VkxdGGBY/NkwDEhwClyM6d9a+CIJJ+9I9xEtk6j+TXKLV4=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <05ef01c7d1ed$c36fb200$3101a8c0@eeyore>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <05ef01c7d1ed$c36fb200$3101a8c0@eeyore>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
At 15:35 29/07/2007, Peter Teoh wrote:
I would like to know approximately the overall execution flow when the guest O/S page fault - how is the page fault transfer to a page fault in the host O/S?


I don't have source-code here, so I can't give you exactly which functions and where the code flows through. Here's what I can do "from memory".

It depends on whether you're running PV or HVM guest... Here is a brief run-through of both:

Paravirtual guest:
1. Page-fault in guest -> hypervisor page-fault handler (in arch/x86/x86_{32,64}/entry.S I think)
2. do_pagefault in hypervisor (arch/x86traps.c)
-- Here there are checks to see if the page-fault is "guest-fault" or "special case" - special case is handled by hypervisor and then seen as "fixed", so the guest will not see these faults. This is for example updates to the page-table itself, where the hypervisor needs to "check" the page-table entry to verify that the guest isn't doing something wrong (like mapping memory that doesn't belong to the guest) 3. If the page-fault isn't "special", the hypervisor forwards the call to the guest. In PV-mode, the hypervisor is given a "callback" by the guest to handle any faults the guest can accept, so a guest page-fault-handler is given by this function (called something like set_trap, I think).

Fully virtual guest (this refers to SVM code, but the VT (VMX) code is nearly identical, so you should be able to follow the path there by replacing SVM with VMX in relevant places): 1. #VMEXIT with page-fault exitcode (0x4E from memory) - ends up at the instruction after "VMRUN" in arch/x86/hvm/svm/x86_{32,64}/exits.S
2. svm_do_pagefault()
3. shadow_fault()
4. If page-fault not dealt with in shadow-fault (which also deals with special page-faults such as page-table updates and MMIO hardware emulation), it is forwarded to the guest via the "inject exception" mechanism (svm_inject_exception ?).
5. vmrun in .../exits.S

[paths are relative to the "xen" directory in the source tree]

There has been other discussions on this subject in the past, so some searching in the archive may give you some more info and ideas.

--
Mats


Thanks.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>