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

[Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg (staging)



# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1189101958 21600
# Node ID d796a96253a23957b61b07c73301768da6f970ec
# Parent  438379d47b24feb72cdd7457f377358d828d1c2a
# Parent  f30b59f550c2ac03734c7a8cb63f658f16ca087a
merge with linux-2.6.18-xen.hg (staging)
---
 drivers/xen/core/xencomm.c    |   57 +++++++++++++++++++++++++++++++-----------
 drivers/xen/evtchn/evtchn.c   |    6 ++--
 drivers/xen/gntdev/gntdev.c   |    8 ++---
 drivers/xen/netfront/accel.c  |   12 +++++++-
 drivers/xen/privcmd/privcmd.c |    8 ++---
 5 files changed, 64 insertions(+), 27 deletions(-)

diff -r 438379d47b24 -r d796a96253a2 drivers/xen/core/xencomm.c
--- a/drivers/xen/core/xencomm.c        Thu Sep 06 09:09:53 2007 -0600
+++ b/drivers/xen/core/xencomm.c        Thu Sep 06 12:05:58 2007 -0600
@@ -68,25 +68,54 @@ static int xencomm_init(struct xencomm_d
        return 0;
 }
 
-/* XXX use slab allocator */
-static struct xencomm_desc *xencomm_alloc(gfp_t gfp_mask)
-{
-       struct xencomm_desc *desc;
-
-       desc = (struct xencomm_desc *)__get_free_page(gfp_mask);
-       if (desc == NULL)
-               return NULL;
-
-       desc->nr_addrs = (PAGE_SIZE - sizeof(struct xencomm_desc)) /
+static struct xencomm_desc *xencomm_alloc(gfp_t gfp_mask,
+                                         void *buffer, unsigned long bytes)
+{
+       struct xencomm_desc *desc;
+       unsigned long buffer_ulong = (unsigned long)buffer;
+       unsigned long start = buffer_ulong & PAGE_MASK;
+       unsigned long end = (buffer_ulong + bytes) | ~PAGE_MASK;
+       unsigned long nr_addrs = (end - start + 1) >> PAGE_SHIFT;
+       unsigned long size = sizeof(*desc) +
+               sizeof(desc->address[0]) * nr_addrs;
+
+       /*
+        * slab allocator returns at least sizeof(void*) aligned pointer.
+        * When sizeof(*desc) > sizeof(void*), struct xencomm_desc might
+        * cross page boundary.
+        */
+       if (sizeof(*desc) > sizeof(void*)) {
+               unsigned long order = get_order(size);
+               desc = (struct xencomm_desc *)__get_free_pages(gfp_mask,
+                                                              order);
+               if (desc == NULL)
+                       return NULL;
+
+               desc->nr_addrs =
+                       ((PAGE_SIZE << order) - sizeof(struct xencomm_desc)) /
                        sizeof(*desc->address);
-
+       } else {
+               desc = kmalloc(size, gfp_mask);
+               if (desc == NULL)
+                       return NULL;
+
+               desc->nr_addrs = nr_addrs;
+       }
        return desc;
 }
 
 void xencomm_free(struct xencomm_handle *desc)
 {
-       if (desc && !((ulong)desc & XENCOMM_INLINE_FLAG))
-               free_page((unsigned long)__va(desc));
+       if (desc && !((ulong)desc & XENCOMM_INLINE_FLAG)) {
+               struct xencomm_desc *desc__ = (struct xencomm_desc*)desc;
+               if (sizeof(*desc__) > sizeof(void*)) {
+                       unsigned long size = sizeof(*desc__) +
+                               sizeof(desc__->address[0]) * desc__->nr_addrs;
+                       unsigned long order = get_order(size);
+                       free_pages((unsigned long)__va(desc), order);
+               } else
+                       kfree(__va(desc));
+       }
 }
 
 static int xencomm_create(void *buffer, unsigned long bytes, struct 
xencomm_desc **ret, gfp_t gfp_mask)
@@ -105,7 +134,7 @@ static int xencomm_create(void *buffer, 
 
        BUG_ON(buffer == NULL); /* 'bytes' is non-zero */
 
-       desc = xencomm_alloc(gfp_mask);
+       desc = xencomm_alloc(gfp_mask, buffer, bytes);
        if (!desc) {
                printk("%s failure\n", "xencomm_alloc");
                return -ENOMEM;
diff -r 438379d47b24 -r d796a96253a2 drivers/xen/evtchn/evtchn.c
--- a/drivers/xen/evtchn/evtchn.c       Thu Sep 06 09:09:53 2007 -0600
+++ b/drivers/xen/evtchn/evtchn.c       Thu Sep 06 12:05:58 2007 -0600
@@ -208,8 +208,8 @@ static void evtchn_bind_to_user(struct p
        spin_unlock_irq(&port_user_lock);
 }
 
-static int evtchn_ioctl(struct inode *inode, struct file *file,
-                       unsigned int cmd, unsigned long arg)
+static long evtchn_ioctl(struct file *file,
+                        unsigned int cmd, unsigned long arg)
 {
        int rc;
        struct per_user_data *u = file->private_data;
@@ -423,7 +423,7 @@ static const struct file_operations evtc
        .owner   = THIS_MODULE,
        .read    = evtchn_read,
        .write   = evtchn_write,
-       .ioctl   = evtchn_ioctl,
+       .unlocked_ioctl = evtchn_ioctl,
        .poll    = evtchn_poll,
        .fasync  = evtchn_fasync,
        .open    = evtchn_open,
diff -r 438379d47b24 -r d796a96253a2 drivers/xen/gntdev/gntdev.c
--- a/drivers/xen/gntdev/gntdev.c       Thu Sep 06 09:09:53 2007 -0600
+++ b/drivers/xen/gntdev/gntdev.c       Thu Sep 06 12:05:58 2007 -0600
@@ -133,7 +133,7 @@ static int gntdev_open(struct inode *ino
 static int gntdev_open(struct inode *inode, struct file *flip);
 static int gntdev_release(struct inode *inode, struct file *flip);
 static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma);
-static int gntdev_ioctl (struct inode *inode, struct file *flip,
+static long gntdev_ioctl(struct file *flip,
                         unsigned int cmd, unsigned long arg);
 
 static struct file_operations gntdev_fops = {
@@ -141,7 +141,7 @@ static struct file_operations gntdev_fop
        .open = gntdev_open,
        .release = gntdev_release,
        .mmap = gntdev_mmap,
-       .ioctl = gntdev_ioctl
+       .unlocked_ioctl = gntdev_ioctl
 };
 
 /* VM operations. */
@@ -774,8 +774,8 @@ static void gntdev_vma_close(struct vm_a
 
 /* Called when an ioctl is made on the device.
  */
-static int gntdev_ioctl(struct inode *inode, struct file *flip,
-                       unsigned int cmd, unsigned long arg)
+static long gntdev_ioctl(struct file *flip,
+                        unsigned int cmd, unsigned long arg)
 {
        int rc = 0;
        gntdev_file_private_data_t *private_data = 
diff -r 438379d47b24 -r d796a96253a2 drivers/xen/netfront/accel.c
--- a/drivers/xen/netfront/accel.c      Thu Sep 06 09:09:53 2007 -0600
+++ b/drivers/xen/netfront/accel.c      Thu Sep 06 12:05:58 2007 -0600
@@ -45,6 +45,14 @@
 #define WPRINTK(fmt, args...)                          \
        printk(KERN_WARNING "netfront/accel: " fmt, ##args)
 
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 5)
+#define kref_init(x,y) kref_init(x,y)
+#define kref_put(x,y)  kref_put(x)
+#else
+#define kref_init(x,y) kref_init(x)
+#define kref_put(x,y)  kref_put(x,y)
+#endif
+
 /*
  * List of all netfront accelerator plugin modules available.  Each
  * list entry is of type struct netfront_accelerator.
@@ -176,7 +184,7 @@ accelerator_set_vif_state_hooks(struct n
         */
        kref_get(&vif_state->np->accelerator->accel_kref);
        /* This persists until vif_state->hooks are cleared */
-       kref_init(&vif_state->vif_kref);
+       kref_init(&vif_state->vif_kref, vif_kref_release);
 
        /* Make sure there are no data path operations going on */
        netif_poll_disable(vif_state->np->netdev);
@@ -318,7 +326,7 @@ accelerator_probe_vifs(struct netfront_a
         * persist until the accelerator hooks are removed (e.g. by
         * accelerator module unload)
         */
-       kref_init(&accelerator->accel_kref);
+       kref_init(&accelerator->accel_kref, accel_kref_release);
 
        /* 
         * Store the hooks for future calls to probe a new device, and
diff -r 438379d47b24 -r d796a96253a2 drivers/xen/privcmd/privcmd.c
--- a/drivers/xen/privcmd/privcmd.c     Thu Sep 06 09:09:53 2007 -0600
+++ b/drivers/xen/privcmd/privcmd.c     Thu Sep 06 12:05:58 2007 -0600
@@ -37,8 +37,8 @@ static int privcmd_enforce_singleshot_ma
 static int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma);
 #endif
 
-static int privcmd_ioctl(struct inode *inode, struct file *file,
-                        unsigned int cmd, unsigned long data)
+static long privcmd_ioctl(struct file *file,
+                         unsigned int cmd, unsigned long data)
 {
        int ret = -ENOSYS;
        void __user *udata = (void __user *) data;
@@ -250,8 +250,8 @@ static int privcmd_enforce_singleshot_ma
 #endif
 
 static const struct file_operations privcmd_file_ops = {
-       .ioctl = privcmd_ioctl,
-       .mmap  = privcmd_mmap,
+       .unlocked_ioctl = privcmd_ioctl,
+       .mmap = privcmd_mmap,
 };
 
 static int capabilities_read(char *page, char **start, off_t off,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.