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 /tools | |
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"
Diffstat (limited to 'tools')
-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 |
4 files changed, 28 insertions, 13 deletions
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[], |