[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxc: implement gnttab.set_max_grants for Linux


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Tue, 15 May 2012 07:11:09 +0000
  • Delivery-date: Tue, 15 May 2012 07:11:18 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1337008833 -3600
# Node ID 49ce39c88aeeb0ba58e4f0e2bf865f6981f6e99d
# Parent  ba837f25e256ac7959feba36415eab6ba6f63139
libxc: implement gnttab.set_max_grants for Linux

Legacy (non-pvops) gntdev drivers may require this operation to be
performed when the number of grants intended to be used simultaneously
exceeds a certain driver specific default limit, and qemu's qdisk
driver is an example of needing to do so.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r ba837f25e256 -r 49ce39c88aee tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c      Mon May 14 16:17:46 2012 +0100
+++ b/tools/libxc/xc_linux_osdep.c      Mon May 14 16:20:33 2012 +0100
@@ -559,6 +559,27 @@ static int linux_gnttab_close(xc_gnttab 
     return close(fd);
 }
 
+static int linux_gnttab_set_max_grants(xc_gnttab *xch, xc_osdep_handle h,
+                                       uint32_t count)
+{
+    int fd = (int)h, rc;
+    struct ioctl_gntdev_set_max_grants max_grants = { .count = count };
+
+    rc = ioctl(fd, IOCTL_GNTDEV_SET_MAX_GRANTS, &max_grants);
+    if (rc) {
+        /*
+         * Newer (e.g. pv-ops) kernels don't implement this IOCTL,
+         * so ignore the resulting specific failure.
+         */
+        if (errno == ENOTTY)
+            rc = 0;
+        else
+            PERROR("linux_gnttab_set_max_grants: ioctl SET_MAX_GRANTS failed");
+    }
+
+    return rc;
+}
+
 static void *linux_gnttab_grant_map(xc_gnttab *xch, xc_osdep_handle h,
                                     uint32_t count, int flags, int prot,
                                     uint32_t *domids, uint32_t *refs,
@@ -714,6 +735,7 @@ static struct xc_osdep_ops linux_gnttab_
     .close = &linux_gnttab_close,
 
     .u.gnttab = {
+        .set_max_grants = linux_gnttab_set_max_grants,
         .grant_map = &linux_gnttab_grant_map,
         .munmap = &linux_gnttab_munmap,
     },

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.