All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] minios: Fix bug when blkfront reading into zero-mapped buffer
Date: Tue, 29 Jan 2008 14:12:20 +0000	[thread overview]
Message-ID: <20080129141220.GA16376@implementation.uk.xensource.com> (raw)

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@eu.citrix.com>

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;

                 reply	other threads:[~2008-01-29 14:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080129141220.GA16376@implementation.uk.xensource.com \
    --to=samuel.thibault@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.