diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-10 14:33:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-10 14:33:08 -0400 |
commit | c44b59430393c38873fd933333d945f426857a59 (patch) | |
tree | 1af82d499fb4abb67487962f8d03f4088b367f37 /tools | |
parent | 5ccd414080822d5257c3569f4aeca74f63f4a257 (diff) | |
parent | c8b0d7290657996a29f318b948d2397d30e70c36 (diff) |
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull virtio updates from Michael Tsirkin:
"Fixes, cleanups, performance
A bunch of changes to virtio, most affecting virtio net. Also ptr_ring
batched zeroing - first of batching enhancements that seems ready."
* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
s390/virtio: change maintainership
tools/virtio: fix spelling mistake: "wakeus" -> "wakeups"
virtio_net: tidy a couple debug statements
ptr_ring: support testing different batching sizes
ringtest: support test specific parameters
ptr_ring: batch ring zeroing
virtio: virtio_driver doc
virtio_net: don't reset twice on XDP on/off
virtio_net: fix support for small rings
virtio_net: reduce alignment for buffers
virtio_net: rework mergeable buffer handling
virtio_net: allow specifying context for rx
virtio: allow extra context per descriptor
tools/virtio: fix build breakage
virtio: add context flag to find vqs
virtio: wrap find_vqs
ringtest: fix an assert statement
Diffstat (limited to 'tools')
-rw-r--r-- | tools/virtio/linux/virtio.h | 1 | ||||
-rw-r--r-- | tools/virtio/ringtest/main.c | 15 | ||||
-rw-r--r-- | tools/virtio/ringtest/main.h | 2 | ||||
-rw-r--r-- | tools/virtio/ringtest/ptr_ring.c | 3 | ||||
-rw-r--r-- | tools/virtio/virtio_test.c | 4 | ||||
-rw-r--r-- | tools/virtio/vringh_test.c | 7 |
6 files changed, 26 insertions, 6 deletions
diff --git a/tools/virtio/linux/virtio.h b/tools/virtio/linux/virtio.h index 9377c8b4ac16..d8f534025b7f 100644 --- a/tools/virtio/linux/virtio.h +++ b/tools/virtio/linux/virtio.h | |||
@@ -57,6 +57,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int index, | |||
57 | unsigned int vring_align, | 57 | unsigned int vring_align, |
58 | struct virtio_device *vdev, | 58 | struct virtio_device *vdev, |
59 | bool weak_barriers, | 59 | bool weak_barriers, |
60 | bool ctx, | ||
60 | void *pages, | 61 | void *pages, |
61 | bool (*notify)(struct virtqueue *vq), | 62 | bool (*notify)(struct virtqueue *vq), |
62 | void (*callback)(struct virtqueue *vq), | 63 | void (*callback)(struct virtqueue *vq), |
diff --git a/tools/virtio/ringtest/main.c b/tools/virtio/ringtest/main.c index f31353fac541..453ca3c21193 100644 --- a/tools/virtio/ringtest/main.c +++ b/tools/virtio/ringtest/main.c | |||
@@ -20,6 +20,7 @@ | |||
20 | int runcycles = 10000000; | 20 | int runcycles = 10000000; |
21 | int max_outstanding = INT_MAX; | 21 | int max_outstanding = INT_MAX; |
22 | int batch = 1; | 22 | int batch = 1; |
23 | int param = 0; | ||
23 | 24 | ||
24 | bool do_sleep = false; | 25 | bool do_sleep = false; |
25 | bool do_relax = false; | 26 | bool do_relax = false; |
@@ -86,7 +87,7 @@ void set_affinity(const char *arg) | |||
86 | cpu = strtol(arg, &endptr, 0); | 87 | cpu = strtol(arg, &endptr, 0); |
87 | assert(!*endptr); | 88 | assert(!*endptr); |
88 | 89 | ||
89 | assert(cpu >= 0 || cpu < CPU_SETSIZE); | 90 | assert(cpu >= 0 && cpu < CPU_SETSIZE); |
90 | 91 | ||
91 | self = pthread_self(); | 92 | self = pthread_self(); |
92 | CPU_ZERO(&cpuset); | 93 | CPU_ZERO(&cpuset); |
@@ -247,6 +248,11 @@ static const struct option longopts[] = { | |||
247 | .val = 'b', | 248 | .val = 'b', |
248 | }, | 249 | }, |
249 | { | 250 | { |
251 | .name = "param", | ||
252 | .has_arg = required_argument, | ||
253 | .val = 'p', | ||
254 | }, | ||
255 | { | ||
250 | .name = "sleep", | 256 | .name = "sleep", |
251 | .has_arg = no_argument, | 257 | .has_arg = no_argument, |
252 | .val = 's', | 258 | .val = 's', |
@@ -274,6 +280,7 @@ static void help(void) | |||
274 | " [--run-cycles C (default: %d)]" | 280 | " [--run-cycles C (default: %d)]" |
275 | " [--batch b]" | 281 | " [--batch b]" |
276 | " [--outstanding o]" | 282 | " [--outstanding o]" |
283 | " [--param p]" | ||
277 | " [--sleep]" | 284 | " [--sleep]" |
278 | " [--relax]" | 285 | " [--relax]" |
279 | " [--exit]" | 286 | " [--exit]" |
@@ -328,6 +335,12 @@ int main(int argc, char **argv) | |||
328 | assert(c > 0 && c < INT_MAX); | 335 | assert(c > 0 && c < INT_MAX); |
329 | max_outstanding = c; | 336 | max_outstanding = c; |
330 | break; | 337 | break; |
338 | case 'p': | ||
339 | c = strtol(optarg, &endptr, 0); | ||
340 | assert(!*endptr); | ||
341 | assert(c > 0 && c < INT_MAX); | ||
342 | param = c; | ||
343 | break; | ||
331 | case 'b': | 344 | case 'b': |
332 | c = strtol(optarg, &endptr, 0); | 345 | c = strtol(optarg, &endptr, 0); |
333 | assert(!*endptr); | 346 | assert(!*endptr); |
diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h index 14142faf040b..90b0133004e1 100644 --- a/tools/virtio/ringtest/main.h +++ b/tools/virtio/ringtest/main.h | |||
@@ -10,6 +10,8 @@ | |||
10 | 10 | ||
11 | #include <stdbool.h> | 11 | #include <stdbool.h> |
12 | 12 | ||
13 | extern int param; | ||
14 | |||
13 | extern bool do_exit; | 15 | extern bool do_exit; |
14 | 16 | ||
15 | #if defined(__x86_64__) || defined(__i386__) | 17 | #if defined(__x86_64__) || defined(__i386__) |
diff --git a/tools/virtio/ringtest/ptr_ring.c b/tools/virtio/ringtest/ptr_ring.c index 635b07b4fdd3..7b22f1b20652 100644 --- a/tools/virtio/ringtest/ptr_ring.c +++ b/tools/virtio/ringtest/ptr_ring.c | |||
@@ -97,6 +97,9 @@ void alloc_ring(void) | |||
97 | { | 97 | { |
98 | int ret = ptr_ring_init(&array, ring_size, 0); | 98 | int ret = ptr_ring_init(&array, ring_size, 0); |
99 | assert(!ret); | 99 | assert(!ret); |
100 | /* Hacky way to poke at ring internals. Useful for testing though. */ | ||
101 | if (param) | ||
102 | array.batch = param; | ||
100 | } | 103 | } |
101 | 104 | ||
102 | /* guest side */ | 105 | /* guest side */ |
diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c index e0445898f08f..0fecaec90d0d 100644 --- a/tools/virtio/virtio_test.c +++ b/tools/virtio/virtio_test.c | |||
@@ -100,7 +100,7 @@ static void vq_info_add(struct vdev_info *dev, int num) | |||
100 | vring_init(&info->vring, num, info->ring, 4096); | 100 | vring_init(&info->vring, num, info->ring, 4096); |
101 | info->vq = vring_new_virtqueue(info->idx, | 101 | info->vq = vring_new_virtqueue(info->idx, |
102 | info->vring.num, 4096, &dev->vdev, | 102 | info->vring.num, 4096, &dev->vdev, |
103 | true, info->ring, | 103 | true, false, info->ring, |
104 | vq_notify, vq_callback, "test"); | 104 | vq_notify, vq_callback, "test"); |
105 | assert(info->vq); | 105 | assert(info->vq); |
106 | info->vq->priv = info; | 106 | info->vq->priv = info; |
@@ -202,7 +202,7 @@ static void run_test(struct vdev_info *dev, struct vq_info *vq, | |||
202 | test = 0; | 202 | test = 0; |
203 | r = ioctl(dev->control, VHOST_TEST_RUN, &test); | 203 | r = ioctl(dev->control, VHOST_TEST_RUN, &test); |
204 | assert(r >= 0); | 204 | assert(r >= 0); |
205 | fprintf(stderr, "spurious wakeus: 0x%llx\n", spurious); | 205 | fprintf(stderr, "spurious wakeups: 0x%llx\n", spurious); |
206 | } | 206 | } |
207 | 207 | ||
208 | const char optstring[] = "h"; | 208 | const char optstring[] = "h"; |
diff --git a/tools/virtio/vringh_test.c b/tools/virtio/vringh_test.c index 5f94f5105678..9476c616d064 100644 --- a/tools/virtio/vringh_test.c +++ b/tools/virtio/vringh_test.c | |||
@@ -314,7 +314,8 @@ static int parallel_test(u64 features, | |||
314 | err(1, "Could not set affinity to cpu %u", first_cpu); | 314 | err(1, "Could not set affinity to cpu %u", first_cpu); |
315 | 315 | ||
316 | vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &gvdev.vdev, true, | 316 | vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &gvdev.vdev, true, |
317 | guest_map, fast_vringh ? no_notify_host | 317 | false, guest_map, |
318 | fast_vringh ? no_notify_host | ||
318 | : parallel_notify_host, | 319 | : parallel_notify_host, |
319 | never_callback_guest, "guest vq"); | 320 | never_callback_guest, "guest vq"); |
320 | 321 | ||
@@ -479,7 +480,7 @@ int main(int argc, char *argv[]) | |||
479 | memset(__user_addr_min, 0, vring_size(RINGSIZE, ALIGN)); | 480 | memset(__user_addr_min, 0, vring_size(RINGSIZE, ALIGN)); |
480 | 481 | ||
481 | /* Set up guest side. */ | 482 | /* Set up guest side. */ |
482 | vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, | 483 | vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, false, |
483 | __user_addr_min, | 484 | __user_addr_min, |
484 | never_notify_host, never_callback_guest, | 485 | never_notify_host, never_callback_guest, |
485 | "guest vq"); | 486 | "guest vq"); |
@@ -663,7 +664,7 @@ int main(int argc, char *argv[]) | |||
663 | /* Force creation of direct, which we modify. */ | 664 | /* Force creation of direct, which we modify. */ |
664 | __virtio_clear_bit(&vdev, VIRTIO_RING_F_INDIRECT_DESC); | 665 | __virtio_clear_bit(&vdev, VIRTIO_RING_F_INDIRECT_DESC); |
665 | vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, | 666 | vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, |
666 | __user_addr_min, | 667 | false, __user_addr_min, |
667 | never_notify_host, | 668 | never_notify_host, |
668 | never_callback_guest, | 669 | never_callback_guest, |
669 | "guest vq"); | 670 | "guest vq"); |