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-changelog] [xen-unstable] stubdom: mmap on /dev

To: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Re: [Xen-changelog] [xen-unstable] stubdom: mmap on /dev/mem support
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
Date: Wed, 21 Oct 2009 18:13:14 +0200
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "xen-changelog@xxxxxxxxxxxxxxxxxxx" <xen-changelog@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 21 Oct 2009 09:13:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.0910211657340.15538@kaball-desktop>
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>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "xen-changelog@xxxxxxxxxxxxxxxxxxx" <xen-changelog@xxxxxxxxxxxxxxxxxxx>
References: <200910211510.n9LFAGT7019922@xxxxxxxxxxxxxxxxxxxxx> <20091021153649.GM4693@xxxxxxxxxxxxxxxxxxxxxxx> <alpine.DEB.2.00.0910211657340.15538@kaball-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
Optimize mmap(open("/dev/mem"))

Set map_frames_ex's stride parameter to 0 and increment to 1 to avoid
building an explicit list of mfns.

Signed-Off-By: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

diff -r 37829fd7c1e3 extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c  Wed Oct 21 16:08:28 2009 +0100
+++ b/extras/mini-os/lib/sys.c  Wed Oct 21 18:10:33 2009 +0200
@@ -1256,11 +1268,8 @@
         unsigned long zero = 0;
         return map_frames_ex(&zero, n, 0, 0, 1, DOMID_SELF, 0, 0);
     } else if (files[fd].type == FTYPE_MEM) {
-        int i;
-        unsigned long mfns[n];
-        for (i = 0; i < n; i++)
-            mfns[i] = ((unsigned long) offset + (i * PAGE_SIZE)) >> PAGE_SHIFT;
-        return map_frames_ex(mfns, n, 1, 0, 1, DOMID_IO, 0, 
_PAGE_PRESENT|_PAGE_RW);
+        unsigned long first_mfn = offset >> PAGE_SHIFT;
+        return map_frames_ex(&first_mfn, n, 0, 1, 1, DOMID_IO, 0, 
_PAGE_PRESENT|_PAGE_RW);
     } else ASSERT(0);
 }
 

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

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