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

[Xen-devel] Re: mapping problems in xenpaging

To: Olaf Hering <olaf@xxxxxxxxx>
Subject: [Xen-devel] Re: mapping problems in xenpaging
From: zhen shi <bickys1986@xxxxxxxxx>
Date: Sat, 1 Oct 2011 11:52:21 +0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 30 Sep 2011 20:54:19 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=E33Ex2tofp6D1f3cT5aG/T9KB/lwyhG8jdxgH3a8Y0A=; b=ke/oEVSqvfbKF+p2Clac+XzrHhLpeoyfR8VSXFJcvCQtGaHnlx/VaedMFnZ8HA9hRh mKn5SDXp4sfUt9aBM3vy/2KQwCRWVKHtppg1/J3fQeo+/zm1n1YfurxzoeMmgnZWL5UD sZ9gNLE4hNTP/5U2CCv7LR4eTfpLVHoVCFg/g=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20110929170244.GA29163@xxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <CACavRyB4kvMLZK1-vv9bJnVdnpKJBHTmnhJxt6g3eh88xY6FTg@xxxxxxxxxxxxxx> <20110929170244.GA29163@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Olaf,maybe I didn't described the problems clearly.I will give an example.
a) In xen_vga_vram_map() of vga.c from tools/ioemu-qemu-xen/hw,  it uses xc_map_foreign_pages() to map a page's gfn address to dom0. If then the page is paged out and changed to zero page in xenpaging, and dom0 access the page such as using the mapped address, it will make mistakes.Am I right?
In brief,I mean there may be some conflicts in xc_map_foreign_pages from other functions and xenpaging feature when they access the same page.

b) In create_grant_pte_mapping() of mm.c from /xen/arch/x86, it uses gmfn_to_mfn() to get mfn, and then executes map_domain_page(mfn). At the same time, the page is paged_out and the mfn is changed to INVALID_MFN. So that in create_grant_pte_mapping () when it goes to mfn_to_page(mfn), it will make a mistake.Because xen didn't judge the mfn and thought the mfn was original.
I mean there may be some conflicts of operations after getting the mfn in xen but the page is paged_out in the meantime.


2011/9/30 Olaf Hering <olaf@xxxxxxxxx>
On Thu, Sep 29, zhen shi wrote:

>  Hi,Olaf,
>  
>  When we analyze and test xenpaging,we found there are some problems between
> mapping and xenpaging.
>  1) When mapping firstly, then do xenpaging,and the code paths have resolved
> the problems.It's OK.
>  2) The problems exists if we do address mapping firstly then go to
> xenpaging,and our confusions are as followings:
>    a) If the domU's memory is directly mapped to dom0,such as the hypercall
> from pv driver,then it will build a related page-table in dom0,which will not
> change p2m-type.
>       and then do the xenpaging to page out the domU's memory pages whose gfn
> address have been already mapped to dom0;So it will cause some problems when
> dom0
>       accesses these pages.Because these pages are paged-out,and dom0 cannot
> tell the p2mt before access the pages.

I'm not entirely sure what you do. xenpaging runs in dom0 and is able to
map paged-out pages. It uses that to trigger a page-in, see
tools/xenpaging/pagein.c in xen-unstable.hg

>   b)The another situation is that if xen has mapped the domU's page, and get
> the mfn according to pfn_to_mfn.But then the page's p2mt is changed by others,
> so when xen
>     accesses the page ,it will cause problems such as BSOD or reboot.Because
> the operations of getting mfn and accessing the page are not
> atomic.and the situation exists
>     in many code paths .

Can you be more specific what you mean? Xen doesnt seem to have a
pfn_to_mfn function, only the tools have some helper macros of that name.


Olaf

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>