1 vhost-net: extend device allocation to vmalloc
3 Backport upstream commit 23cc5a991c7a9fb7e6d6550e65cee4f4173111c5 to
5 In upstream, this code is modified later in patch
6 d04257b07f2362d4eb550952d5bf5f4241a8046d, but it's unapplicable in 3.10
7 because there's still no open-coded kvfree() function (appeared in
10 Should fix bug reported in forum
11 http://forum.proxmox.com/threads/19194-VM-start-problem-with-virtio-net
13 diff -r -U 3 -p a/drivers/vhost/net.c b/drivers/vhost/net.c
14 --- a/drivers/vhost/net.c 2014-07-16 22:25:31.000000000 +0400
15 +++ b/drivers/vhost/net.c 2014-09-04 13:56:20.101952635 +0400
17 #include <linux/rcupdate.h>
18 #include <linux/file.h>
19 #include <linux/slab.h>
20 +#include <linux/vmalloc.h>
22 #include <linux/net.h>
23 #include <linux/if_packet.h>
24 @@ -706,18 +707,30 @@ static void handle_rx_net(struct vhost_w
28 +static void vhost_net_free(void *addr)
30 + if (is_vmalloc_addr(addr))
36 static int vhost_net_open(struct inode *inode, struct file *f)
38 - struct vhost_net *n = kmalloc(sizeof *n, GFP_KERNEL);
39 + struct vhost_net *n;
40 struct vhost_dev *dev;
41 struct vhost_virtqueue **vqs;
46 + n = kmalloc(sizeof *n, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT);
48 + n = vmalloc(sizeof *n);
52 vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL);
59 @@ -736,7 +749,7 @@ static int vhost_net_open(struct inode *
61 r = vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
68 @@ -841,7 +854,7 @@ static int vhost_net_release(struct inod
69 * since jobs can re-queue themselves. */