Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Xen: Changelog

[qemu-xen-unstable] xendisk: set maximum number of grants to be used

 

 

Xen changelog RSS feed   Index | Next | Previous | View Threaded


patchbot at xen

Jun 29, 2012, 9:22 AM

Post #1 of 1 (54 views)
Permalink
[qemu-xen-unstable] xendisk: set maximum number of grants to be used

commit 94a7bdc2e7797df2dab1c26216349f66e0f3490a
Author: Jan Beulich <jbeulich [at] suse>
Date: Fri Jun 29 16:58:05 2012 +0100

xendisk: set maximum number of grants to be used

Legacy (non-pvops) gntdev drivers may require this to be done when the
number of grants intended to be used simultaneously exceeds a certain
driver specific default limit.

upstream-commit: 64c27e5b1fdb6d94bdc0bda3b1869d7383a35c65

Signed-off-by: Jan Beulich <jbeulich [at] suse>
Signed-off-by: Stefano Stabellini <stefano.stabellini [at] eu>
---
hw/xen_disk.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 1a0ae19..33a5531 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -570,6 +570,15 @@ static void blk_bh(void *opaque)
blk_handle_requests(blkdev);
}

+/*
+ * We need to account for the grant allocations requiring contiguous
+ * chunks; the worst case number would be
+ * max_req * max_seg + (max_req - 1) * (max_seg - 1) + 1,
+ * but in order to keep things simple just use
+ * 2 * max_req * max_seg.
+ */
+#define MAX_GRANTS(max_req, max_seg) (2 * (max_req) * (max_seg))
+
static void blk_alloc(struct XenDevice *xendev)
{
struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
@@ -580,6 +589,11 @@ static void blk_alloc(struct XenDevice *xendev)
blkdev->bh = qemu_bh_new(blk_bh, blkdev);
if (xen_mode != XEN_EMULATE)
batch_maps = 1;
+ if (xc_gnttab_set_max_grants(xendev->gnttabdev,
+ MAX_GRANTS(max_requests, BLKIF_MAX_SEGMENTS_PER_REQUEST)) < 0) {
+ xen_be_printf(xendev, 0, "xc_gnttab_set_max_grants failed: %s\n",
+ strerror(errno));
+ }
}

static int blk_init(struct XenDevice *xendev)
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog [at] lists
http://lists.xensource.com/xen-changelog

Xen changelog RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.