qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 86abad: vhost-user: cleanup struct size math


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 86abad: vhost-user: cleanup struct size math
Date: Thu, 29 Oct 2015 04:30:06 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 86abad0fedc44554adde5e189cf7edfa5b1c948e
      
https://github.com/qemu/qemu/commit/86abad0fedc44554adde5e189cf7edfa5b1c948e
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/virtio/vhost-user.c

  Log Message:
  -----------
  vhost-user: cleanup struct size math

We are using local msg structures everywhere, use them
for sizeof as well.

Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 7fc0246c0792767b732c0989e8eba24bea185feb
      
https://github.com/qemu/qemu/commit/7fc0246c0792767b732c0989e8eba24bea185feb
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/virtio/vhost-user.c

  Log Message:
  -----------
  vhost-user: cleanup msg size math

We are sending msg fields, use sizeof on these
and not on local variables which happen to
have a matching type.

Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 12ebf6908333a86775ef18f12ea283601fd1d2df
      
https://github.com/qemu/qemu/commit/12ebf6908333a86775ef18f12ea283601fd1d2df
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M tests/vhost-user-test.c

  Log Message:
  -----------
  vhost-user-test: fix up rhel6 build

Build on RHEL6 fails:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42875

Apparently unnamed unions couldn't use C99  named field initializers.
Let's just name the payload union field.

Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 4828b10bda6a74a22a7695303e0648157d0e3ea4
      
https://github.com/qemu/qemu/commit/4828b10bda6a74a22a7695303e0648157d0e3ea4
  Author: Igor Mammedov <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/acpi/memory_hotplug.c

  Log Message:
  -----------
  pc: memhp: do not emit inserting event for coldplugged DIMMs

currently acpi_memory_plug_cb() sets is_inserting for
cold- and hot-plugged DIMMs as result ASL MHPD.MSCN()
method issues device check even for every coldplugged
DIMM. There isn't much harm in it but if we try to
unplug such DIMM, OSPM will issue device check
intstead of device eject event. So OSPM won't eject
memory module as expected and it will try to eject it
only when another memory device is hot-(un)plugged.

As a fix do not set 'is_inserting' event and do not
issue SCI for cold-plugged DIMMs as they are
enumerated and activated by OSPM during guest's boot.

Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 9d4ec9370a36f8a564e1ba05519328c0bd60da13
      
https://github.com/qemu/qemu/commit/9d4ec9370a36f8a564e1ba05519328c0bd60da13
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M util/mmap-alloc.c

  Log Message:
  -----------
  mmap-alloc: fix error handling

Existing callers are checking for MAP_FAILED,
so we should return that on error.

Reported-by: Paolo Bonzini <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 8059feee004111534c4c0652e2f0715e9b4e0754
      
https://github.com/qemu/qemu/commit/8059feee004111534c4c0652e2f0715e9b4e0754
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/virtio/virtio.c
    M include/hw/virtio/virtio.h

  Log Message:
  -----------
  virtio: introduce virtio_map

virtio_map_sg currently fails if one of the entries it's mapping is
contigious in GPA but not HVA address space.  Introduce virtio_map which
handles this by splitting sg entries.

This new API generally turns out to be a good idea since it's harder to
misuse: at least in one case the existing one was used incorrectly.

This will still fail if there's no space left in the sg, but luckily max
queue size in use is currently 256, while max sg size is 1024, so we
should be OK even is all entries happen to cross a single DIMM boundary.

Won't work well with very small DIMM sizes, unfortunately:
e.g. this will fail with 4K DIMMs where a single
request might span a large number of DIMMs.

Let's hope these are uncommon - at least we are not breaking things.

Note: virtio-scsi calls virtio_map_sg on data loaded from network, and
validates input, asserting on failure.  Copy the validating code here -
it will be dropped from virtio-scsi in a follow-up patch.

Reported-by: Igor Mammedov <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>


  Commit: 13972ac5e263a7319609253edac5754129489132
      
https://github.com/qemu/qemu/commit/13972ac5e263a7319609253edac5754129489132
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/virtio/virtio.c

  Log Message:
  -----------
  virtio: switch to virtio_map

Drop use of the deprecated virtio_map_sg in virtio core.

Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>


  Commit: 3d8db153b4b4e12b6d11590ccd318fff0eafd688
      
https://github.com/qemu/qemu/commit/3d8db153b4b4e12b6d11590ccd318fff0eafd688
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/block/virtio-blk.c

  Log Message:
  -----------
  virtio-blk: convert to virtqueue_map

Drop deprecated use of virtqueue_map_sg.

Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>


  Commit: bff712dc223f685c684f9caf960e6460e84a96f0
      
https://github.com/qemu/qemu/commit/bff712dc223f685c684f9caf960e6460e84a96f0
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/char/virtio-serial-bus.c

  Log Message:
  -----------
  virtio-serial: convert to virtio_map

This also fixes a minor bug:
-                virtqueue_map_sg(port->elem.out_sg, port->elem.out_addr,
-                                 port->elem.out_num, 1);
is wrong: out_sg is not written so should not be marked dirty.

Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>


  Commit: 4ada5331895551570846e12e7eb00e06616f9152
      
https://github.com/qemu/qemu/commit/4ada5331895551570846e12e7eb00e06616f9152
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/scsi/virtio-scsi.c

  Log Message:
  -----------
  virtio-scsi: convert to virtqueue_map

Note: virtqueue_map already validates input
so virtio-scsi does not have to.

Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>


  Commit: 3945ecf1ec4f6e6aa28d0c396a7f5d983c6810d8
      
https://github.com/qemu/qemu/commit/3945ecf1ec4f6e6aa28d0c396a7f5d983c6810d8
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/virtio/virtio.c
    M include/hw/virtio/virtio.h

  Log Message:
  -----------
  virtio: drop virtqueue_map_sg

Deprecated in favor of virtqueue_map.

Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>


  Commit: 340065e5a11a515382c8b1112424c97e86ad2a3f
      
https://github.com/qemu/qemu/commit/340065e5a11a515382c8b1112424c97e86ad2a3f
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/i386/pc.c
    M hw/i386/pc_piix.c
    M hw/i386/pc_q35.c
    M include/hw/i386/pc.h

  Log Message:
  -----------
  Revert "pc: memhp: force gaps between DIMM's GPA"

This reverts commit aa8580cddf011e8cedcf87f7a0fdea7549fc4704.

As described in
http://article.gmane.org/gmane.comp.emulators.qemu/371432
that commit causes linux guests to crash on memory hot-unplug.

The original problem it's trying to solve has now
been addressed within virtio.

Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: d6a9b0b89d27e0a688f37c1732d4dec40613669e
      
https://github.com/qemu/qemu/commit/d6a9b0b89d27e0a688f37c1732d4dec40613669e
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/i386/pc.c
    M hw/mem/pc-dimm.c
    M hw/ppc/spapr.c
    M include/hw/mem/pc-dimm.h

  Log Message:
  -----------
  Revert "memhp: extend address auto assignment to support gaps"

This reverts commit df0acded19ec4b826aa095cfc19d341bd66fafd3.

There's no point to it now that the only user has been reverted.

Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 3595e2eb0a233a881789fcc71f5b1072e5aaf669
      
https://github.com/qemu/qemu/commit/3595e2eb0a233a881789fcc71f5b1072e5aaf669
  Author: Victor Kaplansky <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M tests/Makefile
    A tests/vhost-user-bridge.c

  Log Message:
  -----------
  tests/vhost-user-bridge: add vhost-user bridge application

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: Victor Kaplansky <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 0d1c7d88ad909c5b2bd86211a9fe8abf5c74993b
      
https://github.com/qemu/qemu/commit/0d1c7d88ad909c5b2bd86211a9fe8abf5c74993b
  Author: Cao jin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/pci/pcie.c

  Log Message:
  -----------
  remove function during multi-function hot-add

In case user want to cancel the hot-add operation, should roll back,
device_del the added function that still don`t work.

Signed-off-by: Cao jin <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 3f1e1478db2d67098d98f2c3acf5a4946b7fb643
      
https://github.com/qemu/qemu/commit/3f1e1478db2d67098d98f2c3acf5a4946b7fb643
  Author: Cao jin <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/pci/pci.c
    M hw/pci/pci_host.c
    M hw/pci/pcie.c
    M include/hw/pci/pci.h

  Log Message:
  -----------
  enable multi-function hot-add

Enable PCIe device multi-function hot-add, just ensure function 0 is added
last, then driver will get the notification to scan the slot.

Signed-off-by: Cao jin <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>


  Commit: 7bc8e0c967a4ef77657174d28af775691e18b4ce
      
https://github.com/qemu/qemu/commit/7bc8e0c967a4ef77657174d28af775691e18b4ce
  Author: Peter Maydell <address@hidden>
  Date:   2015-10-29 (Thu, 29 Oct 2015)

  Changed paths:
    M hw/acpi/memory_hotplug.c
    M hw/block/virtio-blk.c
    M hw/char/virtio-serial-bus.c
    M hw/i386/pc.c
    M hw/i386/pc_piix.c
    M hw/i386/pc_q35.c
    M hw/mem/pc-dimm.c
    M hw/pci/pci.c
    M hw/pci/pci_host.c
    M hw/pci/pcie.c
    M hw/ppc/spapr.c
    M hw/scsi/virtio-scsi.c
    M hw/virtio/vhost-user.c
    M hw/virtio/virtio.c
    M include/hw/i386/pc.h
    M include/hw/mem/pc-dimm.h
    M include/hw/pci/pci.h
    M include/hw/virtio/virtio.h
    M tests/Makefile
    A tests/vhost-user-bridge.c
    M tests/vhost-user-test.c
    M util/mmap-alloc.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

virtio, pc, memory: fixes+features for 2.5

New features:
    This enables hotplug for multifunction devices.
    Patches are very small, so I think it's OK to merge
    at this stage.

    There's also some new infrastructure for vhost-user testing
    not enabled yet so it's harmless to merge.

I've reverted the "gap between DIMMs" workaround, as it seems too risky, and
applied my own patch in virtio, but not in dataplane code.  This means that
dataplane is broken for some complex DIMM configurations for now.  Waiting for
Stefan to review the dataplane fix.

Signed-off-by: Michael S. Tsirkin <address@hidden>

# gpg: Signature made Thu 29 Oct 2015 09:36:16 GMT using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <address@hidden>"
# gpg:                 aka "Michael S. Tsirkin <address@hidden>"

* remotes/mst/tags/for_upstream:
  enable multi-function hot-add
  remove function during multi-function hot-add
  tests/vhost-user-bridge: add vhost-user bridge application
  Revert "memhp: extend address auto assignment to support gaps"
  Revert "pc: memhp: force gaps between DIMM's GPA"
  virtio: drop virtqueue_map_sg
  virtio-scsi: convert to virtqueue_map
  virtio-serial: convert to virtio_map
  virtio-blk: convert to virtqueue_map
  virtio: switch to virtio_map
  virtio: introduce virtio_map
  mmap-alloc: fix error handling
  pc: memhp: do not emit inserting event for coldplugged DIMMs
  vhost-user-test: fix up rhel6 build
  vhost-user: cleanup msg size math
  vhost-user: cleanup struct size math

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/331c5e209100...7bc8e0c967a4

reply via email to

[Prev in Thread] Current Thread [Next in Thread]