xen device driver updates
Subsystems (4)
PATCH 1/1 xen device driver updates
Hi,
This is a series of cleanups to xen-blkfront, xen-netfront and xenbus. They're mostly changes imported from the linux-2.6.18-xen repo because they looked like they would be useful.
Thanks,
J
drivers/block/xen-blkfront.c | 48 ++++++++++++++++++++++++++--- drivers/net/xen-netfront.c | 4 +- drivers/xen/xenbus/xenbus_client.c | 2 - drivers/xen/xenbus/xenbus_xs.c | 10 +++--- 4 files changed, 52 insertions(+), 12 deletions(-)
PATCH 1/1 xen/blkfront: Make sure that the device is fully ready before allowing release
From: Wim Colgate <[email protected]>
[ linux-2.6.18-xen changeset c1c57fea77e9 ]
--- drivers/block/xen-blkfront.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/xen-blkfront.c +1 -1
@@ -997,7 +997,7 @@struct xenbus_device *dev = info->xbdev;enum xenbus_state state =xenbus_read_driver_state (dev->otherend); -if (state == XenbusStateClosing) +if (state == XenbusStateClosing && info->is_ready)blkfront_closing (dev); }return 0 ;
PATCH 1/1 xen/blkfront: Make sure we don't use bounce buffers, we don't need them
In reply to Jeremy FitzhardingeFrom: Ian Campbell <[email protected]>
[ linux-2.6.18-xen changeset 667228bf8fc5 ]
--- drivers/block/xen-blkfront.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/block/xen-blkfront.c +3 -0
@@ -324,6 +324,9 @@/* Make sure buffer addresses are sector-aligned. */ blk_queue_dma_alignment (rq,511 ); +/* Make sure we don't use bounce buffers. */ +blk_queue_bounce_limit (rq,BLK_BOUNCE_ANY ); + gd->queue = rq;return 0 ;
PATCH 1/1 xen/blkfront: add __exit to module_exit() handlers
In reply to Jeremy FitzhardingeFrom: Jan Beulich <[email protected]>
--- drivers/block/xen-blkfront.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/xen-blkfront.c +1 -1
@@ -1045,7 +1045,7 @@module_init (xlblk_init); -static void xlblk_exit (void ) +static void __exit xlblk_exit(void) {return xenbus_unregister_driver (&blkfront); }
PATCH 1/1 xn/blkfront: Add the CDROM_GET_CAPABILITY ioctl to blkfront
In reply to Jeremy FitzhardingeFrom: Christian Limpach <[email protected]>
Return 0 instead of -EINVAL if the blkfront device is a cdrom, i.e. had the VDISK_CDROM attribute. This allows udev's cdrom_id to correctly detect the device as a cdrom device.
[ Add blkif_ioctl, and CDROMMULTISESSION ]
[ linux-2.6.18-xen changeset d2bd9af846b5 ]
--- drivers/block/xen-blkfront.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/block/xen-blkfront.c +36 -0
@@ -38,6 +38,7 @@#include <linux/interrupt.h> #include <linux/blkdev.h> #include <linux/hdreg.h> +#include <linux/cdrom.h> #include <linux/module.h> #include <xen/xenbus.h>
@@ -150,6 +151,40 @@ hg->cylinders = cylinders;if ((sector_t)(hg->cylinders +1 ) * hg->heads * hg->sectors < nsect) hg->cylinders =0xffff ; +return 0 ; +} + +int blkif_ioctl (struct inode *inode,struct file *filep, +unsigned command,unsigned long argument) +{ +struct blkfront_info *info = + inode->i_bdev->bd_disk->private_data; +int i; + +dev_dbg (&info->xbdev->dev,"command: 0x%x, argument: 0x%lx\n" , + command, (long )argument); + +switch (command) { +case CDROMMULTISESSION : +dev_dbg (&info->xbdev->dev,"FIXME: support multisession CDs later\n" ); +for (i =0 ; i <sizeof (struct cdrom_multisession ); i++) +if (put_user (0 , (char __user *)(argument + i))) +return -EFAULT ; +return 0 ; + +case CDROM_GET_CAPABILITY : { +struct gendisk *gd = info->gd; +if (gd->flags &GENHD_FL_CD ) +return 0 ; +return -EINVAL ; + } + +default : +/*printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n", +command);*/ +return -EINVAL ;/* same return as native Linux */ + } +return 0 ; }
@@ -974,6 +1009,7 @@ .open = blkif_open, .release = blkif_release, .getgeo = blkif_getgeo, + .ioctl = blkif_ioctl, };
PATCH 1/1 xen: Avoid allocations causing swap activity on the resume path
In reply to Jeremy FitzhardingeFrom: Ian Campbell <[email protected]>
Avoid allocations causing swap activity on the resume path by allowing such allocations to access the emergency pools otherwise a save/restore/migration of a guest which is low on memory can deadlock.
[ linux-2.6.18-xen changesets e8b49cfbdac, fdb998e79aba ]
--- drivers/block/xen-blkfront.c | 5 +++-- drivers/net/xen-netfront.c | 4 ++-- drivers/xen/xenbus/xenbus_client.c | 2 +- drivers/xen/xenbus/xenbus_xs.c | 10 +++++----- 4 files changed, 11 insertions(+), 10 deletions(-)
drivers/block/xen-blkfront.c +3 -2
@@ -584,7 +584,7 @@ info->ring_ref =GRANT_INVALID_REF ; - sring = (struct blkif_sring *)__get_free_page (GFP_KERNEL ); + sring = (struct blkif_sring *)__get_free_page (GFP_KERNEL | __GFP_HIGH);if (!sring) {xenbus_dev_fatal (dev, -ENOMEM ,"allocating shared ring" );return -ENOMEM ;
@@ -741,7 +741,8 @@int j;/* Stage 1: Make a safe copy of the shadow state. */ - copy =kmalloc (sizeof (info->shadow),GFP_KERNEL ); + copy =kmalloc (sizeof (info->shadow), +GFP_KERNEL | __GFP_NOFAIL | __GFP_HIGH);if (!copy)return -ENOMEM ;memcpy (copy, info->shadow,sizeof (info->shadow));
drivers/net/xen-netfront.c +2 -2
@@ -1324,7 +1324,7 @@ goto fail; } - txs = (struct xen_netif_tx_sring *)get_zeroed_page (GFP_KERNEL ); + txs = (struct xen_netif_tx_sring *)get_zeroed_page (GFP_KERNEL | __GFP_HIGH);if (!txs) { err = -ENOMEM ;xenbus_dev_fatal (dev, err,"allocating tx ring page" );
@@ -1340,7 +1340,7 @@ } info->tx_ring_ref = err; - rxs = (struct xen_netif_rx_sring *)get_zeroed_page (GFP_KERNEL ); + rxs = (struct xen_netif_rx_sring *)get_zeroed_page (GFP_KERNEL | __GFP_HIGH);if (!rxs) { err = -ENOMEM ;xenbus_dev_fatal (dev, err,"allocating rx ring page" );
drivers/xen/xenbus/xenbus_client.c +1 -1
@@ -117,7 +117,7 @@char *path;va_start (ap, pathfmt); - path =kvasprintf (GFP_KERNEL , pathfmt, ap); + path =kvasprintf (GFP_KERNEL | __GFP_HIGH, pathfmt, ap);va_end (ap);if (!path) {
drivers/xen/xenbus/xenbus_xs.c +5 -5
@@ -283,9 +283,9 @@char *buffer;if (strlen (name) ==0 ) - buffer =kasprintf (GFP_KERNEL ,"%s" , dir); + buffer =kasprintf (GFP_KERNEL | __GFP_HIGH,"%s" , dir);else - buffer =kasprintf (GFP_KERNEL ,"%s/%s" , dir, name); + buffer =kasprintf (GFP_KERNEL | __GFP_HIGH,"%s/%s" , dir, name);return (!buffer) ?ERR_PTR (-ENOMEM ) : buffer; }
@@ -297,7 +297,7 @@ *num =count_strings (strings, len);/* Transfer to one big alloc for easy freeing. */ - ret =kmalloc (*num *sizeof (char *) + len,GFP_KERNEL ); + ret =kmalloc (*num *sizeof (char *) + len,GFP_KERNEL | __GFP_HIGH);if (!ret) {kfree (strings);return ERR_PTR (-ENOMEM );
@@ -751,7 +751,7 @@ } - msg =kmalloc (sizeof (*msg),GFP_KERNEL ); + msg =kmalloc (sizeof (*msg),GFP_KERNEL | __GFP_HIGH);if (msg ==NULL ) { err = -ENOMEM ; goto out;
@@ -763,7 +763,7 @@ goto out; } - body =kmalloc (msg->hdr.len +1 ,GFP_KERNEL ); + body =kmalloc (msg->hdr.len +1 ,GFP_KERNEL | __GFP_HIGH);if (body ==NULL ) {kfree (msg); err = -ENOMEM ;