mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
virtio: fixes, cleanups, performance
A bunch of changes to virtio, most affecting virtio net. ptr_ring batched zeroing - first of batching enhancements that seems ready. Signed-off-by: Michael S. Tsirkin <[email protected]> -----BEGIN PGP SIGNATURE----- iQEcBAABAgAGBQJZEceWAAoJECgfDbjSjVRpg8YIAIbB1UJZkrHh/fdCQjM2O53T ESS62W91LBT+weYH/N79RrfnGWzDOHrCQ8Or1nAKQZx2vU1aroqYXeJ9o0liRBYr hGZB1/bg8obA5XkKUfME2+XClakvuXABUJbky08iDL9nILlrvIVLoUgZ9ouL0vTj oUv4n6jtguNFV7tk/injGNRparEVdcefX0dbPxXomx5tSeD2fOE96/Q4q2eD3f7r NHD4DailEJC7ndJGa6b4M9g8shkXzgEnSw+OJHpcJcxCnAzkVT94vsU7OluiDvmG bfdGZNb0ohDYZLbJDR8aiMkoad8bIVLyGlhqnMBiZQEOF4oiWM9UJLvp5Lq9g7A= =Sb7L -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
c44b594303
32 changed files with 330 additions and 146 deletions
|
|
@ -57,6 +57,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int index,
|
|||
unsigned int vring_align,
|
||||
struct virtio_device *vdev,
|
||||
bool weak_barriers,
|
||||
bool ctx,
|
||||
void *pages,
|
||||
bool (*notify)(struct virtqueue *vq),
|
||||
void (*callback)(struct virtqueue *vq),
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
int runcycles = 10000000;
|
||||
int max_outstanding = INT_MAX;
|
||||
int batch = 1;
|
||||
int param = 0;
|
||||
|
||||
bool do_sleep = false;
|
||||
bool do_relax = false;
|
||||
|
|
@ -86,7 +87,7 @@ void set_affinity(const char *arg)
|
|||
cpu = strtol(arg, &endptr, 0);
|
||||
assert(!*endptr);
|
||||
|
||||
assert(cpu >= 0 || cpu < CPU_SETSIZE);
|
||||
assert(cpu >= 0 && cpu < CPU_SETSIZE);
|
||||
|
||||
self = pthread_self();
|
||||
CPU_ZERO(&cpuset);
|
||||
|
|
@ -246,6 +247,11 @@ static const struct option longopts[] = {
|
|||
.has_arg = required_argument,
|
||||
.val = 'b',
|
||||
},
|
||||
{
|
||||
.name = "param",
|
||||
.has_arg = required_argument,
|
||||
.val = 'p',
|
||||
},
|
||||
{
|
||||
.name = "sleep",
|
||||
.has_arg = no_argument,
|
||||
|
|
@ -274,6 +280,7 @@ static void help(void)
|
|||
" [--run-cycles C (default: %d)]"
|
||||
" [--batch b]"
|
||||
" [--outstanding o]"
|
||||
" [--param p]"
|
||||
" [--sleep]"
|
||||
" [--relax]"
|
||||
" [--exit]"
|
||||
|
|
@ -328,6 +335,12 @@ int main(int argc, char **argv)
|
|||
assert(c > 0 && c < INT_MAX);
|
||||
max_outstanding = c;
|
||||
break;
|
||||
case 'p':
|
||||
c = strtol(optarg, &endptr, 0);
|
||||
assert(!*endptr);
|
||||
assert(c > 0 && c < INT_MAX);
|
||||
param = c;
|
||||
break;
|
||||
case 'b':
|
||||
c = strtol(optarg, &endptr, 0);
|
||||
assert(!*endptr);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
|
||||
extern int param;
|
||||
|
||||
extern bool do_exit;
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
|
|
|
|||
|
|
@ -97,6 +97,9 @@ void alloc_ring(void)
|
|||
{
|
||||
int ret = ptr_ring_init(&array, ring_size, 0);
|
||||
assert(!ret);
|
||||
/* Hacky way to poke at ring internals. Useful for testing though. */
|
||||
if (param)
|
||||
array.batch = param;
|
||||
}
|
||||
|
||||
/* guest side */
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ static void vq_info_add(struct vdev_info *dev, int num)
|
|||
vring_init(&info->vring, num, info->ring, 4096);
|
||||
info->vq = vring_new_virtqueue(info->idx,
|
||||
info->vring.num, 4096, &dev->vdev,
|
||||
true, info->ring,
|
||||
true, false, info->ring,
|
||||
vq_notify, vq_callback, "test");
|
||||
assert(info->vq);
|
||||
info->vq->priv = info;
|
||||
|
|
@ -202,7 +202,7 @@ static void run_test(struct vdev_info *dev, struct vq_info *vq,
|
|||
test = 0;
|
||||
r = ioctl(dev->control, VHOST_TEST_RUN, &test);
|
||||
assert(r >= 0);
|
||||
fprintf(stderr, "spurious wakeus: 0x%llx\n", spurious);
|
||||
fprintf(stderr, "spurious wakeups: 0x%llx\n", spurious);
|
||||
}
|
||||
|
||||
const char optstring[] = "h";
|
||||
|
|
|
|||
|
|
@ -314,7 +314,8 @@ static int parallel_test(u64 features,
|
|||
err(1, "Could not set affinity to cpu %u", first_cpu);
|
||||
|
||||
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &gvdev.vdev, true,
|
||||
guest_map, fast_vringh ? no_notify_host
|
||||
false, guest_map,
|
||||
fast_vringh ? no_notify_host
|
||||
: parallel_notify_host,
|
||||
never_callback_guest, "guest vq");
|
||||
|
||||
|
|
@ -479,7 +480,7 @@ int main(int argc, char *argv[])
|
|||
memset(__user_addr_min, 0, vring_size(RINGSIZE, ALIGN));
|
||||
|
||||
/* Set up guest side. */
|
||||
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true,
|
||||
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, false,
|
||||
__user_addr_min,
|
||||
never_notify_host, never_callback_guest,
|
||||
"guest vq");
|
||||
|
|
@ -663,7 +664,7 @@ int main(int argc, char *argv[])
|
|||
/* Force creation of direct, which we modify. */
|
||||
__virtio_clear_bit(&vdev, VIRTIO_RING_F_INDIRECT_DESC);
|
||||
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true,
|
||||
__user_addr_min,
|
||||
false, __user_addr_min,
|
||||
never_notify_host,
|
||||
never_callback_guest,
|
||||
"guest vq");
|
||||
|
|
|
|||
Loading…
Reference in a new issue