diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-10 17:50:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-10 17:50:58 -0400 |
commit | 5f129721713e099a04c6024015f97faa58562ab1 (patch) | |
tree | c5a498f217da044eb5ce870bedc95c4bf82cf185 | |
parent | 15a49b9a90c86c6cb7f270a699d2ae7468862c28 (diff) | |
parent | c893c8d763d8a8a757028a48ace7d1bb2dd8373f (diff) |
Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull virtio updates from Rusty Russell:
"No real surprises"
* tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
MAINTAINERS: add tools/virtio/ under virtio
tools/virtio: move module license stub to module.h
virtio: include asm/barrier explicitly
virtio: VIRTIO_F_ANY_LAYOUT feature
lguest: fix example launcher compilation for broken glibc headers.
virtio-net: fix the race between channels setting and refill
tools/lguest: real barriers.
tools/lguest: fix missing rmb().
virtio_balloon: leak_balloon(): only tell host if we got pages deflated
virtio-pci: fix leaks of msix_affinity_masks
Fix comment typo "CONFIG_PAE"
-rw-r--r-- | MAINTAINERS | 1 | ||||
-rw-r--r-- | drivers/net/virtio_net.c | 5 | ||||
-rw-r--r-- | drivers/virtio/virtio_balloon.c | 3 | ||||
-rw-r--r-- | drivers/virtio/virtio_pci.c | 5 | ||||
-rw-r--r-- | include/linux/virtio_ring.h | 1 | ||||
-rw-r--r-- | include/uapi/linux/virtio_config.h | 3 | ||||
-rw-r--r-- | tools/lguest/Makefile | 1 | ||||
-rw-r--r-- | tools/lguest/lguest.c | 32 | ||||
-rw-r--r-- | tools/virtio/linux/module.h | 5 | ||||
-rw-r--r-- | tools/virtio/linux/virtio.h | 3 |
10 files changed, 39 insertions, 20 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index af4c3be44ac3..e51d01836b54 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -8890,6 +8890,7 @@ M: "Michael S. Tsirkin" <mst@redhat.com> | |||
8890 | L: virtualization@lists.linux-foundation.org | 8890 | L: virtualization@lists.linux-foundation.org |
8891 | S: Maintained | 8891 | S: Maintained |
8892 | F: drivers/virtio/ | 8892 | F: drivers/virtio/ |
8893 | F: tools/virtio/ | ||
8893 | F: drivers/net/virtio_net.c | 8894 | F: drivers/net/virtio_net.c |
8894 | F: drivers/block/virtio_blk.c | 8895 | F: drivers/block/virtio_blk.c |
8895 | F: include/linux/virtio_*.h | 8896 | F: include/linux/virtio_*.h |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 42d670a468f8..3d2a90a62649 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -902,7 +902,6 @@ static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs) | |||
902 | struct scatterlist sg; | 902 | struct scatterlist sg; |
903 | struct virtio_net_ctrl_mq s; | 903 | struct virtio_net_ctrl_mq s; |
904 | struct net_device *dev = vi->dev; | 904 | struct net_device *dev = vi->dev; |
905 | int i; | ||
906 | 905 | ||
907 | if (!vi->has_cvq || !virtio_has_feature(vi->vdev, VIRTIO_NET_F_MQ)) | 906 | if (!vi->has_cvq || !virtio_has_feature(vi->vdev, VIRTIO_NET_F_MQ)) |
908 | return 0; | 907 | return 0; |
@@ -916,10 +915,8 @@ static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs) | |||
916 | queue_pairs); | 915 | queue_pairs); |
917 | return -EINVAL; | 916 | return -EINVAL; |
918 | } else { | 917 | } else { |
919 | for (i = vi->curr_queue_pairs; i < queue_pairs; i++) | ||
920 | if (!try_fill_recv(&vi->rq[i], GFP_KERNEL)) | ||
921 | schedule_delayed_work(&vi->refill, 0); | ||
922 | vi->curr_queue_pairs = queue_pairs; | 918 | vi->curr_queue_pairs = queue_pairs; |
919 | schedule_delayed_work(&vi->refill, 0); | ||
923 | } | 920 | } |
924 | 921 | ||
925 | return 0; | 922 | return 0; |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 0098810df69d..1f572c00a1be 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -192,7 +192,8 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num) | |||
192 | * virtio_has_feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST); | 192 | * virtio_has_feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST); |
193 | * is true, we *have* to do it in this order | 193 | * is true, we *have* to do it in this order |
194 | */ | 194 | */ |
195 | tell_host(vb, vb->deflate_vq); | 195 | if (vb->num_pfns != 0) |
196 | tell_host(vb, vb->deflate_vq); | ||
196 | mutex_unlock(&vb->balloon_lock); | 197 | mutex_unlock(&vb->balloon_lock); |
197 | release_pages_by_pfn(vb->pfns, vb->num_pfns); | 198 | release_pages_by_pfn(vb->pfns, vb->num_pfns); |
198 | } | 199 | } |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index a7ce73029f59..1aba255b5879 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -289,9 +289,9 @@ static void vp_free_vectors(struct virtio_device *vdev) | |||
289 | 289 | ||
290 | pci_disable_msix(vp_dev->pci_dev); | 290 | pci_disable_msix(vp_dev->pci_dev); |
291 | vp_dev->msix_enabled = 0; | 291 | vp_dev->msix_enabled = 0; |
292 | vp_dev->msix_vectors = 0; | ||
293 | } | 292 | } |
294 | 293 | ||
294 | vp_dev->msix_vectors = 0; | ||
295 | vp_dev->msix_used_vectors = 0; | 295 | vp_dev->msix_used_vectors = 0; |
296 | kfree(vp_dev->msix_names); | 296 | kfree(vp_dev->msix_names); |
297 | vp_dev->msix_names = NULL; | 297 | vp_dev->msix_names = NULL; |
@@ -309,6 +309,8 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors, | |||
309 | unsigned i, v; | 309 | unsigned i, v; |
310 | int err = -ENOMEM; | 310 | int err = -ENOMEM; |
311 | 311 | ||
312 | vp_dev->msix_vectors = nvectors; | ||
313 | |||
312 | vp_dev->msix_entries = kmalloc(nvectors * sizeof *vp_dev->msix_entries, | 314 | vp_dev->msix_entries = kmalloc(nvectors * sizeof *vp_dev->msix_entries, |
313 | GFP_KERNEL); | 315 | GFP_KERNEL); |
314 | if (!vp_dev->msix_entries) | 316 | if (!vp_dev->msix_entries) |
@@ -336,7 +338,6 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors, | |||
336 | err = -ENOSPC; | 338 | err = -ENOSPC; |
337 | if (err) | 339 | if (err) |
338 | goto error; | 340 | goto error; |
339 | vp_dev->msix_vectors = nvectors; | ||
340 | vp_dev->msix_enabled = 1; | 341 | vp_dev->msix_enabled = 1; |
341 | 342 | ||
342 | /* Set the vector used for configuration */ | 343 | /* Set the vector used for configuration */ |
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index ca3ad41c2c82..b300787af8e0 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _LINUX_VIRTIO_RING_H | 1 | #ifndef _LINUX_VIRTIO_RING_H |
2 | #define _LINUX_VIRTIO_RING_H | 2 | #define _LINUX_VIRTIO_RING_H |
3 | 3 | ||
4 | #include <asm/barrier.h> | ||
4 | #include <linux/irqreturn.h> | 5 | #include <linux/irqreturn.h> |
5 | #include <uapi/linux/virtio_ring.h> | 6 | #include <uapi/linux/virtio_ring.h> |
6 | 7 | ||
diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h index b7cda390fd00..3ce768c6910d 100644 --- a/include/uapi/linux/virtio_config.h +++ b/include/uapi/linux/virtio_config.h | |||
@@ -51,4 +51,7 @@ | |||
51 | * suppressed them? */ | 51 | * suppressed them? */ |
52 | #define VIRTIO_F_NOTIFY_ON_EMPTY 24 | 52 | #define VIRTIO_F_NOTIFY_ON_EMPTY 24 |
53 | 53 | ||
54 | /* Can the device handle any descriptor layout? */ | ||
55 | #define VIRTIO_F_ANY_LAYOUT 27 | ||
56 | |||
54 | #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */ | 57 | #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */ |
diff --git a/tools/lguest/Makefile b/tools/lguest/Makefile index 0ac34206f7a7..97bca4871ea3 100644 --- a/tools/lguest/Makefile +++ b/tools/lguest/Makefile | |||
@@ -1,5 +1,4 @@ | |||
1 | # This creates the demonstration utility "lguest" which runs a Linux guest. | 1 | # This creates the demonstration utility "lguest" which runs a Linux guest. |
2 | # Missing headers? Add "-I../../../include -I../../../arch/x86/include" | ||
3 | CFLAGS:=-m32 -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -U_FORTIFY_SOURCE | 2 | CFLAGS:=-m32 -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -U_FORTIFY_SOURCE |
4 | 3 | ||
5 | all: lguest | 4 | all: lguest |
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index 07a03452c227..68f67cf3d318 100644 --- a/tools/lguest/lguest.c +++ b/tools/lguest/lguest.c | |||
@@ -42,14 +42,6 @@ | |||
42 | #include <pwd.h> | 42 | #include <pwd.h> |
43 | #include <grp.h> | 43 | #include <grp.h> |
44 | 44 | ||
45 | #include <linux/virtio_config.h> | ||
46 | #include <linux/virtio_net.h> | ||
47 | #include <linux/virtio_blk.h> | ||
48 | #include <linux/virtio_console.h> | ||
49 | #include <linux/virtio_rng.h> | ||
50 | #include <linux/virtio_ring.h> | ||
51 | #include <asm/bootparam.h> | ||
52 | #include "../../include/linux/lguest_launcher.h" | ||
53 | /*L:110 | 45 | /*L:110 |
54 | * We can ignore the 43 include files we need for this program, but I do want | 46 | * We can ignore the 43 include files we need for this program, but I do want |
55 | * to draw attention to the use of kernel-style types. | 47 | * to draw attention to the use of kernel-style types. |
@@ -65,6 +57,15 @@ typedef uint16_t u16; | |||
65 | typedef uint8_t u8; | 57 | typedef uint8_t u8; |
66 | /*:*/ | 58 | /*:*/ |
67 | 59 | ||
60 | #include <linux/virtio_config.h> | ||
61 | #include <linux/virtio_net.h> | ||
62 | #include <linux/virtio_blk.h> | ||
63 | #include <linux/virtio_console.h> | ||
64 | #include <linux/virtio_rng.h> | ||
65 | #include <linux/virtio_ring.h> | ||
66 | #include <asm/bootparam.h> | ||
67 | #include "../../include/linux/lguest_launcher.h" | ||
68 | |||
68 | #define BRIDGE_PFX "bridge:" | 69 | #define BRIDGE_PFX "bridge:" |
69 | #ifndef SIOCBRADDIF | 70 | #ifndef SIOCBRADDIF |
70 | #define SIOCBRADDIF 0x89a2 /* add interface to bridge */ | 71 | #define SIOCBRADDIF 0x89a2 /* add interface to bridge */ |
@@ -177,7 +178,8 @@ static struct termios orig_term; | |||
177 | * in precise order. | 178 | * in precise order. |
178 | */ | 179 | */ |
179 | #define wmb() __asm__ __volatile__("" : : : "memory") | 180 | #define wmb() __asm__ __volatile__("" : : : "memory") |
180 | #define mb() __asm__ __volatile__("" : : : "memory") | 181 | #define rmb() __asm__ __volatile__("lock; addl $0,0(%%esp)" : : : "memory") |
182 | #define mb() __asm__ __volatile__("lock; addl $0,0(%%esp)" : : : "memory") | ||
181 | 183 | ||
182 | /* Wrapper for the last available index. Makes it easier to change. */ | 184 | /* Wrapper for the last available index. Makes it easier to change. */ |
183 | #define lg_last_avail(vq) ((vq)->last_avail_idx) | 185 | #define lg_last_avail(vq) ((vq)->last_avail_idx) |
@@ -676,6 +678,12 @@ static unsigned wait_for_vq_desc(struct virtqueue *vq, | |||
676 | errx(1, "Guest moved used index from %u to %u", | 678 | errx(1, "Guest moved used index from %u to %u", |
677 | last_avail, vq->vring.avail->idx); | 679 | last_avail, vq->vring.avail->idx); |
678 | 680 | ||
681 | /* | ||
682 | * Make sure we read the descriptor number *after* we read the ring | ||
683 | * update; don't let the cpu or compiler change the order. | ||
684 | */ | ||
685 | rmb(); | ||
686 | |||
679 | /* | 687 | /* |
680 | * Grab the next descriptor number they're advertising, and increment | 688 | * Grab the next descriptor number they're advertising, and increment |
681 | * the index we've seen. | 689 | * the index we've seen. |
@@ -695,6 +703,12 @@ static unsigned wait_for_vq_desc(struct virtqueue *vq, | |||
695 | i = head; | 703 | i = head; |
696 | 704 | ||
697 | /* | 705 | /* |
706 | * We have to read the descriptor after we read the descriptor number, | ||
707 | * but there's a data dependency there so the CPU shouldn't reorder | ||
708 | * that: no rmb() required. | ||
709 | */ | ||
710 | |||
711 | /* | ||
698 | * If this is an indirect entry, then this buffer contains a descriptor | 712 | * If this is an indirect entry, then this buffer contains a descriptor |
699 | * table which we handle as if it's any normal descriptor chain. | 713 | * table which we handle as if it's any normal descriptor chain. |
700 | */ | 714 | */ |
diff --git a/tools/virtio/linux/module.h b/tools/virtio/linux/module.h index 3039a7e972b6..28ce95a05997 100644 --- a/tools/virtio/linux/module.h +++ b/tools/virtio/linux/module.h | |||
@@ -1 +1,6 @@ | |||
1 | #include <linux/export.h> | 1 | #include <linux/export.h> |
2 | |||
3 | #define MODULE_LICENSE(__MODULE_LICENSE_value) \ | ||
4 | static __attribute__((unused)) const char *__MODULE_LICENSE_name = \ | ||
5 | __MODULE_LICENSE_value | ||
6 | |||
diff --git a/tools/virtio/linux/virtio.h b/tools/virtio/linux/virtio.h index cd801838156f..844783040703 100644 --- a/tools/virtio/linux/virtio.h +++ b/tools/virtio/linux/virtio.h | |||
@@ -45,9 +45,6 @@ struct virtqueue { | |||
45 | void *priv; | 45 | void *priv; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | #define MODULE_LICENSE(__MODULE_LICENSE_value) \ | ||
49 | const char *__MODULE_LICENSE_name = __MODULE_LICENSE_value | ||
50 | |||
51 | /* Interfaces exported by virtio_ring. */ | 48 | /* Interfaces exported by virtio_ring. */ |
52 | int virtqueue_add_sgs(struct virtqueue *vq, | 49 | int virtqueue_add_sgs(struct virtqueue *vq, |
53 | struct scatterlist *sgs[], | 50 | struct scatterlist *sgs[], |