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] [PATCH] minios: Fix bug when blkfront reading into zero-mapp

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] minios: Fix bug when blkfront reading into zero-mapped buffer
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Tue, 29 Jan 2008 14:12:20 +0000
Delivery-date: Tue, 29 Jan 2008 06:13:28 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
minios: Fix bug when blkfront reading into zero-mapped buffer
by just poking the page.
No need to use virtual_to_mfn() for the ring since that is a real page.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

diff -r 807502236560 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Tue Jan 29 14:07:26 2008 +0000
+++ b/extras/mini-os/blkfront.c Tue Jan 29 14:07:32 2008 +0000
@@ -102,7 +102,7 @@ struct blkfront_dev *init_blkfront(char 
     SHARED_RING_INIT(s);
     FRONT_RING_INIT(&dev->ring, s, PAGE_SIZE);
 
-    dev->ring_ref = gnttab_grant_access(0,virtual_to_mfn(s),0);
+    dev->ring_ref = gnttab_grant_access(0,virt_to_mfn(s),0);
 
     evtchn_alloc_unbound_t op;
     op.dom = DOMID_SELF;
@@ -288,6 +288,11 @@ void blkfront_aio(struct blkfront_aiocb 
 
     for (j = 0; j < n; j++) {
        uintptr_t data = start + j * PAGE_SIZE;
+        if (!write) {
+            /* Trigger CoW if needed */
+            *(char*)data = 0;
+            barrier();
+        }
        aiocbp->gref[j] = req->seg[j].gref =
             gnttab_grant_access(0, virtual_to_mfn(data), write);
        req->seg[j].first_sect = 0;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] minios: Fix bug when blkfront reading into zero-mapped buffer, Samuel Thibault <=