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] Re: xen crash in tmem: checking a xen pfn for domain own

To: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: Re: [Xen-devel] Re: xen crash in tmem: checking a xen pfn for domain ownership
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Tue, 21 Sep 2010 08:44:23 +0100
Cc: Xen-devel <Xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 21 Sep 2010 00:45:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <12d0043a-2042-4939-9489-8ec8a50ea785@default>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: ActZGGyaGL15ZOTASPieVdCrXHfHZQASGIep
Thread-topic: [Xen-devel] Re: xen crash in tmem: checking a xen pfn for domain ownership
User-agent: Microsoft-Entourage/12.26.0.100708
On 21/09/2010 00:03, "Dan Magenheimer" <dan.magenheimer@xxxxxxxxxx> wrote:

>     if ( is_hvm_domain(current->domain) )
>     {
>         xmfn = mfn_x(gfn_to_mfn_unshare(current->domain, cmfn, &t, 2));
>         if (t != p2m_ram_rw || xmfn == INVALID_MFN)
>             return NULL;
>     }
>     else
>     {
>         xmfn = cmfn;
>         if (!mfn_valid(xmfn))
>             return NULL;
>     }

This is needlessly cumbersome. You can do it without the if(is_hvm):

    xmfn = mfn_x(gfn_to_mfn(current->domain, cmfn, &t);
    if ((t != p2m_ram_rw) || !mfn_valid(xmfn))
        return NULL;

(Didn't use hfn_to_mfn_unshare as you have decided against it.)

Rest of the code looks fine.

 -- Keir



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