Skip to content
Snippets Groups Projects
  1. Dec 08, 2020
  2. Oct 23, 2020
  3. Oct 26, 2019
    • Wei Yang's avatar
      core: replace getpagesize() with qemu_real_host_page_size · 038adc2f
      Wei Yang authored
      
      There are three page size in qemu:
      
        real host page size
        host page size
        target page size
      
      All of them have dedicate variable to represent. For the last two, we
      use the same form in the whole qemu project, while for the first one we
      use two forms: qemu_real_host_page_size and getpagesize().
      
      qemu_real_host_page_size is defined to be a replacement of
      getpagesize(), so let it serve the role.
      
      [Note] Not fully tested for some arch or device.
      
      Signed-off-by: default avatarWei Yang <richardw.yang@linux.intel.com>
      Message-Id: <20191013021145.16011-3-richardw.yang@linux.intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      038adc2f
  4. Jul 04, 2019
    • Stefan Hajnoczi's avatar
      libvhost-user: support many virtqueues · 6f5fd837
      Stefan Hajnoczi authored
      
      Currently libvhost-user is hardcoded to at most 8 virtqueues.  The
      device backend should decide the number of virtqueues, not
      libvhost-user.  This is important for multiqueue device backends where
      the guest driver needs an accurate number of virtqueues.
      
      This change breaks libvhost-user and libvhost-user-glib API stability.
      There is no stability guarantee yet, so make this change now and update
      all in-tree library users.
      
      This patch touches up vhost-user-blk, vhost-user-gpu, vhost-user-input,
      vhost-user-scsi, and vhost-user-bridge.  If the device has a fixed
      number of queues that exact number is used.  Otherwise the previous
      default of 8 virtqueues is used.
      
      vu_init() and vug_init() can now fail if malloc() returns NULL.  I
      considered aborting with an error in libvhost-user but it should be safe
      to instantiate new vhost-user instances at runtime without risk of
      terminating the process.  Therefore callers need to handle the vu_init()
      failure now.
      
      vhost-user-blk and vhost-user-scsi duplicate virtqueue index checks that
      are already performed by libvhost-user.  This code would need to be
      modified to use max_queues but remove it completely instead since it's
      redundant.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20190626074815.19994-3-stefanha@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      6f5fd837
  5. Jun 11, 2019
  6. May 22, 2019
  7. Dec 20, 2018
  8. Nov 27, 2018
    • Marc-André Lureau's avatar
      vhost-user-bridge: fix recvmsg iovlen · 8f1d22d9
      Marc-André Lureau authored
      
      After iov_discard_front(), the iov may be smaller than its initial
      size. Fixes the heap-buffer-overflow spotted by ASAN:
      
      ==9036==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000001e0 at pc 0x7fe632eca3f0 bp 0x7ffddc4a05a0 sp 0x7ffddc49fd48
      WRITE of size 32 at 0x6060000001e0 thread T0
          #0 0x7fe632eca3ef  (/lib64/libasan.so.5+0x773ef)
          #1 0x7fe632ecad23 in __interceptor_recvmsg (/lib64/libasan.so.5+0x77d23)
          #2 0x561e7491936b in vubr_backend_recv_cb /home/elmarco/src/qemu/tests/vhost-user-bridge.c:333
          #3 0x561e74917711 in dispatcher_wait /home/elmarco/src/qemu/tests/vhost-user-bridge.c:160
          #4 0x561e7491c3b5 in vubr_run /home/elmarco/src/qemu/tests/vhost-user-bridge.c:725
          #5 0x561e7491c85c in main /home/elmarco/src/qemu/tests/vhost-user-bridge.c:806
          #6 0x7fe631a6c412 in __libc_start_main (/lib64/libc.so.6+0x24412)
          #7 0x561e7491667d in _start (/home/elmarco/src/qemu/build/tests/vhost-user-bridge+0x3967d)
      
      0x6060000001e0 is located 0 bytes to the right of 64-byte region [0x6060000001a0,0x6060000001e0)
      allocated by thread T0 here:
          #0 0x7fe632f42848 in __interceptor_malloc (/lib64/libasan.so.5+0xef848)
          #1 0x561e7493acd8 in virtqueue_alloc_element /home/elmarco/src/qemu/contrib/libvhost-user/libvhost-user.c:1848
          #2 0x561e7493c2a8 in vu_queue_pop /home/elmarco/src/qemu/contrib/libvhost-user/libvhost-user.c:1954
          #3 0x561e749189bf in vubr_backend_recv_cb /home/elmarco/src/qemu/tests/vhost-user-bridge.c:297
          #4 0x561e74917711 in dispatcher_wait /home/elmarco/src/qemu/tests/vhost-user-bridge.c:160
          #5 0x561e7491c3b5 in vubr_run /home/elmarco/src/qemu/tests/vhost-user-bridge.c:725
          #6 0x561e7491c85c in main /home/elmarco/src/qemu/tests/vhost-user-bridge.c:806
          #7 0x7fe631a6c412 in __libc_start_main (/lib64/libc.so.6+0x24412)
      
      SUMMARY: AddressSanitizer: heap-buffer-overflow (/lib64/libasan.so.5+0x773ef)
      Shadow bytes around the buggy address:
        0x0c0c7fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c0c7fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c0c7fff8000: fa fa fa fa 00 00 00 00 00 00 05 fa fa fa fa fa
        0x0c0c7fff8010: 00 00 00 00 00 00 00 00 fa fa fa fa fd fd fd fd
        0x0c0c7fff8020: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
      =>0x0c0c7fff8030: fa fa fa fa 00 00 00 00 00 00 00 00[fa]fa fa fa
        0x0c0c7fff8040: fd fd fd fd fd fd fd fd fa fa fa fa fd fd fd fd
        0x0c0c7fff8050: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
        0x0c0c7fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c0c7fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c0c7fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20181109173028.3372-1-marcandre.lureau@redhat.com>
      Signed-off-by: default avatarPaolo BOnzini <pbonzini@redhat.com>
      8f1d22d9
  9. May 24, 2018
  10. Jan 16, 2018
    • Eric Blake's avatar
      tests: Avoid 'do/while(false); ' in vhost-user-bridge · 241187c1
      Eric Blake authored
      
      Use of a do/while(0) loop as a way to allow break statements in
      the middle of execute-once code is unusual.  More typical is
      the use of goto for early exits, with a label at the end of
      the execute-once code, rather than nesting code in a scope;
      however, the comment at the end of the existing code makes this
      alternative a bit unpractical.
      
      So, to avoid false positives from a future syntax check about
      'while (false);', and to keep the loop form (in case someone
      ever does add DONTWAIT support, where they can just as easily
      manipulate the initial loop condition or add an if around the
      final 'break'), I opted to use the form of a while(1) loop (the
      break as an early exit is more idiomatic there), coupled with
      a final break preserving the original comment.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20171201232433.25193-6-eblake@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      241187c1
  11. Oct 12, 2017
  12. Sep 08, 2017
  13. Jun 08, 2017
  14. Dec 15, 2016
  15. Jul 12, 2016
  16. Jun 17, 2016
  17. Jun 16, 2016
  18. Feb 25, 2016
  19. Feb 18, 2016
  20. Feb 16, 2016
  21. Dec 02, 2015
  22. Nov 25, 2015
  23. Nov 17, 2015
  24. Nov 12, 2015
  25. Oct 29, 2015
    • Victor Kaplansky's avatar
      tests/vhost-user-bridge: add vhost-user bridge application · 3595e2eb
      Victor Kaplansky authored
      
      The test existing in QEMU for vhost-user feature is good for
      testing the management protocol, but does not allow actual
      traffic. This patch proposes Vhost-User Bridge application, which
      can serve the QEMU community as a comprehensive test by running
      real internet traffic by means of vhost-user interface.
      
      Essentially the Vhost-User Bridge is a very basic vhost-user
      backend for QEMU. It runs as a standalone user-level process.
      For packet processing Vhost-User Bridge uses an additional QEMU
      instance with a backend configured by "-net socket" as a shared
      VLAN.  This way another QEMU virtual machine can effectively
      serve as a shared bus by means of UDP communication.
      
      For a more simple setup, the another QEMU instance running the
      SLiRP backend can be the same QEMU instance running vhost-user
      client.
      
      This Vhost-User Bridge implementation is very preliminary.  It is
      missing many features. I has been studying vhost-user protocol
      internals, so I've written vhost-user-bridge bit by bit as I
      progressed through the protocol.  Most probably its internal
      architecture will change significantly.
      
      To run Vhost-User Bridge application:
      
      1. Build vhost-user-bridge with a regular procedure. This will
      create a vhost-user-bridge executable under tests directory:
      
          $ configure; make tests/vhost-user-bridge
      
      2. Ensure the machine has hugepages enabled in kernel with
      command line like:
      
          default_hugepagesz=2M hugepagesz=2M hugepages=2048
      
      3. Run Vhost-User Bridge with:
      
          $ tests/vhost-user-bridge
      
      The above will run vhost-user server listening for connections
      on UNIX domain socket /tmp/vubr.sock, and will try to connect
      by UDP to VLAN bridge to localhost:5555, while listening on
      localhost:4444
      
      Run qemu with a virtio-net backed by vhost-user:
      
          $ qemu \
              -enable-kvm -m 512 -smp 2 \
              -object memory-backend-file,id=mem,size=512M,mem-path=/dev/hugepages,share=on \
              -numa node,memdev=mem -mem-prealloc \
              -chardev socket,id=char0,path=/tmp/vubr.sock \
              -netdev type=vhost-user,id=mynet1,chardev=char0,vhostforce \
              -device virtio-net-pci,netdev=mynet1 \
              -net none \
              -net socket,vlan=0,udp=localhost:4444,localaddr=localhost:5555 \
              -net user,vlan=0 \
              disk.img
      
      vhost-user-bridge was tested very lightly: it's able to bringup a
      linux on client VM with the virtio-net driver, and execute transmits
      and receives to the internet. I tested with "wget redhat.com",
      "dig redhat.com".
      
      PS. I've consulted DPDK's code for vhost-user during Vhost-User
      Bridge implementation.
      
      Signed-off-by: default avatarVictor Kaplansky <victork@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      3595e2eb
Loading