1. 15 5月, 2020 2 次提交
    • M
      Drop more @errp parameters after previous commit · 40c2281c
      Markus Armbruster 提交于
      Several functions can't fail anymore: ich9_pm_add_properties(),
      device_add_bootindex_property(), ppc_compat_add_property(),
      spapr_caps_add_properties(), PropertyInfo.create().  Drop their @errp
      parameter.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20200505152926.18877-16-armbru@redhat.com>
      40c2281c
    • M
      qom: Clean up inconsistent use of gchar * vs. char * · ddfb0baa
      Markus Armbruster 提交于
      Uses of gchar * in qom/object.h:
      
      * ObjectProperty member @name
      
        Functions that take a property name argument all use char *.  Change
        the member to match.
      
      * ObjectProperty member @type
      
        Functions that take a property type argument or return it all use
        char *.  Change the member to match.
      
      * ObjectProperty member @description
      
        Functions that take a property description argument all use char *.
        Change the member to match.
      
      * object_resolve_path_component() parameter @part
      
        Path components are property names.  Most callers pass char *
        arguments.  Change the parameter to match.  Adjust the few callers
        that pass gchar * to pass char *.
      
      * Return value of object_get_canonical_path_component(),
        object_get_canonical_path()
      
        Most callers convert their return values right back to char *.
        Change the return value to match.  Adjust the few callers where that
        would add a conversion to gchar * to use char * instead.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20200505152926.18877-3-armbru@redhat.com>
      ddfb0baa
  2. 29 4月, 2020 2 次提交
    • M
      virtio-net: Fix duplex=... and speed=... error handling · 843c4cfc
      Markus Armbruster 提交于
      virtio_net_device_realize() rejects invalid duplex and speed values.
      The error handling is broken:
      
          $ ../qemu/bld-sani/x86_64-softmmu/qemu-system-x86_64 -S -display none -monitor stdio
          QEMU 4.2.93 monitor - type 'help' for more information
          (qemu) device_add virtio-net,duplex=x
          Error: 'duplex' must be 'half' or 'full'
          (qemu) c
          =================================================================
          ==15654==ERROR: AddressSanitizer: heap-use-after-free on address 0x62e000014590 at pc 0x560b75c8dc13 bp 0x7fffdf1a6950 sp 0x7fffdf1a6940
          READ of size 8 at 0x62e000014590 thread T0
      	#0 0x560b75c8dc12 in object_dynamic_cast_assert /work/armbru/qemu/qom/object.c:826
      	#1 0x560b74c38ac0 in virtio_vmstate_change /work/armbru/qemu/hw/virtio/virtio.c:3210
      	#2 0x560b74d9765e in vm_state_notify /work/armbru/qemu/softmmu/vl.c:1271
      	#3 0x560b7494ba72 in vm_prepare_start /work/armbru/qemu/cpus.c:2156
      	#4 0x560b7494bacd in vm_start /work/armbru/qemu/cpus.c:2162
      	#5 0x560b75a7d890 in qmp_cont /work/armbru/qemu/monitor/qmp-cmds.c:160
      	#6 0x560b75a8d70a in hmp_cont /work/armbru/qemu/monitor/hmp-cmds.c:1043
      	#7 0x560b75a799f2 in handle_hmp_command /work/armbru/qemu/monitor/hmp.c:1082
          [...]
      
          0x62e000014590 is located 33168 bytes inside of 42288-byte region [0x62e00000c400,0x62e000016930)
          freed by thread T1 here:
      	#0 0x7feadd39491f in __interceptor_free (/lib64/libasan.so.5+0x10d91f)
      	#1 0x7feadcebcd7c in g_free (/lib64/libglib-2.0.so.0+0x55d7c)
      	#2 0x560b75c8fd40 in object_unref /work/armbru/qemu/qom/object.c:1128
      	#3 0x560b7498a625 in memory_region_unref /work/armbru/qemu/memory.c:1762
      	#4 0x560b74999fa4 in do_address_space_destroy /work/armbru/qemu/memory.c:2788
      	#5 0x560b762362fc in call_rcu_thread /work/armbru/qemu/util/rcu.c:283
      	#6 0x560b761c8884 in qemu_thread_start /work/armbru/qemu/util/qemu-thread-posix.c:519
      	#7 0x7fead9be34bf in start_thread (/lib64/libpthread.so.0+0x84bf)
      
          previously allocated by thread T0 here:
      	#0 0x7feadd394d18 in __interceptor_malloc (/lib64/libasan.so.5+0x10dd18)
      	#1 0x7feadcebcc88 in g_malloc (/lib64/libglib-2.0.so.0+0x55c88)
      	#2 0x560b75c8cf8a in object_new /work/armbru/qemu/qom/object.c:699
      	#3 0x560b75010ad9 in qdev_device_add /work/armbru/qemu/qdev-monitor.c:654
      	#4 0x560b750120c2 in qmp_device_add /work/armbru/qemu/qdev-monitor.c:805
      	#5 0x560b75012c1b in hmp_device_add /work/armbru/qemu/qdev-monitor.c:905
          [...]
          ==15654==ABORTING
      
      Cause: virtio_net_device_realize() neglects to bail out after setting
      the error.  Fix that.
      
      Fixes: 9473939e
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20200422130719.28225-9-armbru@redhat.com>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      843c4cfc
    • P
      various: Remove suspicious '\' character outside of #define in C code · 78ee6bd0
      Philippe Mathieu-Daudé 提交于
      Fixes the following coccinelle warnings:
      
        $ spatch --sp-file --verbose-parsing  ... \
            scripts/coccinelle/remove_local_err.cocci
        ...
        SUSPICIOUS: a \ character appears outside of a #define at ./target/ppc/translate_init.inc.c:5213
        SUSPICIOUS: a \ character appears outside of a #define at ./target/ppc/translate_init.inc.c:5261
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:166
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:167
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:169
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:170
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:171
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:172
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:173
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5787
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5789
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5800
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5801
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5802
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5804
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5805
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5806
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:6329
        SUSPICIOUS: a \ character appears outside of a #define at ./hw/sd/sdhci.c:1133
        SUSPICIOUS: a \ character appears outside of a #define at ./hw/scsi/scsi-disk.c:3081
        SUSPICIOUS: a \ character appears outside of a #define at ./hw/net/virtio-net.c:1529
        SUSPICIOUS: a \ character appears outside of a #define at ./hw/riscv/sifive_u.c:468
        SUSPICIOUS: a \ character appears outside of a #define at ./dump/dump.c:1895
        SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2209
        SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2215
        SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2221
        SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2222
        SUSPICIOUS: a \ character appears outside of a #define at ./block/replication.c:172
        SUSPICIOUS: a \ character appears outside of a #define at ./block/replication.c:173
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-Id: <20200412223619.11284-2-f4bug@amsat.org>
      Reviewed-by: NAlistair Francis <alistair.francis@wdc.com>
      Acked-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      78ee6bd0
  3. 28 4月, 2020 1 次提交
  4. 31 3月, 2020 1 次提交
  5. 25 1月, 2020 1 次提交
  6. 07 1月, 2020 1 次提交
  7. 06 1月, 2020 1 次提交
  8. 02 12月, 2019 2 次提交
    • M
      net/virtio: Fix failover error handling crash bugs · 5a0948d3
      Markus Armbruster 提交于
      Functions that take an Error ** parameter to pass an error to the
      caller expect the parameter to point to null.
      failover_replug_primary() violates this precondition in several
      places:
      
      * After qemu_opts_from_qdict() failed, *errp is no longer null.
        Passing it to error_setg() is wrong, and will trip the assertion in
        error_setv().  Messed up in commit 150ab54a "net/virtio: fix
        re-plugging of primary device".  Simply drop the error_setg().
      
      * Passing @errp to qemu_opt_set_bool(), hotplug_handler_pre_plug(),
        and hotplug_handler_plug() is wrong.  If one of the first two fails,
        *errp is no longer null.  Risks tripping the same assertion.
        Moreover, continuing after such errors is unsafe.  Messed up in
        commit 9711cd0d "net/virtio: add failover support".  Fix by
        handling each error properly.
      
      failover_replug_primary() crashes when passed a null @errp.  Also
      messed up in commit 9711cd0d.  This bug can't bite as no caller
      actually passes null.  Fix it anyway.
      
      Fixes: 9711cd0d
      Fixes: 150ab54a
      Cc: Jens Freimann <jfreimann@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20191130194240.10517-3-armbru@redhat.com>
      Reviewed-by: NJens Freimann <jfreimann@redhat.com>
      5a0948d3
    • M
      net/virtio: Drop useless n->primary_dev not null checks · 4dbac1ae
      Markus Armbruster 提交于
      virtio_net_handle_migration_primary() returns early when it can't
      ensure n->primary_dev is non-null.  Checking it again right after that
      early return is redundant.  Drop.
      
      If n->primary_dev is null on entering failover_replug_primary(), @pdev
      will become null, and pdev->partially_hotplugged will crash.  Checking
      n->primary_dev later is useless.  It can't actually be null, because
      its caller virtio_net_handle_migration_primary() ensures it isn't.
      Drop the useless check.
      
      Cc: Jens Freimann <jfreimann@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20191130194240.10517-2-armbru@redhat.com>
      Reviewed-by: NJens Freimann <jfreimann@redhat.com>
      4dbac1ae
  9. 25 11月, 2019 4 次提交
  10. 30 10月, 2019 2 次提交
    • D
      virtio_net: use RCU_READ_LOCK_GUARD · 068ddfa9
      Dr. David Alan Gilbert 提交于
      Use RCU_READ_LOCK_GUARD rather than the manual rcu_read_(un)lock call.
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20191025103403.120616-3-dgilbert@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      068ddfa9
    • J
      net/virtio: add failover support · 9711cd0d
      Jens Freimann 提交于
      This patch adds support to handle failover device pairs of a virtio-net
      device and a (vfio-)pci device, where the virtio-net acts as the standby
      device and the (vfio-)pci device as the primary.
      
      The general idea is that we have a pair of devices, a (vfio-)pci and a
      emulated (virtio-net) device. Before migration the vfio device is
      unplugged and data flows to the emulated device, on the target side
      another (vfio-)pci device is plugged in to take over the data-path. In the
      guest the net_failover module will pair net devices with the same MAC
      address.
      
      To achieve this we need:
      
      1. Provide a callback function for the should_be_hidden DeviceListener.
         It is called when the primary device is plugged in. Evaluate the QOpt
         passed in to check if it is the matching primary device. It returns
         if the device should be hidden or not.
         When it should be hidden it stores the device options in the VirtioNet
         struct and the device is added once the VIRTIO_NET_F_STANDBY feature is
         negotiated during virtio feature negotiation.
      
         If the virtio-net devices are not realized at the time the (vfio-)pci
         devices are realized, we need to connect the devices later. This way
         we make sure primary and standby devices can be specified in any
         order.
      
      2. Register a callback for migration status notifier. When called it
         will unplug its primary device before the migration happens.
      
      3. Register a callback for the migration code that checks if a device
         needs to be unplugged from the guest.
      Signed-off-by: NJens Freimann <jfreimann@redhat.com>
      Message-Id: <20191029114905.6856-11-jfreimann@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      9711cd0d
  11. 29 10月, 2019 1 次提交
    • M
      virtio-net: prevent offloads reset on migration · 7788c3f2
      Mikhail Sennikovsky 提交于
      Currently offloads disabled by guest via the VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET
      command are not preserved on VM migration.
      Instead all offloads reported by guest features (via VIRTIO_PCI_GUEST_FEATURES)
      get enabled.
      What happens is: first the VirtIONet::curr_guest_offloads gets restored and offloads
      are getting set correctly:
      
       #0  qemu_set_offload (nc=0x555556a11400, csum=1, tso4=0, tso6=0, ecn=0, ufo=0) at net/net.c:474
       #1  virtio_net_apply_guest_offloads (n=0x555557701ca0) at hw/net/virtio-net.c:720
       #2  virtio_net_post_load_device (opaque=0x555557701ca0, version_id=11) at hw/net/virtio-net.c:2334
       #3  vmstate_load_state (f=0x5555569dc010, vmsd=0x555556577c80 <vmstate_virtio_net_device>, opaque=0x555557701ca0, version_id=11)
           at migration/vmstate.c:168
       #4  virtio_load (vdev=0x555557701ca0, f=0x5555569dc010, version_id=11) at hw/virtio/virtio.c:2197
       #5  virtio_device_get (f=0x5555569dc010, opaque=0x555557701ca0, size=0, field=0x55555668cd00 <__compound_literal.5>) at hw/virtio/virtio.c:2036
       #6  vmstate_load_state (f=0x5555569dc010, vmsd=0x555556577ce0 <vmstate_virtio_net>, opaque=0x555557701ca0, version_id=11) at migration/vmstate.c:143
       #7  vmstate_load (f=0x5555569dc010, se=0x5555578189e0) at migration/savevm.c:829
       #8  qemu_loadvm_section_start_full (f=0x5555569dc010, mis=0x5555569eee20) at migration/savevm.c:2211
       #9  qemu_loadvm_state_main (f=0x5555569dc010, mis=0x5555569eee20) at migration/savevm.c:2395
       #10 qemu_loadvm_state (f=0x5555569dc010) at migration/savevm.c:2467
       #11 process_incoming_migration_co (opaque=0x0) at migration/migration.c:449
      
      However later on the features are getting restored, and offloads get reset to
      everything supported by features:
      
       #0  qemu_set_offload (nc=0x555556a11400, csum=1, tso4=1, tso6=1, ecn=0, ufo=0) at net/net.c:474
       #1  virtio_net_apply_guest_offloads (n=0x555557701ca0) at hw/net/virtio-net.c:720
       #2  virtio_net_set_features (vdev=0x555557701ca0, features=5104441767) at hw/net/virtio-net.c:773
       #3  virtio_set_features_nocheck (vdev=0x555557701ca0, val=5104441767) at hw/virtio/virtio.c:2052
       #4  virtio_load (vdev=0x555557701ca0, f=0x5555569dc010, version_id=11) at hw/virtio/virtio.c:2220
       #5  virtio_device_get (f=0x5555569dc010, opaque=0x555557701ca0, size=0, field=0x55555668cd00 <__compound_literal.5>) at hw/virtio/virtio.c:2036
       #6  vmstate_load_state (f=0x5555569dc010, vmsd=0x555556577ce0 <vmstate_virtio_net>, opaque=0x555557701ca0, version_id=11) at migration/vmstate.c:143
       #7  vmstate_load (f=0x5555569dc010, se=0x5555578189e0) at migration/savevm.c:829
       #8  qemu_loadvm_section_start_full (f=0x5555569dc010, mis=0x5555569eee20) at migration/savevm.c:2211
       #9  qemu_loadvm_state_main (f=0x5555569dc010, mis=0x5555569eee20) at migration/savevm.c:2395
       #10 qemu_loadvm_state (f=0x5555569dc010) at migration/savevm.c:2467
       #11 process_incoming_migration_co (opaque=0x0) at migration/migration.c:449
      
      Fix this by preserving the state in saved_guest_offloads field and
      pushing out offload initialization to the new post load hook.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMikhail Sennikovsky <mikhail.sennikovskii@cloud.ionos.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      7788c3f2
  12. 28 10月, 2019 1 次提交
  13. 16 8月, 2019 3 次提交
    • M
      sysemu: Move the VMChangeStateEntry typedef to qemu/typedefs.h · 2f780b6a
      Markus Armbruster 提交于
      In my "build everything" tree, changing sysemu/sysemu.h triggers a
      recompile of some 1800 out of 6600 objects (not counting tests and
      objects that don't depend on qemu/osdep.h, down from 5400 due to the
      previous commit).
      
      Several headers include sysemu/sysemu.h just to get typedef
      VMChangeStateEntry.  Move it from sysemu/sysemu.h to qemu/typedefs.h.
      Spell its structure tag the same while there.  Drop the now
      superfluous includes of sysemu/sysemu.h from headers.
      
      Touching sysemu/sysemu.h now recompiles some 1100 objects.
      qemu/uuid.h also drops from 1800 to 1100, and
      qapi/qapi-types-run-state.h from 5000 to 4400.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190812052359.30071-29-armbru@redhat.com>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Tested-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      2f780b6a
    • M
      Include hw/qdev-properties.h less · a27bd6c7
      Markus Armbruster 提交于
      In my "build everything" tree, changing hw/qdev-properties.h triggers
      a recompile of some 2700 out of 6600 objects (not counting tests and
      objects that don't depend on qemu/osdep.h).
      
      Many places including hw/qdev-properties.h (directly or via hw/qdev.h)
      actually need only hw/qdev-core.h.  Include hw/qdev-core.h there
      instead.
      
      hw/qdev.h is actually pointless: all it does is include hw/qdev-core.h
      and hw/qdev-properties.h, which in turn includes hw/qdev-core.h.
      Replace the remaining uses of hw/qdev.h by hw/qdev-properties.h.
      
      While there, delete a few superfluous inclusions of hw/qdev-core.h.
      
      Touching hw/qdev-properties.h now recompiles some 1200 objects.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Daniel P. Berrangé" <berrange@redhat.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <20190812052359.30071-22-armbru@redhat.com>
      a27bd6c7
    • M
      Include qemu/main-loop.h less · db725815
      Markus Armbruster 提交于
      In my "build everything" tree, changing qemu/main-loop.h triggers a
      recompile of some 5600 out of 6600 objects (not counting tests and
      objects that don't depend on qemu/osdep.h).  It includes block/aio.h,
      which in turn includes qemu/event_notifier.h, qemu/notify.h,
      qemu/processor.h, qemu/qsp.h, qemu/queue.h, qemu/thread-posix.h,
      qemu/thread.h, qemu/timer.h, and a few more.
      
      Include qemu/main-loop.h only where it's needed.  Touching it now
      recompiles only some 1700 objects.  For block/aio.h and
      qemu/event_notifier.h, these numbers drop from 5600 to 2800.  For the
      others, they shrink only slightly.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190812052359.30071-21-armbru@redhat.com>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Tested-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      db725815
  14. 02 7月, 2019 1 次提交
    • D
      net/announce: Add optional ID · 944458b6
      Dr. David Alan Gilbert 提交于
      Previously there was a single instance of the timer used by
      monitor triggered announces, that's OK, but when combined with the
      previous change that lets you have announces for subsets of interfaces
      it's a bit restrictive if you want to do different things to different
      interfaces.
      
      Add an 'id' field to the announce, and maintain a list of the
      timers based on id.
      
      This allows you to for example:
          a) Start an announce going on interface eth0 for a long time
          b) Start an announce going on interface eth1 for a long time
          c) Kill the announce on eth0 while leaving eth1 going.
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      944458b6
  15. 12 6月, 2019 1 次提交
  16. 02 4月, 2019 1 次提交
  17. 05 3月, 2019 2 次提交
  18. 22 2月, 2019 1 次提交
  19. 18 1月, 2019 2 次提交
    • Y
      virtio-net: changed VIRTIO_NET_F_RSC_EXT to be 61 · d47e5e31
      Yuri Benditovich 提交于
      Allocated feature bit changed in spec draft per TC request.
      Signed-off-by: NYuri Benditovich <yuri.benditovich@daynix.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      d47e5e31
    • Y
      virtio-net: support RSC v4/v6 tcp traffic for Windows HCK · 2974e916
      Yuri Benditovich 提交于
      This commit adds implementation of RX packets
      coalescing, compatible with requirements of Windows
      Hardware compatibility kit.
      
      The device enables feature VIRTIO_NET_F_RSC_EXT in
      host features if it supports extended RSC functionality
      as defined in the specification.
      This feature requires at least one of VIRTIO_NET_F_GUEST_TSO4,
      VIRTIO_NET_F_GUEST_TSO6. Windows guest driver acks
      this feature only if VIRTIO_NET_F_CTRL_GUEST_OFFLOADS
      is also present.
      
      If the guest driver acks VIRTIO_NET_F_RSC_EXT feature,
      the device coalesces TCPv4 and TCPv6 packets (if
      respective VIRTIO_NET_F_GUEST_TSO feature is on,
      populates extended RSC information in virtio header
      and sets VIRTIO_NET_HDR_F_RSC_INFO bit in header flags.
      The device does not recalculate checksums in the coalesced
      packet, so they are not valid.
      
      In this case:
      All the data packets in a tcp connection are cached
      to a single buffer in every receive interval, and will
      be sent out via a timer, the 'virtio_net_rsc_timeout'
      controls the interval, this value may impact the
      performance and response time of tcp connection,
      50000(50us) is an experience value to gain a performance
      improvement, since the whql test sends packets every 100us,
      so '300000(300us)' passes the test case, it is the default
      value as well, tune it via the command line parameter
      'rsc_interval' within 'virtio-net-pci' device, for example,
      to launch a guest with interval set as '500000':
      
      'virtio-net-pci,netdev=hostnet1,bus=pci.0,id=net1,mac=00,
      guest_rsc_ext=on,rsc_interval=500000'
      
      The timer will only be triggered if the packets pool is not empty,
      and it'll drain off all the cached packets.
      
      'NetRscChain' is used to save the segments of IPv4/6 in a
      VirtIONet device.
      
      A new segment becomes a 'Candidate' as well as it passed sanity check,
      the main handler of TCP includes TCP window update, duplicated
      ACK check and the real data coalescing.
      
      An 'Candidate' segment means:
      1. Segment is within current window and the sequence is the expected one.
      2. 'ACK' of the segment is in the valid window.
      
      Sanity check includes:
      1. Incorrect version in IP header
      2. An IP options or IP fragment
      3. Not a TCP packet
      4. Sanity size check to prevent buffer overflow attack.
      5. An ECN packet
      
      Even though, there might more cases should be considered such as
      ip identification other flags, while it breaks the test because
      windows set it to the same even it's not a fragment.
      
      Normally it includes 2 typical ways to handle a TCP control flag,
      'bypass' and 'finalize', 'bypass' means should be sent out directly,
      while 'finalize' means the packets should also be bypassed, but this
      should be done after search for the same connection packets in the
      pool and drain all of them out, this is to avoid out of order fragment.
      
      All the 'SYN' packets will be bypassed since this always begin a new'
      connection, other flags such 'URG/FIN/RST/CWR/ECE' will trigger a
      finalization, because this normally happens upon a connection is going
      to be closed, an 'URG' packet also finalize current coalescing unit.
      
      Statistics can be used to monitor the basic coalescing status, the
      'out of order' and 'out of window' means how many retransmitting packets,
      thus describe the performance intuitively.
      
      Difference between ip v4 and v6 processing:
       Fragment length in ipv4 header includes itself, while it's not
       included for ipv6, thus means ipv6 can carry a real 65535 payload.
      
      Note that main goal of implementing this feature in software
      is to create reference setup for certification tests. In such
      setups guest migration is not required, so the coalesced packets
      not yet delivered to the guest will be lost in case of migration.
      Signed-off-by: NWei Xu <wexu@redhat.com>
      Signed-off-by: NYuri Benditovich <yuri.benditovich@daynix.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      2974e916
  20. 11 1月, 2019 1 次提交
    • P
      avoid TABs in files that only contain a few · 7d37435b
      Paolo Bonzini 提交于
      Most files that have TABs only contain a handful of them.  Change
      them to spaces so that we don't confuse people.
      
      disas, standard-headers, linux-headers and libdecnumber are imported
      from other projects and probably should be exempted from the check.
      Outside those, after this patch the following files still contain both
      8-space and TAB sequences at the beginning of the line.  Many of them
      have a majority of TABs, or were initially committed with all tabs.
      
          bsd-user/i386/target_syscall.h
          bsd-user/x86_64/target_syscall.h
          crypto/aes.c
          hw/audio/fmopl.c
          hw/audio/fmopl.h
          hw/block/tc58128.c
          hw/display/cirrus_vga.c
          hw/display/xenfb.c
          hw/dma/etraxfs_dma.c
          hw/intc/sh_intc.c
          hw/misc/mst_fpga.c
          hw/net/pcnet.c
          hw/sh4/sh7750.c
          hw/timer/m48t59.c
          hw/timer/sh_timer.c
          include/crypto/aes.h
          include/disas/bfd.h
          include/hw/sh4/sh.h
          libdecnumber/decNumber.c
          linux-headers/asm-generic/unistd.h
          linux-headers/linux/kvm.h
          linux-user/alpha/target_syscall.h
          linux-user/arm/nwfpe/double_cpdo.c
          linux-user/arm/nwfpe/fpa11_cpdt.c
          linux-user/arm/nwfpe/fpa11_cprt.c
          linux-user/arm/nwfpe/fpa11.h
          linux-user/flat.h
          linux-user/flatload.c
          linux-user/i386/target_syscall.h
          linux-user/ppc/target_syscall.h
          linux-user/sparc/target_syscall.h
          linux-user/syscall.c
          linux-user/syscall_defs.h
          linux-user/x86_64/target_syscall.h
          slirp/cksum.c
          slirp/if.c
          slirp/ip.h
          slirp/ip_icmp.c
          slirp/ip_icmp.h
          slirp/ip_input.c
          slirp/ip_output.c
          slirp/mbuf.c
          slirp/misc.c
          slirp/sbuf.c
          slirp/socket.c
          slirp/socket.h
          slirp/tcp_input.c
          slirp/tcpip.h
          slirp/tcp_output.c
          slirp/tcp_subr.c
          slirp/tcp_timer.c
          slirp/tftp.c
          slirp/udp.c
          slirp/udp.h
          target/cris/cpu.h
          target/cris/mmu.c
          target/cris/op_helper.c
          target/sh4/helper.c
          target/sh4/op_helper.c
          target/sh4/translate.c
          tcg/sparc/tcg-target.inc.c
          tests/tcg/cris/check_addo.c
          tests/tcg/cris/check_moveq.c
          tests/tcg/cris/check_swap.c
          tests/tcg/multiarch/test-mmap.c
          ui/vnc-enc-hextile-template.h
          ui/vnc-enc-zywrle.h
          util/envlist.c
          util/readline.c
      
      The following have only TABs:
      
          bsd-user/i386/target_signal.h
          bsd-user/sparc64/target_signal.h
          bsd-user/sparc64/target_syscall.h
          bsd-user/sparc/target_signal.h
          bsd-user/sparc/target_syscall.h
          bsd-user/x86_64/target_signal.h
          crypto/desrfb.c
          hw/audio/intel-hda-defs.h
          hw/core/uboot_image.h
          hw/sh4/sh7750_regnames.c
          hw/sh4/sh7750_regs.h
          include/hw/cris/etraxfs_dma.h
          linux-user/alpha/termbits.h
          linux-user/arm/nwfpe/fpopcode.h
          linux-user/arm/nwfpe/fpsr.h
          linux-user/arm/syscall_nr.h
          linux-user/arm/target_signal.h
          linux-user/cris/target_signal.h
          linux-user/i386/target_signal.h
          linux-user/linux_loop.h
          linux-user/m68k/target_signal.h
          linux-user/microblaze/target_signal.h
          linux-user/mips64/target_signal.h
          linux-user/mips/target_signal.h
          linux-user/mips/target_syscall.h
          linux-user/mips/termbits.h
          linux-user/ppc/target_signal.h
          linux-user/sh4/target_signal.h
          linux-user/sh4/termbits.h
          linux-user/sparc64/target_syscall.h
          linux-user/sparc/target_signal.h
          linux-user/x86_64/target_signal.h
          linux-user/x86_64/termbits.h
          pc-bios/optionrom/optionrom.h
          slirp/mbuf.h
          slirp/misc.h
          slirp/sbuf.h
          slirp/tcp.h
          slirp/tcp_timer.h
          slirp/tcp_var.h
          target/i386/svm.h
          target/sparc/asi.h
          target/xtensa/core-dc232b/xtensa-modules.inc.c
          target/xtensa/core-dc233c/xtensa-modules.inc.c
          target/xtensa/core-de212/core-isa.h
          target/xtensa/core-de212/xtensa-modules.inc.c
          target/xtensa/core-fsf/xtensa-modules.inc.c
          target/xtensa/core-sample_controller/core-isa.h
          target/xtensa/core-sample_controller/xtensa-modules.inc.c
          target/xtensa/core-test_kc705_be/core-isa.h
          target/xtensa/core-test_kc705_be/xtensa-modules.inc.c
          tests/tcg/cris/check_abs.c
          tests/tcg/cris/check_addc.c
          tests/tcg/cris/check_addcm.c
          tests/tcg/cris/check_addoq.c
          tests/tcg/cris/check_bound.c
          tests/tcg/cris/check_ftag.c
          tests/tcg/cris/check_int64.c
          tests/tcg/cris/check_lz.c
          tests/tcg/cris/check_openpf5.c
          tests/tcg/cris/check_sigalrm.c
          tests/tcg/cris/crisutils.h
          tests/tcg/cris/sys.c
          tests/tcg/i386/test-i386-ssse3.c
          ui/vgafont.h
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20181213223737.11793-3-pbonzini@redhat.com>
      Reviewed-by: NAleksandar Markovic <amarkovic@wavecomp.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NWainer dos Santos Moschetta <wainersm@redhat.com>
      Acked-by: NRichard Henderson <richard.henderson@linaro.org>
      Acked-by: NEric Blake <eblake@redhat.com>
      Acked-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NStefan Markovic <smarkovic@wavecomp.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7d37435b
  21. 19 10月, 2018 1 次提交
  22. 29 8月, 2018 1 次提交
  23. 27 6月, 2018 1 次提交
  24. 26 3月, 2018 1 次提交
    • G
      virtio_net: flush uncompleted TX on reset · 94b52958
      Greg Kurz 提交于
      If the backend could not transmit a packet right away for some reason,
      the packet is queued for asynchronous sending. The corresponding vq
      element is tracked in the async_tx.elem field of the VirtIONetQueue,
      for later freeing when the transmission is complete.
      
      If a reset happens before completion, virtio_net_tx_complete() will push
      async_tx.elem back to the guest anyway, and we end up with the inuse flag
      of the vq being equal to -1. The next call to virtqueue_pop() is then
      likely to fail with "Virtqueue size exceeded".
      
      This can be reproduced easily by starting a guest with an hubport backend
      that is not connected to a functional network, eg,
      
       -device virtio-net-pci,netdev=hub0 -netdev hubport,id=hub0,hubid=0
      
      and no other -netdev hubport,hubid=0 on the command line.
      
      The appropriate fix is to ensure that such an asynchronous transmission
      cannot survive a device reset. So for all queues, we first try to send
      the packet again, and eventually we purge it if the backend still could
      not deliver it.
      
      CC: qemu-stable@nongnu.org
      Reported-by: NR. Nageswara Sastry <nasastry@in.ibm.com>
      Buglink: https://github.com/open-power-host-os/qemu/issues/37Signed-off-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NR. Nageswara Sastry <nasastry@in.ibm.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      94b52958
  25. 14 3月, 2018 2 次提交
  26. 03 3月, 2018 1 次提交
  27. 09 2月, 2018 2 次提交