virtio,pci,pc: fixes for 10.2
Subsystems (3)
Michael S. Tsirkin
maintainerThe following changes since commit 917ac07f9aef579b9538a81d45f45850aba42906:
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2025-11-05 16:07:18 +0100)
are available in the Git repository at:
https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to 97f24a0496be9e0a7216fea1fa0d54c1db9066e2:
vhost-user.rst: clarify when FDs can be sent (2025-11-09 08:25:53 -0500)
----------------------------------------------------------------
virtio,pci,pc: fixes for 10.2
small fixes all over the place.
UDP tunnel and TSEG tweaks are kind of borderline, but I feel not making the change now will just add to compatibility headaches down the road.
----------------------------------------------------------------
Albert Esteve (1):
vhost-user: fix shared object lookup handler logic
Alejandro Jimenez (1):
MAINTAINERS: Update entry for AMD-Vi Emulation
Alyssa Ross (1):
vhost-user.rst: clarify when FDs can be sent
Eric Auger (1):
hw/pci-host/gpex-acpi: Fix _DSM function 0 support return value
Gerd Hoffmann (1):
q35: increase default tseg size
German Maglione (1):
vhost-user: make vhost_set_vring_file() synchronous
Paolo Abeni (1):
virtio-net: Advertise UDP tunnel GSO support by default
Sairaj Kodilkar (2):
amd_iommu: Fix handling of devices on buses != 0
amd_iommu: Support 64-bit address for IOTLB lookup
Shameer Kolothum (2):
tests/qtest/bios-tables-test: Prepare for _DSM change in the DSDT table tests/qtest/bios-tables-test: Update DSDT blobs after GPEX _DSM change
Zhenzhong Duan (3):
intel_iommu: Handle PASID cache invalidation
intel_iommu: Reset pasid cache when system level reset
intel_iommu: Fix DMA failure when guest switches IOMMU domain
hw/i386/amd_iommu.h | 6 +- hw/i386/intel_iommu_internal.h | 17 +++ include/hw/i386/intel_iommu.h | 6 + hw/core/machine.c | 4 + hw/i386/amd_iommu.c | 179 +++++++++++++--------- hw/i386/intel_iommu.c | 181 +++++++++++++++++++++-- hw/i386/pc.c | 4 +- hw/net/virtio-net.c | 8 +- hw/pci-host/gpex-acpi.c | 2 +- hw/pci-host/q35.c | 2 +- hw/virtio/vhost-user.c | 64 ++++---- MAINTAINERS | 6 +- docs/interop/vhost-user.rst | 7 + hw/i386/trace-events | 4 + tests/data/acpi/aarch64/virt/DSDT | Bin 5337 -> 5337 bytes tests/data/acpi/aarch64/virt/DSDT.acpihmatvirt | Bin 5423 -> 5423 bytes tests/data/acpi/aarch64/virt/DSDT.acpipcihp | Bin 6246 -> 6246 bytes tests/data/acpi/aarch64/virt/DSDT.hpoffacpiindex | Bin 5391 -> 5391 bytes tests/data/acpi/aarch64/virt/DSDT.memhp | Bin 6698 -> 6698 bytes tests/data/acpi/aarch64/virt/DSDT.pxb | Bin 7812 -> 7812 bytes tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev | Bin 10274 -> 10274 bytes tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy | Bin 10274 -> 10274 bytes tests/data/acpi/aarch64/virt/DSDT.topology | Bin 5539 -> 5539 bytes tests/data/acpi/aarch64/virt/DSDT.viot | Bin 5354 -> 5354 bytes tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4603 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5824 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4609 bytes tests/data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4905 bytes tests/data/acpi/riscv64/virt/DSDT | Bin 3538 -> 3538 bytes tests/data/acpi/x86/microvm/DSDT.pcie | Bin 2985 -> 2985 bytes 30 files changed, 371 insertions(+), 119 deletions(-)
Michael S. Tsirkin
maintainer[PULL 02/14] amd_iommu: Fix handling of devices on buses != 0
From: Sairaj Kodilkar <[email protected]>
The AMD IOMMU is set up at boot time and uses PCI bus numbers + devfn for indexing into the DTE. The problem is that before the guest starts, all PCI bus numbers are 0 as no PCI discovery has happened yet (BIOS and/or kernel will do that later), so relying on the bus number is wrong.
The immediate effect is that emulated devices cannot do DMA when placed on a bus other than 0.
Replace the static address_space array with a hash table keyed by devfn and PCIBus*, since these values do not change after the guest boots.
Message-Id: <[email protected]>
--- hw/i386/amd_iommu.h | 2 +- hw/i386/amd_iommu.c | 134 ++++++++++++++++++++++++++------------------ 2 files changed, 79 insertions(+), 57 deletions(-)
hw/i386/amd_iommu.h +1 -1
@@ -408,7 +408,7 @@ struct AMDVIState {bool mmio_enabled;/* for each served device */ -AMDVIAddressSpace **address_spaces[PCI_BUS_MAX ]; +GHashTable *address_spaces;/* list of address spaces with registered notifiers */ QLIST_HEAD(, AMDVIAddressSpace) amdvi_as_with_notifiers;
hw/i386/amd_iommu.c +78 -56
220 lines not on this page · raw message
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 14/14] vhost-user.rst: clarify when FDs can be sent
In reply to Michael S. TsirkinFrom: Alyssa Ross <[email protected]>
Previously the spec did not say where in a message the FDs should be sent. As I understand it, FDs transferred in ancillary data will always be received along with the first byte of the data they were sent with, so we should define which byte that is. Going by both libvhost-user in QEMU and the rust-vmm crate, that byte is the first byte of the message header. This is important to specify because it would make back-end implementation significantly more complicated if receiving file descriptors in the middle of a message had to be handled.
Message-Id: <[email protected]>
--- docs/interop/vhost-user.rst | 7 +++++++ 1 file changed, 7 insertions(+)
docs/interop/vhost-user.rst +7 -0
@@ -411,6 +411,13 @@ in the ancillary data: * ``VHOST_USER_SET_INFLIGHT_FD`` (if ``VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD``) * ``VHOST_USER_SET_DEVICE_STATE_FD`` +When sending file descriptors in ancilliary data, *front-end* should +associate the ancilliary data with a ``sendmsg`` operation (or +equivalent) that sends bytes starting with the first byte of the +message header. *back-end* can therefore expect that file descriptors +will only be received in the first ``recvmsg`` operation for a message +header. + If *front-end* is unable to send the full message or receives a wrong reply it will close the connection. An optional reconnection mechanism can be implemented.
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 07/14] intel_iommu: Fix DMA failure when guest switches IOMMU domain
In reply to Michael S. TsirkinFrom: Zhenzhong Duan <[email protected]>
Kernel allows user to switch IOMMU domain, e.g., switch between DMA and identity domain. When this happen in IOMMU scalable mode, a pasid cache invalidation request is sent, this request is ignored by vIOMMU which leads to device binding to wrong address space, then DMA fails.
This issue exists in scalable mode with both first stage and second stage translations, both emulated and passthrough devices.
Take network device for example, below sequence trigger issue:
1. start a guest with iommu=pt
2. echo 0000:01:00.0 > /sys/bus/pci/drivers/virtio-pci/unbind
3. echo DMA > /sys/kernel/iommu_groups/6/type
4. echo 0000:01:00.0 > /sys/bus/pci/drivers/virtio-pci/bind
5. Ping test
Fix it by switching address space in invalidation handler.
Message-Id: <[email protected]>
--- hw/i386/intel_iommu.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
hw/i386/intel_iommu.c +27 -2
@@ -3086,6 +3086,11 @@ static inline int vtd_dev_get_pe_from_pasid(VTDAddressSpace *vtd_as,return vtd_ce_get_rid2pasid_entry (s, &ce, pe, vtd_as->pasid); } +static int vtd_pasid_entry_compare (VTDPASIDEntry *p1,VTDPASIDEntry *p2) +{ +return memcmp (p1, p2,sizeof (*p1)); +} +/* Update or invalidate pasid cache based on the pasid entry in guest memory. */ static void vtd_pasid_cache_sync_locked (gpointer key,gpointer value,gpointer user_data)
@@ -3094,15 +3099,28 @@ static void vtd_pasid_cache_sync_locked(gpointer key, gpointer value,VTDAddressSpace *vtd_as = value;VTDPASIDCacheEntry *pc_entry = &vtd_as->pasid_cache_entry;VTDPASIDEntry pe; +IOMMUNotifier *n;uint16_t did;if (vtd_dev_get_pe_from_pasid (vtd_as, &pe)) { +if (!pc_entry->valid) { +return ; + }/* * No valid pasid entry in guest memory. e.g. pasid entry was modified * to be either all-zero or non-present. Either case means existing * pasid cache should be invalidated. */ pc_entry->valid = false; + +/* +* When a pasid entry isn't valid any more, we should unmap all +* mappings in shadow pages instantly to ensure DMA security. +*/ + IOMMU_NOTIFIER_FOREACH(n, &vtd_as->iommu) { +vtd_address_space_unmap (vtd_as, n); + } +vtd_switch_address_space (vtd_as);return ; }
@@ -3128,8 +3146,15 @@ static void vtd_pasid_cache_sync_locked(gpointer key, gpointer value, } } - pc_entry->pasid_entry = pe; - pc_entry->valid = true; +if (!pc_entry->valid) { + pc_entry->pasid_entry = pe; + pc_entry->valid = true; + }else if (!vtd_pasid_entry_compare (&pe, &pc_entry->pasid_entry)) { +return ; + } + +vtd_switch_address_space (vtd_as); +vtd_address_space_sync (vtd_as); }static void vtd_pasid_cache_sync (IntelIOMMUState *s,VTDPASIDCacheInfo *pc_info)
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 13/14] q35: increase default tseg size
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
With virtual machines becoming larger (more CPUs, more memory) the memory needed by the SMM code in OVMF to manage page tables and vcpu state grows too.
Default SMM memory (aka TSEG) size is 16 MB, and this often is not enough. Bump it to 64 MB for new machine types.
Message-Id: <[email protected]>
--- hw/i386/pc.c | 4 +++- hw/pci-host/q35.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
hw/i386/pc.c +3 -1
@@ -81,7 +81,9 @@ { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\ { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, }, -GlobalProperty pc_compat_10_1[] = {}; +GlobalProperty pc_compat_10_1[] = { + { "mch", "extended-tseg-mbytes", "16" }, +};const size_t pc_compat_10_1_len =G_N_ELEMENTS (pc_compat_10_1); GlobalProperty pc_compat_10_0[] = {
hw/pci-host/q35.c +1 -1
@@ -663,7 +663,7 @@ static void mch_realize(PCIDevice *d, Error **errp)static const Property mch_props[] = {DEFINE_PROP_UINT16 ("extended-tseg-mbytes" , MCHPCIState, ext_tseg_mbytes, -16 ), +64 ),DEFINE_PROP_BOOL ("smbase-smram" , MCHPCIState, has_smram_at_smbase, true), };
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 10/14] hw/pci-host/gpex-acpi: Fix _DSM function 0 support return value
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
Currently, only function 0 is supported. According to the ACPI Specification, Revision 6.6, Section 9.1.1 “_DSM (Device Specific Method)”, bit 0 should be 0 to indicate that no other functions are supported beyond function 0.
The resulting AML change looks like this:
Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method
{
If ((Arg0 == ToUUID ("e5c937d0-3553-4d7a-9117-ea4d19c3434d")
{
If ((Arg2 == Zero))
{
Return (Buffer (One)
{
- 0x01 // .
+ 0x00 // .
})
}
}
}Message-Id: <[email protected]>
--- hw/pci-host/gpex-acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/gpex-acpi.c +1 -1
@@ -64,7 +64,7 @@ static Aml *build_pci_host_bridge_dsm_method(void)UUID =aml_touuid ("E5C937D0-3553-4D7A-9117-EA4D19C3434D" ); ifctx =aml_if (aml_equal (aml_arg (0 ),UUID )); ifctx1 =aml_if (aml_equal (aml_arg (2 ),aml_int (0 ))); -uint8_t byte_list[1 ] = {1 }; +uint8_t byte_list[1 ] = {0 }; buf =aml_buffer (1 , byte_list);aml_append (ifctx1,aml_return (buf));aml_append (ifctx, ifctx1);
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 05/14] intel_iommu: Handle PASID cache invalidation
In reply to Michael S. TsirkinFrom: Zhenzhong Duan <[email protected]>
Adds a new entry VTDPASIDCacheEntry in VTDAddressSpace to cache the pasid entry and track PASID usage and future PASID tagged DMA address translation support in vIOMMU.
When guest triggers pasid cache invalidation, QEMU will capture it and update or invalidate pasid cache.
vIOMMU emulator could figure out the reason by fetching latest guest pasid entry in memory and compare it with cached PASID entry if it's valid.
Message-Id: <[email protected]>
--- hw/i386/intel_iommu_internal.h | 17 ++++ include/hw/i386/intel_iommu.h | 6 ++ hw/i386/intel_iommu.c | 141 ++++++++++++++++++++++++++++++--- hw/i386/trace-events | 3 + 4 files changed, 157 insertions(+), 10 deletions(-)
hw/i386/intel_iommu_internal.h +17 -0
@@ -316,6 +316,8 @@ typedef enum VTDFaultReason {* request while disabled */ VTD_FR_IR_SID_ERR =0x26 ,/* Invalid Source-ID */ +VTD_FR_RTADDR_INV_TTM =0x31 ,/* Invalid TTM in RTADDR */ + VTD_FR_SM_PRE_ABS = 0x47, /* SCT.8 : PRE bit in a present SM CE is 0 *//* PASID directory entry access failure */
@@ -517,6 +519,15 @@ typedef union VTDPRDesc VTDPRDesc;#define VTD_INV_DESC_PIOTLB_RSVD_VAL0 0xfff000000000f1c0ULL#define VTD_INV_DESC_PIOTLB_RSVD_VAL1 0xf80ULL +/* PASID-cache Invalidate Descriptor (pc_inv_dsc) fields */ +#define VTD_INV_DESC_PASIDC_G (x) extract64((x)->val[0], 4, 2) +#define VTD_INV_DESC_PASIDC_G_DSI 0 +#define VTD_INV_DESC_PASIDC_G_PASID_SI 1 +#define VTD_INV_DESC_PASIDC_G_GLOBAL 3 +#define VTD_INV_DESC_PASIDC_DID (x) extract64((x)->val[0], 16, 16) +#define VTD_INV_DESC_PASIDC_PASID (x) extract64((x)->val[0], 32, 20) +#define VTD_INV_DESC_PASIDC_RSVD_VAL0 0xfff000000000f1c0ULL +/* Page Request Descriptor */ /* For the low 64-bit of 128-bit */ #define VTD_PRD_TYPE (1ULL)
@@ -603,6 +614,12 @@ typedef struct VTDRootEntry VTDRootEntry;#define VTD_SM_CONTEXT_ENTRY_RSVD_VAL1 0xffffffffffe00000ULL#define VTD_SM_CONTEXT_ENTRY_PRE 0x10ULL +typedef struct VTDPASIDCacheInfo { +uint8_t type; +uint16_t did; +uint32_t pasid; +}VTDPASIDCacheInfo ; +/* PASID Table Related Definitions */ #define VTD_PASID_DIR_BASE_ADDR_MASK (~0xfffULL)#define VTD_PASID_TABLE_BASE_ADDR_MASK (~0xfffULL)
include/hw/i386/intel_iommu.h +6 -0
@@ -95,6 +95,11 @@ struct VTDPASIDEntry {uint64_t val[8 ]; }; +typedef struct VTDPASIDCacheEntry { +struct VTDPASIDEntry pasid_entry; +bool valid; +}VTDPASIDCacheEntry ; +struct VTDAddressSpace {PCIBus *bus;uint8_t devfn;
@@ -107,6 +112,7 @@ struct VTDAddressSpace {MemoryRegion iommu_ir_fault;/* Interrupt region for catching fault */ IntelIOMMUState *iommu_state;VTDContextCacheEntry context_cache_entry; +VTDPASIDCacheEntry pasid_cache_entry;QLIST_ENTRY (VTDAddressSpace) next;/* Superset of notifier flags that this address space has */ IOMMUNotifierFlag notifier_flags;
hw/i386/intel_iommu.c +131 -10
159 lines not on this page · raw message
hw/i386/trace-events +3 -0
@@ -24,6 +24,9 @@ vtd_inv_qi_head(uint16_t head) "read head %d" vtd_inv_qi_tail(uint16_t head) "write tail %d" vtd_inv_qi_fetch(void) "" vtd_context_cache_reset(void) "" +vtd_inv_desc_pasid_cache_gsi(void) "" +vtd_inv_desc_pasid_cache_dsi(uint16_t domain) "Domain selective PC invalidation domain 0x%"PRIx16 +vtd_inv_desc_pasid_cache_psi(uint16_t domain, uint32_t pasid) "PASID selective PC invalidation domain 0x%"PRIx16" pasid 0x%"PRIx32 vtd_re_not_present(uint8_t bus) "Root entry bus %"PRIu8" not present" vtd_ce_not_present(uint8_t bus, uint8_t devfn) "Context entry bus %"PRIu8" devfn %"PRIu8" not present" vtd_iotlb_page_hit(uint16_t sid, uint64_t addr, uint64_t slpte, uint16_t domain) "IOTLB page hit sid 0x%"PRIx16" iova 0x%"PRIx64" slpte 0x%"PRIx64" domain 0x%"PRIx16
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 03/14] amd_iommu: Support 64-bit address for IOTLB lookup
In reply to Michael S. TsirkinFrom: Sairaj Kodilkar <[email protected]>
The physical AMD IOMMU supports up to 64 bits of IOVA. When a device tries to read or write from a given DMA address, the IOMMU translates the address using the I/O page tables assigned to that device. Since the emulated IOMMU uses per-device page tables, an ideal cache tag would need to be 68 bits (64-bit address - 12-bit page alignment + 16-bit device ID).
The current software IOTLB implementation uses a GLib hash table with a 64-bit key to hash both the IOVA and device ID, which limits the IOVA to 60 bits. This causes a failure while setting up the device when a guest is booted with "iommu.forcedac=1", which forces the use of DMA addresses at the top of the 64-bit address space.
To address this issue, construct the 64-bit hash key using the upper 52 bits of IOVA (GFN) and lower 12 bits of the device ID to avoid truncation as much as possible (reducing hash collisions).
Message-Id: <[email protected]>
--- hw/i386/amd_iommu.h | 4 ++-- hw/i386/amd_iommu.c | 57 ++++++++++++++++++++++++++++++--------------- 2 files changed, 40 insertions(+), 21 deletions(-)
hw/i386/amd_iommu.h +2 -2
@@ -220,8 +220,8 @@#define PAGE_SIZE_PTE_COUNT (pgsz) (1ULL << ((ctz64(pgsz) - 12) % 9))/* IOTLB */ -#define AMDVI_IOTLB_MAX_SIZE 1024 -#define AMDVI_DEVID_SHIFT 36 +#define AMDVI_IOTLB_MAX_SIZE 1024 +#define AMDVI_GET_IOTLB_GFN (addr) (addr >> AMDVI_PAGE_SHIFT_4K)/* default extended feature */ #define AMDVI_DEFAULT_EXT_FEATURES \
hw/i386/amd_iommu.c +38 -19
102 lines not on this page · raw message
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 12/14] virtio-net: Advertise UDP tunnel GSO support by default
In reply to Michael S. TsirkinFrom: Paolo Abeni <[email protected]>
Allow bidirectional aggregated traffic for UDP encapsulated flows.
Add the needed compatibility entries to avoid migration issues vs older QEMU instances.
Message-Id: <9c500fbcd2cf29afd1826b1ac906f9d5beac3601.1760104079.git.pabeni@redhat.com>
--- hw/core/machine.c | 4 ++++ hw/net/virtio-net.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-)
hw/core/machine.c +4 -0
@@ -40,6 +40,10 @@GlobalProperty hw_compat_10_1[] = { {TYPE_ACPI_GED ,"x-has-hest-addr" ,"false" }, + {TYPE_VIRTIO_NET ,"host_tunnel" ,"off" }, + {TYPE_VIRTIO_NET ,"host_tunnel_csum" ,"off" }, + {TYPE_VIRTIO_NET ,"guest_tunnel" ,"off" }, + {TYPE_VIRTIO_NET ,"guest_tunnel_csum" ,"off" }, };const size_t hw_compat_10_1_len =G_N_ELEMENTS (hw_compat_10_1);
hw/net/virtio-net.c +4 -4
@@ -4299,19 +4299,19 @@ static const Property virtio_net_properties[] = {VIRTIO_DEFINE_PROP_FEATURE ("host_tunnel" , VirtIONet, host_features_ex,VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO , - false), + true),VIRTIO_DEFINE_PROP_FEATURE ("host_tunnel_csum" , VirtIONet, host_features_ex,VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO_CSUM , - false), + true),VIRTIO_DEFINE_PROP_FEATURE ("guest_tunnel" , VirtIONet, host_features_ex,VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO , - false), + true),VIRTIO_DEFINE_PROP_FEATURE ("guest_tunnel_csum" , VirtIONet, host_features_ex,VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM , - false), + true), };static void virtio_net_class_init (ObjectClass *klass,const void *data)
Signature · 1 line
MST
Re: [PULL 12/14] virtio-net: Advertise UDP tunnel GSO support by default
Dear maintainers,
Am 09.11.25 um 4:10 PM schrieb Michael S. Tsirkin:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4302
Quoted 10 lines
hw/net/virtio-net.c +1
-1@@ -4299,19 +4299,19 @@ static const Property virtio_net_properties[] = {VIRTIO_DEFINE_PROP_FEATURE ("host_tunnel" , VirtIONet, host_features_ex,VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO , - false), + true),
it seems that the host_tunnel setting can cause issues when VXLAN traffic originating in a guest goes over a physical NIC which does not support the feature. We received several reports about the issue [0][1][2][3] and were able to reproduce it. Turning off the 'host_tunnel' property in the commandline for the VirtIO net device makes TCP traffic work. The network configuration from our reproducer setup is as follows:
guest A (iperf3 -c) guest B (iperf3 -s)
vxlan using vNIC as underlay vxlan using vNIC as underlay
virtualized NIC exposed to guest virtualized NIC exposed to guest
---guest boundary--- ---guest boundary---
tap device connected to bridge tap device connected to bridge
bridge with physical NIC as port bridge with physical NIC as port
physical NIC <---host boundary---> physical NIC
Bridge configuration:
iface vmbr0 inet static
address 10.48.0.109/20 gateway 10.48.0.1 bridge-ports nic3 bridge-stp off bridge-fd 0 bridge-vlan-aware yes bridge-vids 2-4094
VXLAN created with:
ip link add vxlan0 type vxlan id 100 remote X dstport 4789 dev eth1 where eth1 is the virtualized NIC exposed to the guest
The physical NIC does not have the feature:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe [14e4:1657] (rev 01)
tx-udp_tnl-segmentation: off [fixed] tx-udp_tnl-csum-segmentation: off [fixed]
Using a physical NIC which does have the feature works:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet [14e4:1751] (rev 11)
tx-udp_tnl-segmentation: on tx-udp_tnl-csum-segmentation: on
Host kernel:
Proxmox VE with 7.0.2-6-pve
Guest kernel:
Apline with 6.18.34-0-lts
QEMU commandline for the vNIC:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4304
Quoted 2 lines
hw/net/virtio-net.c +0
-2-netdev 'type=tap,id=net2,ifname=tap103i2,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on' \ -device 'virtio-net-pci,mac=BC:24:11:78:C3:3B,netdev=net2,bus=pci.0,addr=0x14,id=net2,rx_queue_size=1024,tx_queue_size=256,host_mtu=1500' \
We can see that QEMU sets the features for the tap interface via ioctl() and the host kernel allows it:
tx-udp_tnl-segmentation: on
tx-udp_tnl-csum-segmentation: on
As far as we understand, in the problematic scenario, nothing is ever filling in the checksums for the inner TCP packets, meaning the outer UDP checksum ends up being wrong on the target side. Is the host kernel responsible for doing that before passing the packet to the physical NIC (without the feature)? Or who would be?
Turning off host_tunnel_csum without turning off host_tunnel does not help.
Interestingly, turning off the features for the working physical NIC does not make it break:
tx-udp_tnl-segmentation: off
tx-udp_tnl-csum-segmentation: off
Could it be that the NIC just always fills in the inner TCP checksums regardless of that setting?
On the other hand, running
localhost:~# ethtool -K eth2 tx-checksum-ip-generic off Actual changes: tx-checksum-ip-generic: off tx-tcp-segmentation: off [not requested] tx-tcp-ecn-segmentation: off [not requested] tx-tcp6-segmentation: off [not requested] tx-udp-segmentation: off [not requested] inside the guests makes it work for the physical NIC without the tx-udp_tnl* features.
I wanted to ask if this configuration is expected to be unsupported and if the management is expected to turn off the feature on the commandline if the traffic might go over a physical NIC without the feature. Or if this could be a kernel or NIC bug that should be investigated further? In the former case, should the option really be turned on by default with new machine versions?
I'll be happy to test and capture/provide additional information. Let me know what would be interesting.
Thanks to Stefan and Gabriel for looking into the issue with me!
Best Regards,
Fiona
[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=7627
[1]: https://forum.proxmox.com/threads/183494/post-855144
[2]: https://forum.proxmox.com/threads/182328/post-854627
[3]: https://forum.proxmox.com/threads/183963/post-855737
Paolo Abeni
maintainerRe: [PULL 12/14] virtio-net: Advertise UDP tunnel GSO support by default
Hi,
Quoted 94 lines · Fiona Ebner
Am 09.11.25 um 4:10 PM schrieb Michael S. Tsirkin:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4302
Quoted 10 lines
hw/net/virtio-net.c +1
-1@@ -4299,19 +4299,19 @@ static const Property virtio_net_properties[] = {VIRTIO_DEFINE_PROP_FEATURE ("host_tunnel" , VirtIONet, host_features_ex,VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO , - false), + true),it seems that the
host_tunnelsetting can cause issues when VXLAN traffic originating in a guest goes over a physical NIC which does not support the feature. We received several reports about the issue [0][1][2][3] and were able to reproduce it. Turning off the 'host_tunnel' property in the commandline for the VirtIO net device makes TCP traffic work. The network configuration from our reproducer setup is as follows:guest A (iperf3 -c) guest B (iperf3 -s)
vxlan using vNIC as underlay vxlan using vNIC as underlay
virtualized NIC exposed to guest virtualized NIC exposed to guest
---guest boundary--- ---guest boundary---
tap device connected to bridge tap device connected to bridge
bridge with physical NIC as port bridge with physical NIC as portphysical NIC <---host boundary---> physical NICBridge configuration:
iface vmbr0 inet staticaddress 10.48.0.109/20 gateway 10.48.0.1 bridge-ports nic3 bridge-stp off bridge-fd 0 bridge-vlan-aware yes bridge-vids 2-4094VXLAN created with:
ip link add vxlan0 type vxlan id 100 remote X dstport 4789 dev eth1 where eth1 is the virtualized NIC exposed to the guestThe physical NIC does not have the feature:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe [14e4:1657] (rev 01)
tx-udp_tnl-segmentation: off [fixed] tx-udp_tnl-csum-segmentation: off [fixed]Using a physical NIC which does have the feature works:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet [14e4:1751] (rev 11)
tx-udp_tnl-segmentation: on tx-udp_tnl-csum-segmentation: onHost kernel:
Proxmox VE with 7.0.2-6-pveGuest kernel:
Apline with 6.18.34-0-ltsQEMU commandline for the vNIC:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4304
Quoted 2 lines
hw/net/virtio-net.c +0
-2-netdev 'type=tap,id=net2,ifname=tap103i2,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on' \ -device 'virtio-net-pci,mac=BC:24:11:78:C3:3B,netdev=net2,bus=pci.0,addr=0x14,id=net2,rx_queue_size=1024,tx_queue_size=256,host_mtu=1500' \We can see that QEMU sets the features for the tap interface via
ioctl()and the host kernel allows it:
tx-udp_tnl-segmentation: on
tx-udp_tnl-csum-segmentation: onAs far as we understand, in the problematic scenario, nothing is ever filling in the checksums for the inner TCP packets, meaning the outer UDP checksum ends up being wrong on the target side. Is the host kernel responsible for doing that before passing the packet to the physical NIC (without the feature)? Or who would be?
Turning off
host_tunnel_csumwithout turning offhost_tunneldoes not help.Interestingly, turning off the features for the working physical NIC does not make it break:
tx-udp_tnl-segmentation: off
tx-udp_tnl-csum-segmentation: off
Could it be that the NIC just always fills in the inner TCP checksums regardless of that setting?On the other hand, running
localhost:~# ethtool -K eth2 tx-checksum-ip-generic off Actual changes: tx-checksum-ip-generic: off tx-tcp-segmentation: off [not requested] tx-tcp-ecn-segmentation: off [not requested] tx-tcp6-segmentation: off [not requested] tx-udp-segmentation: off [not requested] inside the guests makes it work for the physical NIC without the tx-udp_tnl* features.
Quoted 6 lines
I wanted to ask if this configuration is expected to be unsupported and if the management is expected to turn off the feature on the commandline if the traffic might go over a physical NIC without the feature. Or if this could be a kernel or NIC bug that should be investigated further? In the former case, should the option really be turned on by default with new machine versions?
Thank you for the detailed report. The configuration you describe is supported and expected to work. The fact that different results are obtained on top of a NIC with:
[1] tx-udp_tnl-segmentation: off [fixed]
WRT to similar setup on top of NIC with:
[2] tx-udp_tnl-segmentation: off
is indeed strange/unexpected, as the two scenarios are indistinguishable from the stack perspective. I suspect the issue is NIC driver dependent.
I understand [1] is using a tg3 driver, and [2] bnxt, both running Linux 7.0.2, am I correct?
If you disable csum offloading on the tg3 NIC, does that impact the results?
If you have such data handy, could you please share pcap captures on both ends? links to some accessible URL would be better than sending a lot of data to the ML, I think.
Thanks,
Paolo
Paolo Abeni
maintainerRe: [PULL 12/14] virtio-net: Advertise UDP tunnel GSO support by default
Quoted 12 lines · Paolo Abeni
Quoted 6 lines · Fiona Ebner
I wanted to ask if this configuration is expected to be unsupported and if the management is expected to turn off the feature on the commandline if the traffic might go over a physical NIC without the feature. Or if this could be a kernel or NIC bug that should be investigated further? In the former case, should the option really be turned on by default with new machine versions?
Thank you for the detailed report. The configuration you describe is supported and expected to work. The fact that different results are obtained on top of a NIC with:
Quoted 8 lines
[1] tx-udp_tnl-segmentation: off [fixed]
WRT to similar setup on top of NIC with:
[2] tx-udp_tnl-segmentation: off
is indeed strange/unexpected, as the two scenarios are indistinguishable from the stack perspective. I suspect the issue is NIC driver dependent.
Skimming over the links you provided, it looks like multiple NICs are affected, so possibly/likely my above suspect is just wrong. Do you have handy a list of the NICs exposing the problem?
/P
Re: [PULL 12/14] virtio-net: Advertise UDP tunnel GSO support by default
In reply to Paolo AbeniAm 05.06.26 um 4:54 PM schrieb Paolo Abeni:
Quoted 110 lines · Fiona Ebner
Quoted 94 lines
Am 09.11.25 um 4:10 PM schrieb Michael S. Tsirkin:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4302
Quoted 10 lines
hw/net/virtio-net.c +1
-1@@ -4299,19 +4299,19 @@ static const Property virtio_net_properties[] = {VIRTIO_DEFINE_PROP_FEATURE ("host_tunnel" , VirtIONet, host_features_ex,VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO , - false), + true),it seems that the
host_tunnelsetting can cause issues when VXLAN traffic originating in a guest goes over a physical NIC which does not support the feature. We received several reports about the issue [0][1][2][3] and were able to reproduce it. Turning off the 'host_tunnel' property in the commandline for the VirtIO net device makes TCP traffic work. The network configuration from our reproducer setup is as follows:guest A (iperf3 -c) guest B (iperf3 -s)
vxlan using vNIC as underlay vxlan using vNIC as underlay
virtualized NIC exposed to guest virtualized NIC exposed to guest
---guest boundary--- ---guest boundary---
tap device connected to bridge tap device connected to bridge
bridge with physical NIC as port bridge with physical NIC as portphysical NIC <---host boundary---> physical NICBridge configuration:
iface vmbr0 inet staticaddress 10.48.0.109/20 gateway 10.48.0.1 bridge-ports nic3 bridge-stp off bridge-fd 0 bridge-vlan-aware yes bridge-vids 2-4094VXLAN created with:
ip link add vxlan0 type vxlan id 100 remote X dstport 4789 dev eth1 where eth1 is the virtualized NIC exposed to the guestThe physical NIC does not have the feature:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe [14e4:1657] (rev 01)
tx-udp_tnl-segmentation: off [fixed] tx-udp_tnl-csum-segmentation: off [fixed]Using a physical NIC which does have the feature works:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet [14e4:1751] (rev 11)
tx-udp_tnl-segmentation: on tx-udp_tnl-csum-segmentation: onHost kernel:
Proxmox VE with 7.0.2-6-pveGuest kernel:
Apline with 6.18.34-0-ltsQEMU commandline for the vNIC:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4304
Quoted 2 lines
hw/net/virtio-net.c +0
-2-netdev 'type=tap,id=net2,ifname=tap103i2,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on' \ -device 'virtio-net-pci,mac=BC:24:11:78:C3:3B,netdev=net2,bus=pci.0,addr=0x14,id=net2,rx_queue_size=1024,tx_queue_size=256,host_mtu=1500' \We can see that QEMU sets the features for the tap interface via
ioctl()and the host kernel allows it:
tx-udp_tnl-segmentation: on
tx-udp_tnl-csum-segmentation: onAs far as we understand, in the problematic scenario, nothing is ever filling in the checksums for the inner TCP packets, meaning the outer UDP checksum ends up being wrong on the target side. Is the host kernel responsible for doing that before passing the packet to the physical NIC (without the feature)? Or who would be?
Turning off
host_tunnel_csumwithout turning offhost_tunneldoes not help.Interestingly, turning off the features for the working physical NIC does not make it break:
tx-udp_tnl-segmentation: off
tx-udp_tnl-csum-segmentation: off
Could it be that the NIC just always fills in the inner TCP checksums regardless of that setting?On the other hand, running
localhost:~# ethtool -K eth2 tx-checksum-ip-generic off Actual changes: tx-checksum-ip-generic: off tx-tcp-segmentation: off [not requested] tx-tcp-ecn-segmentation: off [not requested] tx-tcp6-segmentation: off [not requested] tx-udp-segmentation: off [not requested] inside the guests makes it work for the physical NIC without the tx-udp_tnl* features.Quoted 6 lines
I wanted to ask if this configuration is expected to be unsupported and if the management is expected to turn off the feature on the commandline if the traffic might go over a physical NIC without the feature. Or if this could be a kernel or NIC bug that should be investigated further? In the former case, should the option really be turned on by default with new machine versions?
Thank you for the detailed report. The configuration you describe is supported and expected to work. The fact that different results are obtained on top of a NIC with:
[1] tx-udp_tnl-segmentation: off [fixed]
WRT to similar setup on top of NIC with:
Quoted 7 lines
[2] tx-udp_tnl-segmentation: off
is indeed strange/unexpected, as the two scenarios are indistinguishable from the stack perspective. I suspect the issue is NIC driver dependent.
I understand [1] is using a tg3 driver, and [2] bnxt, both running Linux 7.0.2, am I correct?
Yes.
Quoted 1 line
If you disable csum offloading on the tg3 NIC, does that impact the results?
Yes, doing
root@tamy3:~# ethtool -K nic3 tx-checksum-ipv4 off Actual changes: tx-checksum-ipv4: off tx-tcp-segmentation: off [not requested] tx-tcp-ecn-segmentation: off [not requested]
on both hosts makes it work.
Quoted 3 lines
If you have such data handy, could you please share pcap captures on both ends? links to some accessible URL would be better than sending a lot of data to the ML, I think.
I captured the following while the problem is present with tcpdump -i foo udp port 4789 -w bar.pcap
on the host interfaces (tap, bridge and physical NIC) just to be sure. Looking at it with tcpdump -envvvr, within the same host, only the timestamps change. Between the hosts, the UDP checksums do change, but the inner TCP checksums do not. So I suppose the NIC fills in the UDP checksum based on the still wrong data? Since the UDP checksum would already be correct if the TCP checksums would be fixed up?
For the NIC with the tx-udp_tnl features, the inner TCP checksums do get corrected and the UDP checksum stays the same. I did not include captures for this.
IPs for the guest running iperf -s (on host tamy2) 10.48.6.81 for the virtualized NIC 10.0.123.102 for the VXLAN
IPs for the guest running iperf -c (on host tamy3):
10.48.6.101 for the virtualized NIC 10.0.123.103 for the VXLAN
The captures are short, so I take the liberty to just provide them directly:
[I] febner@enia ~> tar cf pcap.tar tamy*.pcap
[I] febner@enia ~> xz pcap.tar
[I] febner@enia ~> base64 -w 70 pcap.tar.xz /Td6WFoAAATm1rRGBMDXBYCgASEBFgAAAAAAAKQwOkPgT/8Cz10AOhhJ/551cIJN23SQMX Q2Us4cGiof2bxOS4FK4DxejNh+76NiWIpdIfOxrB5urac3FT0mPKMbUreSY+04/NhofcgS Zz41D6t/Xp+VkPxNYx7Xsp3xz4xUCsVuK205jz6G/NAY0bJ0+UrJuCkP0G5VBtn88hJstD 7qlaT7qcBLECseOO1OfqsLezxasbm5p614IL18cqAVMCMWucr/Kh2Oqth26v7zI4SVEJC/ YSEgaOhfjCbQZSi85BEw9/NSZO6IqoyNLrEiPUPgXTWH63NssG+4RMuBswrkgN5Wld70B1 mROOCwKbo9b9oXI4DumGHqgCV5jdAxzITpEjMQpvDKh6NvM5L/8v1cPiGjLFSL2JesZ0F5 dTbstymv1q4eN+9f3ng+4AXCvDzaziYMwtGwxYyptK5qDI2oGsCIGwFDpP/ZEw7NYI9EMM G2+SDG6D8bKgKWl9Mi6EJcqSMVKFR1P1Z/P3XJ/9sWOMJug1IVYZGIJmtXXM3+roqOEGMF tco/LMUJHgdmfkitfuZ5tN1+0EVE0/f4GQiUpdidjqfZ2m9jL0svcGXUd5D3LN0tbh5vmP KzXQNtMQiMY6Fj7gbzDbOQGGW/L3/34B5YV+pWEpzhAbeTI9KL0ZF3vJ0OESlL9OMhrqgl WX23bxek2h9eG15eO9cderaoCOFb8NEKIjC+UTh2Ir7/ZFfDvlXeGB/3jXM8OTmWmJSr5b CrAvBQ4xvow3hwKq2Fbyu7aU6KycVpo03a+59LqxPyRfc3qRXcoUnp8MTi2YUk+kfYR6mI S9AE/5xYFzb7I40RUBPUm0OCzguzk9qlIcab3lnTFnrMWa+Cj9AMIkWEEf0tMzw0v9+17u VJg/8tWMad3d9Jc5Z6B9kOukzGvgVEWoq4z9snb/k6u2sBVY36q2iI1cmSPrI+UcF2GtSA Qs6bt/T/c1Xi2r0Up+tRDrIE9O2aNAAAAKAWpkIVfsvrAAHzBYCgAQAA6om1scRn+wIAAA AABFla
Quoted 3 lines
Skimming over the links you provided, it looks like multiple NICs are affected, so possibly/likely my above suspect is just wrong. Do you have handy a list of the NICs exposing the problem?
Unfortunately not. There is ours:
- Ethernet controller [0200]: Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe [14e4:1657] (rev 01)
and from the user reports:
- Ethernet controller [0200]: Broadcom Inc. and subsidiaries BCM57414 NetXtreme-E 10Gb/25Gb RDMA Ethernet Controller [14e4:16d7] (rev 01)
- RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller
- two users also mention Intel, but for one of them, there was still a Broadcom NIC involved on one side.
Do you have any tips where to start looking in the kernel? What is the expected place where the TCP checksums are corrected if the NIC does not have the tx-udp_tnl features?
Best Regards,
Fiona
Paolo Abeni
maintainerRe: [PULL 12/14] virtio-net: Advertise UDP tunnel GSO support by default
Quoted 171 lines · Fiona Ebner
Am 05.06.26 um 4:54 PM schrieb Paolo Abeni:
Quoted 110 lines · Fiona Ebner
Quoted 94 lines
Am 09.11.25 um 4:10 PM schrieb Michael S. Tsirkin:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4302
Quoted 10 lines
hw/net/virtio-net.c +1
-1@@ -4299,19 +4299,19 @@ static const Property virtio_net_properties[] = {VIRTIO_DEFINE_PROP_FEATURE ("host_tunnel" , VirtIONet, host_features_ex,VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO , - false), + true),it seems that the
host_tunnelsetting can cause issues when VXLAN traffic originating in a guest goes over a physical NIC which does not support the feature. We received several reports about the issue [0][1][2][3] and were able to reproduce it. Turning off the 'host_tunnel' property in the commandline for the VirtIO net device makes TCP traffic work. The network configuration from our reproducer setup is as follows:guest A (iperf3 -c) guest B (iperf3 -s)
vxlan using vNIC as underlay vxlan using vNIC as underlay
virtualized NIC exposed to guest virtualized NIC exposed to guest
---guest boundary--- ---guest boundary---
tap device connected to bridge tap device connected to bridge
bridge with physical NIC as port bridge with physical NIC as portphysical NIC <---host boundary---> physical NICBridge configuration:
iface vmbr0 inet staticaddress 10.48.0.109/20 gateway 10.48.0.1 bridge-ports nic3 bridge-stp off bridge-fd 0 bridge-vlan-aware yes bridge-vids 2-4094VXLAN created with:
ip link add vxlan0 type vxlan id 100 remote X dstport 4789 dev eth1 where eth1 is the virtualized NIC exposed to the guestThe physical NIC does not have the feature:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe [14e4:1657] (rev 01)
tx-udp_tnl-segmentation: off [fixed] tx-udp_tnl-csum-segmentation: off [fixed]Using a physical NIC which does have the feature works:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet [14e4:1751] (rev 11)
tx-udp_tnl-segmentation: on tx-udp_tnl-csum-segmentation: onHost kernel:
Proxmox VE with 7.0.2-6-pveGuest kernel:
Apline with 6.18.34-0-ltsQEMU commandline for the vNIC:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4304
Quoted 2 lines
hw/net/virtio-net.c +0
-2-netdev 'type=tap,id=net2,ifname=tap103i2,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on' \ -device 'virtio-net-pci,mac=BC:24:11:78:C3:3B,netdev=net2,bus=pci.0,addr=0x14,id=net2,rx_queue_size=1024,tx_queue_size=256,host_mtu=1500' \We can see that QEMU sets the features for the tap interface via
ioctl()and the host kernel allows it:
tx-udp_tnl-segmentation: on
tx-udp_tnl-csum-segmentation: onAs far as we understand, in the problematic scenario, nothing is ever filling in the checksums for the inner TCP packets, meaning the outer UDP checksum ends up being wrong on the target side. Is the host kernel responsible for doing that before passing the packet to the physical NIC (without the feature)? Or who would be?
Turning off
host_tunnel_csumwithout turning offhost_tunneldoes not help.Interestingly, turning off the features for the working physical NIC does not make it break:
tx-udp_tnl-segmentation: off
tx-udp_tnl-csum-segmentation: off
Could it be that the NIC just always fills in the inner TCP checksums regardless of that setting?On the other hand, running
localhost:~# ethtool -K eth2 tx-checksum-ip-generic off Actual changes: tx-checksum-ip-generic: off tx-tcp-segmentation: off [not requested] tx-tcp-ecn-segmentation: off [not requested] tx-tcp6-segmentation: off [not requested] tx-udp-segmentation: off [not requested] inside the guests makes it work for the physical NIC without the tx-udp_tnl* features.Quoted 6 lines
I wanted to ask if this configuration is expected to be unsupported and if the management is expected to turn off the feature on the commandline if the traffic might go over a physical NIC without the feature. Or if this could be a kernel or NIC bug that should be investigated further? In the former case, should the option really be turned on by default with new machine versions?
Thank you for the detailed report. The configuration you describe is supported and expected to work. The fact that different results are obtained on top of a NIC with:
[1] tx-udp_tnl-segmentation: off [fixed]
WRT to similar setup on top of NIC with:
Quoted 7 lines
[2] tx-udp_tnl-segmentation: off
is indeed strange/unexpected, as the two scenarios are indistinguishable from the stack perspective. I suspect the issue is NIC driver dependent.
I understand [1] is using a tg3 driver, and [2] bnxt, both running Linux 7.0.2, am I correct?
Yes.
Quoted 1 line
If you disable csum offloading on the tg3 NIC, does that impact the results?
Yes, doing
root@tamy3:~# ethtool -K nic3 tx-checksum-ipv4 off Actual changes: tx-checksum-ipv4: off tx-tcp-segmentation: off [not requested] tx-tcp-ecn-segmentation: off [not requested]on both hosts makes it work.
Quoted 3 lines
If you have such data handy, could you please share pcap captures on both ends? links to some accessible URL would be better than sending a lot of data to the ML, I think.
I captured the following while the problem is present with tcpdump -i foo udp port 4789 -w bar.pcap
on the host interfaces (tap, bridge and physical NIC) just to be sure. Looking at it with tcpdump -envvvr, within the same host, only the timestamps change. Between the hosts, the UDP checksums do change, but the inner TCP checksums do not. So I suppose the NIC fills in the UDP checksum based on the still wrong data? Since the UDP checksum would already be correct if the TCP checksums would be fixed up?For the NIC with the tx-udp_tnl features, the inner TCP checksums do get corrected and the UDP checksum stays the same. I did not include captures for this.
IPs for the guest running iperf -s (on host tamy2) 10.48.6.81 for the virtualized NIC 10.0.123.102 for the VXLAN
IPs for the guest running iperf -c (on host tamy3):
10.48.6.101 for the virtualized NIC 10.0.123.103 for the VXLANThe captures are short, so I take the liberty to just provide them directly:
[I] febner@enia ~> tar cf pcap.tar tamy*.pcap
[I] febner@enia ~> xz pcap.tar
[I] febner@enia ~> base64 -w 70 pcap.tar.xz /Td6WFoAAATm1rRGBMDXBYCgASEBFgAAAAAAAKQwOkPgT/8Cz10AOhhJ/551cIJN23SQMX Q2Us4cGiof2bxOS4FK4DxejNh+76NiWIpdIfOxrB5urac3FT0mPKMbUreSY+04/NhofcgS Zz41D6t/Xp+VkPxNYx7Xsp3xz4xUCsVuK205jz6G/NAY0bJ0+UrJuCkP0G5VBtn88hJstD 7qlaT7qcBLECseOO1OfqsLezxasbm5p614IL18cqAVMCMWucr/Kh2Oqth26v7zI4SVEJC/ YSEgaOhfjCbQZSi85BEw9/NSZO6IqoyNLrEiPUPgXTWH63NssG+4RMuBswrkgN5Wld70B1 mROOCwKbo9b9oXI4DumGHqgCV5jdAxzITpEjMQpvDKh6NvM5L/8v1cPiGjLFSL2JesZ0F5 dTbstymv1q4eN+9f3ng+4AXCvDzaziYMwtGwxYyptK5qDI2oGsCIGwFDpP/ZEw7NYI9EMM G2+SDG6D8bKgKWl9Mi6EJcqSMVKFR1P1Z/P3XJ/9sWOMJug1IVYZGIJmtXXM3+roqOEGMF
Quoted 8 lines
tco/LMUJHgdmfkitfuZ5tN1+0EVE0/f4GQiUpdidjqfZ2m9jL0svcGXUd5D3LN0tbh5vmP KzXQNtMQiMY6Fj7gbzDbOQGGW/L3/34B5YV+pWEpzhAbeTI9KL0ZF3vJ0OESlL9OMhrqgl WX23bxek2h9eG15eO9cderaoCOFb8NEKIjC+UTh2Ir7/ZFfDvlXeGB/3jXM8OTmWmJSr5b CrAvBQ4xvow3hwKq2Fbyu7aU6KycVpo03a+59LqxPyRfc3qRXcoUnp8MTi2YUk+kfYR6mI S9AE/5xYFzb7I40RUBPUm0OCzguzk9qlIcab3lnTFnrMWa+Cj9AMIkWEEf0tMzw0v9+17u VJg/8tWMad3d9Jc5Z6B9kOukzGvgVEWoq4z9snb/k6u2sBVY36q2iI1cmSPrI+UcF2GtSA Qs6bt/T/c1Xi2r0Up+tRDrIE9O2aNAAAAKAWpkIVfsvrAAHzBYCgAQAA6om1scRn+wIAAA AABFla
Thanks for the data. The bug is in the virtio_net driver; non GSO packets requiring inner header csum are handled unmodified from the guest to the host, and the H/W NICs has to compute the inner transport header csum for the encap packet.
Could you please try the attached kernel patch? You will need to update the kernel inside the guest.
Quoted 3 lines
Do you have any tips where to start looking in the kernel? What is the expected place where the TCP checksums are corrected if the NIC does not have the tx-udp_tnl features?
Hopefully no more investigation needed. FTR, for non GSO packets, the inner transport header csum should be computed inside the guest before transmitting on the virtio net device.
For GSO packets such csum should be computed inside the host, just before transmitting on the H/W NIC (if the latter does not support the relevant offload).
Thanks,
Paolo
Michael S. Tsirkin
maintainerRe: [PULL 12/14] virtio-net: Advertise UDP tunnel GSO support by default
Quoted 181 lines · Paolo Abeni
Quoted 171 lines · Fiona Ebner
Am 05.06.26 um 4:54 PM schrieb Paolo Abeni:
Quoted 110 lines · Fiona Ebner
Quoted 94 lines
Am 09.11.25 um 4:10 PM schrieb Michael S. Tsirkin:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4302
Quoted 10 lines
hw/net/virtio-net.c +1
-1@@ -4299,19 +4299,19 @@ static const Property virtio_net_properties[] = {VIRTIO_DEFINE_PROP_FEATURE ("host_tunnel" , VirtIONet, host_features_ex,VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO , - false), + true),it seems that the
host_tunnelsetting can cause issues when VXLAN traffic originating in a guest goes over a physical NIC which does not support the feature. We received several reports about the issue [0][1][2][3] and were able to reproduce it. Turning off the 'host_tunnel' property in the commandline for the VirtIO net device makes TCP traffic work. The network configuration from our reproducer setup is as follows:guest A (iperf3 -c) guest B (iperf3 -s)
vxlan using vNIC as underlay vxlan using vNIC as underlay
virtualized NIC exposed to guest virtualized NIC exposed to guest
---guest boundary--- ---guest boundary---
tap device connected to bridge tap device connected to bridge
bridge with physical NIC as port bridge with physical NIC as portphysical NIC <---host boundary---> physical NICBridge configuration:
iface vmbr0 inet staticaddress 10.48.0.109/20 gateway 10.48.0.1 bridge-ports nic3 bridge-stp off bridge-fd 0 bridge-vlan-aware yes bridge-vids 2-4094VXLAN created with:
ip link add vxlan0 type vxlan id 100 remote X dstport 4789 dev eth1 where eth1 is the virtualized NIC exposed to the guestThe physical NIC does not have the feature:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe [14e4:1657] (rev 01)
tx-udp_tnl-segmentation: off [fixed] tx-udp_tnl-csum-segmentation: off [fixed]Using a physical NIC which does have the feature works:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet [14e4:1751] (rev 11)
tx-udp_tnl-segmentation: on tx-udp_tnl-csum-segmentation: onHost kernel:
Proxmox VE with 7.0.2-6-pveGuest kernel:
Apline with 6.18.34-0-ltsQEMU commandline for the vNIC:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4304
Quoted 2 lines
hw/net/virtio-net.c +0
-2-netdev 'type=tap,id=net2,ifname=tap103i2,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on' \ -device 'virtio-net-pci,mac=BC:24:11:78:C3:3B,netdev=net2,bus=pci.0,addr=0x14,id=net2,rx_queue_size=1024,tx_queue_size=256,host_mtu=1500' \We can see that QEMU sets the features for the tap interface via
ioctl()and the host kernel allows it:
tx-udp_tnl-segmentation: on
tx-udp_tnl-csum-segmentation: onAs far as we understand, in the problematic scenario, nothing is ever filling in the checksums for the inner TCP packets, meaning the outer UDP checksum ends up being wrong on the target side. Is the host kernel responsible for doing that before passing the packet to the physical NIC (without the feature)? Or who would be?
Turning off
host_tunnel_csumwithout turning offhost_tunneldoes not help.Interestingly, turning off the features for the working physical NIC does not make it break:
tx-udp_tnl-segmentation: off
tx-udp_tnl-csum-segmentation: off
Could it be that the NIC just always fills in the inner TCP checksums regardless of that setting?On the other hand, running
localhost:~# ethtool -K eth2 tx-checksum-ip-generic off Actual changes: tx-checksum-ip-generic: off tx-tcp-segmentation: off [not requested] tx-tcp-ecn-segmentation: off [not requested] tx-tcp6-segmentation: off [not requested] tx-udp-segmentation: off [not requested] inside the guests makes it work for the physical NIC without the tx-udp_tnl* features.Quoted 6 lines
I wanted to ask if this configuration is expected to be unsupported and if the management is expected to turn off the feature on the commandline if the traffic might go over a physical NIC without the feature. Or if this could be a kernel or NIC bug that should be investigated further? In the former case, should the option really be turned on by default with new machine versions?
Thank you for the detailed report. The configuration you describe is supported and expected to work. The fact that different results are obtained on top of a NIC with:
[1] tx-udp_tnl-segmentation: off [fixed]
WRT to similar setup on top of NIC with:
Quoted 7 lines
[2] tx-udp_tnl-segmentation: off
is indeed strange/unexpected, as the two scenarios are indistinguishable from the stack perspective. I suspect the issue is NIC driver dependent.
I understand [1] is using a tg3 driver, and [2] bnxt, both running Linux 7.0.2, am I correct?
Yes.
Quoted 1 line
If you disable csum offloading on the tg3 NIC, does that impact the results?
Yes, doing
root@tamy3:~# ethtool -K nic3 tx-checksum-ipv4 off Actual changes: tx-checksum-ipv4: off tx-tcp-segmentation: off [not requested] tx-tcp-ecn-segmentation: off [not requested]on both hosts makes it work.
Quoted 3 lines
If you have such data handy, could you please share pcap captures on both ends? links to some accessible URL would be better than sending a lot of data to the ML, I think.
I captured the following while the problem is present with tcpdump -i foo udp port 4789 -w bar.pcap
on the host interfaces (tap, bridge and physical NIC) just to be sure. Looking at it with tcpdump -envvvr, within the same host, only the timestamps change. Between the hosts, the UDP checksums do change, but the inner TCP checksums do not. So I suppose the NIC fills in the UDP checksum based on the still wrong data? Since the UDP checksum would already be correct if the TCP checksums would be fixed up?For the NIC with the tx-udp_tnl features, the inner TCP checksums do get corrected and the UDP checksum stays the same. I did not include captures for this.
IPs for the guest running iperf -s (on host tamy2) 10.48.6.81 for the virtualized NIC 10.0.123.102 for the VXLAN
IPs for the guest running iperf -c (on host tamy3):
10.48.6.101 for the virtualized NIC 10.0.123.103 for the VXLANThe captures are short, so I take the liberty to just provide them directly:
[I] febner@enia ~> tar cf pcap.tar tamy*.pcap
[I] febner@enia ~> xz pcap.tar
[I] febner@enia ~> base64 -w 70 pcap.tar.xz /Td6WFoAAATm1rRGBMDXBYCgASEBFgAAAAAAAKQwOkPgT/8Cz10AOhhJ/551cIJN23SQMX Q2Us4cGiof2bxOS4FK4DxejNh+76NiWIpdIfOxrB5urac3FT0mPKMbUreSY+04/NhofcgS Zz41D6t/Xp+VkPxNYx7Xsp3xz4xUCsVuK205jz6G/NAY0bJ0+UrJuCkP0G5VBtn88hJstD 7qlaT7qcBLECseOO1OfqsLezxasbm5p614IL18cqAVMCMWucr/Kh2Oqth26v7zI4SVEJC/ YSEgaOhfjCbQZSi85BEw9/NSZO6IqoyNLrEiPUPgXTWH63NssG+4RMuBswrkgN5Wld70B1 mROOCwKbo9b9oXI4DumGHqgCV5jdAxzITpEjMQpvDKh6NvM5L/8v1cPiGjLFSL2JesZ0F5 dTbstymv1q4eN+9f3ng+4AXCvDzaziYMwtGwxYyptK5qDI2oGsCIGwFDpP/ZEw7NYI9EMM G2+SDG6D8bKgKWl9Mi6EJcqSMVKFR1P1Z/P3XJ/9sWOMJug1IVYZGIJmtXXM3+roqOEGMFQuoted 8 lines
tco/LMUJHgdmfkitfuZ5tN1+0EVE0/f4GQiUpdidjqfZ2m9jL0svcGXUd5D3LN0tbh5vmP KzXQNtMQiMY6Fj7gbzDbOQGGW/L3/34B5YV+pWEpzhAbeTI9KL0ZF3vJ0OESlL9OMhrqgl WX23bxek2h9eG15eO9cderaoCOFb8NEKIjC+UTh2Ir7/ZFfDvlXeGB/3jXM8OTmWmJSr5b CrAvBQ4xvow3hwKq2Fbyu7aU6KycVpo03a+59LqxPyRfc3qRXcoUnp8MTi2YUk+kfYR6mI S9AE/5xYFzb7I40RUBPUm0OCzguzk9qlIcab3lnTFnrMWa+Cj9AMIkWEEf0tMzw0v9+17u VJg/8tWMad3d9Jc5Z6B9kOukzGvgVEWoq4z9snb/k6u2sBVY36q2iI1cmSPrI+UcF2GtSA Qs6bt/T/c1Xi2r0Up+tRDrIE9O2aNAAAAKAWpkIVfsvrAAHzBYCgAQAA6om1scRn+wIAAA AABFla
Quoted 7 lines
Thanks for the data. The bug is in the
virtio_netdriver; non GSO packets requiring inner header csum are handled unmodified from the guest to the host, and the H/W NICs has to compute the inner transport header csum for the encap packet.Could you please try the attached kernel patch? You will need to update the kernel inside the guest.
Paolo was there supposed to be a patch here?
Quoted 15 lines
Quoted 3 lines
Do you have any tips where to start looking in the kernel? What is the expected place where the TCP checksums are corrected if the NIC does not have the tx-udp_tnl features?
Hopefully no more investigation needed. FTR, for non GSO packets, the inner transport header csum should be computed inside the guest before transmitting on the virtio net device.
For GSO packets such csum should be computed inside the host, just before transmitting on the H/W NIC (if the latter does not support the relevant offload).
Thanks,
Paolo
Paolo Abeni
maintainerRe: [PULL 12/14] virtio-net: Advertise UDP tunnel GSO support by default
Quoted 187 lines · Michael S. Tsirkin
Quoted 186 lines · Paolo Abeni
Quoted 171 lines · Fiona Ebner
Am 05.06.26 um 4:54 PM schrieb Paolo Abeni:
Quoted 110 lines · Fiona Ebner
Quoted 94 lines
Am 09.11.25 um 4:10 PM schrieb Michael S. Tsirkin:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4302
Quoted 10 lines
hw/net/virtio-net.c +1
-1@@ -4299,19 +4299,19 @@ static const Property virtio_net_properties[] = {VIRTIO_DEFINE_PROP_FEATURE ("host_tunnel" , VirtIONet, host_features_ex,VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO , - false), + true),it seems that the
host_tunnelsetting can cause issues when VXLAN traffic originating in a guest goes over a physical NIC which does not support the feature. We received several reports about the issue [0][1][2][3] and were able to reproduce it. Turning off the 'host_tunnel' property in the commandline for the VirtIO net device makes TCP traffic work. The network configuration from our reproducer setup is as follows:guest A (iperf3 -c) guest B (iperf3 -s)
vxlan using vNIC as underlay vxlan using vNIC as underlay
virtualized NIC exposed to guest virtualized NIC exposed to guest
---guest boundary--- ---guest boundary---
tap device connected to bridge tap device connected to bridge
bridge with physical NIC as port bridge with physical NIC as portphysical NIC <---host boundary---> physical NICBridge configuration:
iface vmbr0 inet staticaddress 10.48.0.109/20 gateway 10.48.0.1 bridge-ports nic3 bridge-stp off bridge-fd 0 bridge-vlan-aware yes bridge-vids 2-4094VXLAN created with:
ip link add vxlan0 type vxlan id 100 remote X dstport 4789 dev eth1 where eth1 is the virtualized NIC exposed to the guestThe physical NIC does not have the feature:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe [14e4:1657] (rev 01)
tx-udp_tnl-segmentation: off [fixed] tx-udp_tnl-csum-segmentation: off [fixed]Using a physical NIC which does have the feature works:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet [14e4:1751] (rev 11)
tx-udp_tnl-segmentation: on tx-udp_tnl-csum-segmentation: onHost kernel:
Proxmox VE with 7.0.2-6-pveGuest kernel:
Apline with 6.18.34-0-ltsQEMU commandline for the vNIC:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4304
Quoted 2 lines
hw/net/virtio-net.c +0
-2-netdev 'type=tap,id=net2,ifname=tap103i2,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on' \ -device 'virtio-net-pci,mac=BC:24:11:78:C3:3B,netdev=net2,bus=pci.0,addr=0x14,id=net2,rx_queue_size=1024,tx_queue_size=256,host_mtu=1500' \We can see that QEMU sets the features for the tap interface via
ioctl()and the host kernel allows it:
tx-udp_tnl-segmentation: on
tx-udp_tnl-csum-segmentation: onAs far as we understand, in the problematic scenario, nothing is ever filling in the checksums for the inner TCP packets, meaning the outer UDP checksum ends up being wrong on the target side. Is the host kernel responsible for doing that before passing the packet to the physical NIC (without the feature)? Or who would be?
Turning off
host_tunnel_csumwithout turning offhost_tunneldoes not help.Interestingly, turning off the features for the working physical NIC does not make it break:
tx-udp_tnl-segmentation: off
tx-udp_tnl-csum-segmentation: off
Could it be that the NIC just always fills in the inner TCP checksums regardless of that setting?On the other hand, running
localhost:~# ethtool -K eth2 tx-checksum-ip-generic off Actual changes: tx-checksum-ip-generic: off tx-tcp-segmentation: off [not requested] tx-tcp-ecn-segmentation: off [not requested] tx-tcp6-segmentation: off [not requested] tx-udp-segmentation: off [not requested] inside the guests makes it work for the physical NIC without the tx-udp_tnl* features.Quoted 6 lines
I wanted to ask if this configuration is expected to be unsupported and if the management is expected to turn off the feature on the commandline if the traffic might go over a physical NIC without the feature. Or if this could be a kernel or NIC bug that should be investigated further? In the former case, should the option really be turned on by default with new machine versions?
Thank you for the detailed report. The configuration you describe is supported and expected to work. The fact that different results are obtained on top of a NIC with:
[1] tx-udp_tnl-segmentation: off [fixed]
WRT to similar setup on top of NIC with:
Quoted 7 lines
[2] tx-udp_tnl-segmentation: off
is indeed strange/unexpected, as the two scenarios are indistinguishable from the stack perspective. I suspect the issue is NIC driver dependent.
I understand [1] is using a tg3 driver, and [2] bnxt, both running Linux 7.0.2, am I correct?
Yes.
Quoted 1 line
If you disable csum offloading on the tg3 NIC, does that impact the results?
Yes, doing
root@tamy3:~# ethtool -K nic3 tx-checksum-ipv4 off Actual changes: tx-checksum-ipv4: off tx-tcp-segmentation: off [not requested] tx-tcp-ecn-segmentation: off [not requested]on both hosts makes it work.
Quoted 3 lines
If you have such data handy, could you please share pcap captures on both ends? links to some accessible URL would be better than sending a lot of data to the ML, I think.
I captured the following while the problem is present with tcpdump -i foo udp port 4789 -w bar.pcap
on the host interfaces (tap, bridge and physical NIC) just to be sure. Looking at it with tcpdump -envvvr, within the same host, only the timestamps change. Between the hosts, the UDP checksums do change, but the inner TCP checksums do not. So I suppose the NIC fills in the UDP checksum based on the still wrong data? Since the UDP checksum would already be correct if the TCP checksums would be fixed up?For the NIC with the tx-udp_tnl features, the inner TCP checksums do get corrected and the UDP checksum stays the same. I did not include captures for this.
IPs for the guest running iperf -s (on host tamy2) 10.48.6.81 for the virtualized NIC 10.0.123.102 for the VXLAN
IPs for the guest running iperf -c (on host tamy3):
10.48.6.101 for the virtualized NIC 10.0.123.103 for the VXLANThe captures are short, so I take the liberty to just provide them directly:
[I] febner@enia ~> tar cf pcap.tar tamy*.pcap
[I] febner@enia ~> xz pcap.tar
[I] febner@enia ~> base64 -w 70 pcap.tar.xz /Td6WFoAAATm1rRGBMDXBYCgASEBFgAAAAAAAKQwOkPgT/8Cz10AOhhJ/551cIJN23SQMX Q2Us4cGiof2bxOS4FK4DxejNh+76NiWIpdIfOxrB5urac3FT0mPKMbUreSY+04/NhofcgS Zz41D6t/Xp+VkPxNYx7Xsp3xz4xUCsVuK205jz6G/NAY0bJ0+UrJuCkP0G5VBtn88hJstD 7qlaT7qcBLECseOO1OfqsLezxasbm5p614IL18cqAVMCMWucr/Kh2Oqth26v7zI4SVEJC/ YSEgaOhfjCbQZSi85BEw9/NSZO6IqoyNLrEiPUPgXTWH63NssG+4RMuBswrkgN5Wld70B1 mROOCwKbo9b9oXI4DumGHqgCV5jdAxzITpEjMQpvDKh6NvM5L/8v1cPiGjLFSL2JesZ0F5 dTbstymv1q4eN+9f3ng+4AXCvDzaziYMwtGwxYyptK5qDI2oGsCIGwFDpP/ZEw7NYI9EMM G2+SDG6D8bKgKWl9Mi6EJcqSMVKFR1P1Z/P3XJ/9sWOMJug1IVYZGIJmtXXM3+roqOEGMFQuoted 8 lines
tco/LMUJHgdmfkitfuZ5tN1+0EVE0/f4GQiUpdidjqfZ2m9jL0svcGXUd5D3LN0tbh5vmP KzXQNtMQiMY6Fj7gbzDbOQGGW/L3/34B5YV+pWEpzhAbeTI9KL0ZF3vJ0OESlL9OMhrqgl WX23bxek2h9eG15eO9cderaoCOFb8NEKIjC+UTh2Ir7/ZFfDvlXeGB/3jXM8OTmWmJSr5b CrAvBQ4xvow3hwKq2Fbyu7aU6KycVpo03a+59LqxPyRfc3qRXcoUnp8MTi2YUk+kfYR6mI S9AE/5xYFzb7I40RUBPUm0OCzguzk9qlIcab3lnTFnrMWa+Cj9AMIkWEEf0tMzw0v9+17u VJg/8tWMad3d9Jc5Z6B9kOukzGvgVEWoq4z9snb/k6u2sBVY36q2iI1cmSPrI+UcF2GtSA Qs6bt/T/c1Xi2r0Up+tRDrIE9O2aNAAAAKAWpkIVfsvrAAHzBYCgAQAA6om1scRn+wIAAA AABFla
Thanks for the data. The bug is in the
virtio_netdriver; non GSO packets requiring inner header csum are handled unmodified from the guest to the host, and the H/W NICs has to compute the inner transport header csum for the encap packet.
Quoted 4 lines
Quoted 2 lines
Could you please try the attached kernel patch? You will need to update the kernel inside the guest.
Paolo was there supposed to be a patch here?
I'm sorry, ENOCOFFEE here. Thanks Michael for the head-up!
Attaching the patch now.
/P
drivers/net/virtio_net.c +14 -1
@@ -6222,6 +6222,19 @@ static void virtnet_free_irq_moder(struct virtnet_info *vi)rtnl_unlock (); } +static netdev_features_t virtnet_features_check (struct sk_buff *skb, +struct net_device *dev, +netdev_features_t features) +{ +/* Inner csum offload is only available for GSO packets. */ +if (skb->encapsulation && !skb_is_gso (skb)) +return features & ~NETIF_F_CSUM_MASK ; + +/* Passthru. */ +return features; +} + +static const struct net_device_ops virtnet_netdev = { .ndo_open = virtnet_open, .ndo_stop = virtnet_close,
@@ -6235,7 +6248,7 @@ static const struct net_device_ops virtnet_netdev = { .ndo_bpf = virtnet_xdp, .ndo_xdp_xmit = virtnet_xdp_xmit, .ndo_xsk_wakeup = virtnet_xsk_wakeup, - .ndo_features_check = passthru_features_check, + .ndo_features_check = virtnet_features_check, .ndo_get_phys_port_name = virtnet_get_phys_port_name, .ndo_set_features = virtnet_set_features, .ndo_tx_timeout = virtnet_tx_timeout,
Fiona Ebner
Tested-byRe: [PULL 12/14] virtio-net: Advertise UDP tunnel GSO support by default
Am 09.06.26 um 9:03 AM schrieb Paolo Abeni:
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · Paolo Abeni
Quoted 7 lines
Thanks for the data. The bug is in the
virtio_netdriver; non GSO packets requiring inner header csum are handled unmodified from the guest to the host, and the H/W NICs has to compute the inner transport header csum for the encap packet.Could you please try the attached kernel patch? You will need to update the kernel inside the guest.
I first tested 7.1.0-rc7 inside the guest and the issue was still present. With your patch on top, the issue is gone :)
Thank you for the fast fix!
Best Regards,
Fiona
Michael S. Tsirkin
maintainerRe: [PULL 12/14] virtio-net: Advertise UDP tunnel GSO support by default
In reply to Fiona EbnerQuoted 108 lines · Fiona Ebner
Dear maintainers,
Am 09.11.25 um 4:10 PM schrieb Michael S. Tsirkin:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4302
Quoted 10 lines
hw/net/virtio-net.c +1
-1@@ -4299,19 +4299,19 @@ static const Property virtio_net_properties[] = {VIRTIO_DEFINE_PROP_FEATURE ("host_tunnel" , VirtIONet, host_features_ex,VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO , - false), + true),it seems that the
host_tunnelsetting can cause issues when VXLAN traffic originating in a guest goes over a physical NIC which does not support the feature. We received several reports about the issue [0][1][2][3] and were able to reproduce it. Turning off the 'host_tunnel' property in the commandline for the VirtIO net device makes TCP traffic work. The network configuration from our reproducer setup is as follows:guest A (iperf3 -c) guest B (iperf3 -s)
vxlan using vNIC as underlay vxlan using vNIC as underlay
virtualized NIC exposed to guest virtualized NIC exposed to guest
---guest boundary--- ---guest boundary---
tap device connected to bridge tap device connected to bridge
bridge with physical NIC as port bridge with physical NIC as portphysical NIC <---host boundary---> physical NICBridge configuration:
iface vmbr0 inet staticaddress 10.48.0.109/20 gateway 10.48.0.1 bridge-ports nic3 bridge-stp off bridge-fd 0 bridge-vlan-aware yes bridge-vids 2-4094VXLAN created with:
ip link add vxlan0 type vxlan id 100 remote X dstport 4789 dev eth1 where eth1 is the virtualized NIC exposed to the guestThe physical NIC does not have the feature:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe [14e4:1657] (rev 01)
tx-udp_tnl-segmentation: off [fixed] tx-udp_tnl-csum-segmentation: off [fixed]Using a physical NIC which does have the feature works:
Ethernet controller [0200]: Broadcom Inc. and subsidiaries BCM57504 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet [14e4:1751] (rev 11)
tx-udp_tnl-segmentation: on tx-udp_tnl-csum-segmentation: onHost kernel:
Proxmox VE with 7.0.2-6-pveGuest kernel:
Apline with 6.18.34-0-ltsQEMU commandline for the vNIC:
hw/net/virtio-net.c static const Property virtio_net_properties[] = { · line 4304
Quoted 2 lines
hw/net/virtio-net.c +0
-2-netdev 'type=tap,id=net2,ifname=tap103i2,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on' \ -device 'virtio-net-pci,mac=BC:24:11:78:C3:3B,netdev=net2,bus=pci.0,addr=0x14,id=net2,rx_queue_size=1024,tx_queue_size=256,host_mtu=1500' \We can see that QEMU sets the features for the tap interface via
ioctl()and the host kernel allows it:
tx-udp_tnl-segmentation: on
tx-udp_tnl-csum-segmentation: onAs far as we understand, in the problematic scenario, nothing is ever filling in the checksums for the inner TCP packets, meaning the outer UDP checksum ends up being wrong on the target side. Is the host kernel responsible for doing that before passing the packet to the physical NIC (without the feature)? Or who would be?
Turning off
host_tunnel_csumwithout turning offhost_tunneldoes not help.Interestingly, turning off the features for the working physical NIC does not make it break:
tx-udp_tnl-segmentation: off
tx-udp_tnl-csum-segmentation: off
Could it be that the NIC just always fills in the inner TCP checksums regardless of that setting?On the other hand, running
localhost:~# ethtool -K eth2 tx-checksum-ip-generic off Actual changes: tx-checksum-ip-generic: off tx-tcp-segmentation: off [not requested] tx-tcp-ecn-segmentation: off [not requested] tx-tcp6-segmentation: off [not requested] tx-udp-segmentation: off [not requested] inside the guests makes it work for the physical NIC without the tx-udp_tnl* features.I wanted to ask if this configuration is expected to be unsupported and if the management is expected to turn off the feature on the commandline if the traffic might go over a physical NIC without the feature. Or if this could be a kernel or NIC bug that should be investigated further? In the former case, should the option really be turned on by default with new machine versions?
I'll be happy to test and capture/provide additional information. Let me know what would be interesting.
Thanks to Stefan and Gabriel for looking into the issue with me!
Quoted 7 lines
Best Regards,
Fiona[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=7627
[1]: https://forum.proxmox.com/threads/183494/post-855144
[2]: https://forum.proxmox.com/threads/182328/post-854627
[3]: https://forum.proxmox.com/threads/183963/post-855737
looks like a kernel or nic bug to me.
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 01/14] MAINTAINERS: Update entry for AMD-Vi Emulation
In reply to Michael S. TsirkinFrom: Alejandro Jimenez <[email protected]>
Add myself as maintainer and Sairaj Kodilkar as reviewer.
Message-Id: <[email protected]>
--- MAINTAINERS | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
MAINTAINERS +4 -2
@@ -3933,8 +3933,10 @@ F: tests/functional/x86_64/test_intel_iommu.py F: tests/qtest/intel-iommu-test.c AMD-Vi Emulation -S: Orphan -F: hw/i386/amd_iommu.? +M: Alejandro Jimenez <[email protected]> +R: Sairaj Kodilkar <[email protected]> +S: Supported +F: hw/i386/amd_iommu* OpenSBI Firmware L: [email protected]
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 08/14] vhost-user: make vhost_set_vring_file() synchronous
In reply to Michael S. TsirkinFrom: German Maglione <[email protected]>
QEMU sends all of VHOST_USER_SET_VRING_KICK, _CALL, and _ERR without setting the NEED_REPLY flag, i.e. by the time the respective vhost_user_set_vring_*() function returns, it is completely up to chance whether the back-end has already processed the request and switched over to the new FD for interrupts.
At least for vhost_user_set_vring_call(), that is a problem: It is called through vhost_virtqueue_mask(), which is generally used in the VirtioDeviceClass.guest_notifier_mask() implementation, which is in turn called by virtio_pci_one_vector_unmask(). The fact that we do not wait for the back-end to install the FD leads to a race there:
Masking interrupts is implemented by redirecting interrupts to an internal event FD that is not connected to the guest. Unmasking then re-installs the guest-connected IRQ FD, then checks if there are pending interrupts left on the masked event FD, and if so, issues an interrupt to the guest.
Because guest_notifier_mask() (through vhost_user_set_vring_call()) doesn't wait for the back-end to switch over to the actual IRQ FD, it's possible we check for pending interrupts while the back-end is still using the masked event FD, and then we will lose interrupts that occur before the back-end finally does switch over.
Fix this by setting NEED_REPLY on those VHOST_USER_SET_VRING_* messages, so when we get that reply, we know that the back-end is now using the new FD.
We have a few reports of a virtiofs mount hanging:
- https://gitlab.com/virtio-fs/virtiofsd/-/issues/101
- https://gitlab.com/virtio-fs/virtiofsd/-/issues/133
- https://gitlab.com/virtio-fs/virtiofsd/-/issues/213
This is quite difficult bug to reproduce, even for the reporters. It only happens on production, every few weeks, and/or on 1 in 300 VMs. So, we are not 100% sure this fixes that issue. However, we think this is still a bug, and at least we have one report that claims this fixed the issue:
https://gitlab.com/virtio-fs/virtiofsd/-/issues/133#note_2743209419
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
hw/virtio/vhost-user.c +23 -1
@@ -1327,8 +1327,11 @@ static int vhost_set_vring_file(struct vhost_dev *dev,VhostUserRequest request, struct vhost_vring_file *file) { + int ret;int fds[VHOST_USER_MAX_RAM_SLOTS ];size_t fd_num =0 ; +bool reply_supported =virtio_has_feature (dev->protocol_features, +VHOST_USER_PROTOCOL_F_REPLY_ACK ); VhostUserMsg msg = { .hdr.request = request, .hdr.flags = VHOST_USER_VERSION,
@@ -1336,13 +1339,32 @@ static int vhost_set_vring_file(struct vhost_dev *dev, .hdr.size = sizeof(msg.payload.u64), }; +if (reply_supported) { + msg.hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; + } +if (file->fd >0 ) { fds[fd_num++] = file->fd; }else { msg.payload.u64 |=VHOST_USER_VRING_NOFD_MASK ; } -return vhost_user_write (dev, &msg, fds, fd_num); + ret =vhost_user_write (dev, &msg, fds, fd_num); +if (ret <0 ) { +return ret; + } + +if (reply_supported) { +/* +* wait for the back-end's confirmation that the new FD is active, +* otherwise guest_notifier_mask() could check for pending interrupts +* while the back-end is still using the masked event FD, losing +* interrupts that occur before the back-end installs the FD +*/ +return process_message_reply (dev, &msg); + } + +return 0 ; } static int vhost_user_set_vring_kick(struct vhost_dev *dev,
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 06/14] intel_iommu: Reset pasid cache when system level reset
In reply to Michael S. TsirkinFrom: Zhenzhong Duan <[email protected]>
Reset pasid cache when system level reset. Currently we don't have any device supporting PASID yet. So all are PASID_0, its vtd_as is allocated by PCI system and never removed, just mark pasid cache invalid.
Message-Id: <[email protected]>
--- hw/i386/intel_iommu.c | 15 +++++++++++++++ hw/i386/trace-events | 1 + 2 files changed, 16 insertions(+)
hw/i386/intel_iommu.c +15 -0
@@ -87,6 +87,20 @@ struct vtd_iotlb_key {static void vtd_address_space_refresh_all (IntelIOMMUState *s);static void vtd_address_space_unmap (VTDAddressSpace *as,IOMMUNotifier *n); +static void vtd_pasid_cache_reset_locked (IntelIOMMUState *s) +{ +VTDAddressSpace *vtd_as; +GHashTableIter as_it; + +trace_vtd_pasid_cache_reset (); + +g_hash_table_iter_init (&as_it, s->vtd_address_spaces); +while (g_hash_table_iter_next (&as_it,NULL , (void **)&vtd_as)) { +VTDPASIDCacheEntry *pc_entry = &vtd_as->pasid_cache_entry; + pc_entry->valid = false; + } +} +static void vtd_define_quad (IntelIOMMUState *s,hwaddr addr,uint64_t val,uint64_t wmask,uint64_t w1cmask) {
@@ -381,6 +395,7 @@ static void vtd_reset_caches(IntelIOMMUState *s)vtd_iommu_lock (s);vtd_reset_iotlb_locked (s);vtd_reset_context_cache_locked (s); +vtd_pasid_cache_reset_locked (s);vtd_iommu_unlock (s); }
hw/i386/trace-events +1 -0
@@ -24,6 +24,7 @@ vtd_inv_qi_head(uint16_t head) "read head %d" vtd_inv_qi_tail(uint16_t head) "write tail %d" vtd_inv_qi_fetch(void) "" vtd_context_cache_reset(void) "" +vtd_pasid_cache_reset(void) "" vtd_inv_desc_pasid_cache_gsi(void) "" vtd_inv_desc_pasid_cache_dsi(uint16_t domain) "Domain selective PC invalidation domain 0x%"PRIx16 vtd_inv_desc_pasid_cache_psi(uint16_t domain, uint32_t pasid) "PASID selective PC invalidation domain 0x%"PRIx16" pasid 0x%"PRIx32
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 04/14] vhost-user: fix shared object lookup handler logic
In reply to Michael S. TsirkinFrom: Albert Esteve <[email protected]>
Refactor backend_read() function and add a reply_ack variable to have the option for handlers to force tweak whether they should send a reply or not without depending on VHOST_USER_NEED_REPLY_MASK flag.
This fixes an issue with vhost_user_backend_handle_shared_object_lookup() logic, as the error path was not closing the backend channel correctly. So, we can remove the reply call from within the handler, make sure it returns early on errors as other handlers do and set the reply_ack variable on backend_read() to true to ensure that it will send a response, thus keeping the original intent.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-)
hw/virtio/vhost-user.c +13 -27
@@ -1668,14 +1668,6 @@ static bool vhost_user_send_resp(QIOChannel *ioc, VhostUserHeader *hdr,return !qio_channel_writev_all (ioc, iov,ARRAY_SIZE (iov), errp); } -static bool -vhost_user_backend_send_dmabuf_fd (QIOChannel *ioc,VhostUserHeader *hdr, -VhostUserPayload *payload,Error **errp) -{ - hdr->size =sizeof (payload->u64); -return vhost_user_send_resp (ioc, hdr, payload, errp); -} -int vhost_user_get_shared_object (struct vhost_dev *dev,unsigned char *uuid,int *dmabuf_fd) {
@@ -1716,19 +1708,15 @@ int vhost_user_get_shared_object(struct vhost_dev *dev, unsigned char *uuid,static int vhost_user_backend_handle_shared_object_lookup (struct vhost_user *u, -QIOChannel *ioc, -VhostUserHeader *hdr, -VhostUserPayload *payload) +VhostUserShared *object) {QemuUUID uuid;CharFrontend *chr = u->user->chr; -Error *local_err =NULL ;int dmabuf_fd =-1 ;int fd_num =0 ; -memcpy (uuid.data, payload->object.uuid,sizeof (payload->object.uuid)); +memcpy (uuid.data, object->uuid,sizeof (object->uuid)); - payload->u64 =0 ;switch (virtio_object_type (&uuid)) {case TYPE_DMABUF : dmabuf_fd =virtio_lookup_dmabuf (&uuid);
@@ -1737,18 +1725,16 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u, {struct vhost_dev *dev =virtio_lookup_vhost_device (&uuid);if (dev ==NULL ) { - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }int ret =vhost_user_get_shared_object (dev, uuid.data, &dmabuf_fd);if (ret <0 ) { - payload->u64 = ret; +return ret; }break ; }case TYPE_INVALID : - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }if (dmabuf_fd !=-1 ) {
@@ -1757,11 +1743,6 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u,if (qemu_chr_fe_set_msgfds (chr, &dmabuf_fd, fd_num) <0 ) {error_report ("Failed to set msg fds." ); - payload->u64 = -EINVAL ; - } - -if (!vhost_user_backend_send_dmabuf_fd (ioc, hdr, payload, &local_err)) { -error_report_err (local_err);return -EINVAL ; }
@@ -1790,6 +1771,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,struct iovec iov; g_autofree int *fd = NULL;size_t fdsize =0 ; +bool reply_ack;int i;/* Read header */
@@ -1808,6 +1790,8 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, goto err; } + reply_ack = hdr.flags &VHOST_USER_NEED_REPLY_MASK ; +/* Read payload */ if (qio_channel_read_all (ioc, (char *) &payload, hdr.size, &local_err)) {error_report_err (local_err);
@@ -1833,8 +1817,10 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, &payload.object);break ;case VHOST_USER_BACKEND_SHARED_OBJECT_LOOKUP : - ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, ioc, - &hdr, &payload); +/* The backend always expects a response */ + reply_ack = true; + ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, + &payload.object);break ;default :error_report ("Received unexpected msg type: %d." , hdr.request);
@@ -1845,7 +1831,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,* REPLY_ACK feature handling. Other reply types has to be managed * directly in their request handlers. */ -if (hdr.flags &VHOST_USER_NEED_REPLY_MASK ) { +if (reply_ack) { payload.u64 = !!ret; hdr.size =sizeof (payload.u64);
Signature · 1 line
MST
Re: [PULL 04/14] vhost-user: fix shared object lookup handler logic
Quoted 8 lines · Michael S. Tsirkin
From: Albert Esteve <[email protected]>
Refactor
backend_read()function and add areply_ackvariable to have the option for handlers to force tweak whether they should send a reply or not without depending onVHOST_USER_NEED_REPLY_MASKflag.
Quoted 7 lines
This fixes an issue with
vhost_user_backend_handle_shared_object_lookup()logic, as the error path was not closing the backend channel correctly. So, we can remove the reply call from within the handler, make sure it returns early on errors as other handlers do and set thereply_ackvariable onbackend_read()to true to ensure that it will send a response, thus keeping the original intent.
Hey Michal,
This patch was
Based-on: <[email protected]> … for main.
As this was the first time I did this based-on thingy, I am just making sure that the other patch was not missed.
If this PULL is only targeting stable, then it's ok as is.
BR,
Albert
Quoted 129 lines
Fixes 1609476662 ("vhost-user: add shared_object msg")Signed-off-by Albert Esteve <[email protected]>Reviewed-by Stefano Garzarella <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-)hw/virtio/vhost-user.c +13
-28@@ -1668,14 +1668,6 @@ static bool vhost_user_send_resp(QIOChannel *ioc, VhostUserHeader *hdr,return !qio_channel_writev_all (ioc, iov,ARRAY_SIZE (iov), errp); } -static bool -vhost_user_backend_send_dmabuf_fd (QIOChannel *ioc,VhostUserHeader *hdr, -VhostUserPayload *payload,Error **errp) -{ - hdr->size =sizeof (payload->u64); -return vhost_user_send_resp (ioc, hdr, payload, errp); -} -int vhost_user_get_shared_object (struct vhost_dev *dev,unsigned char *uuid,int *dmabuf_fd) {@@ -1716,19 +1708,15 @@ int vhost_user_get_shared_object(struct vhost_dev *dev, unsigned char *uuid,static int vhost_user_backend_handle_shared_object_lookup (struct vhost_user *u, -QIOChannel *ioc, -VhostUserHeader *hdr, -VhostUserPayload *payload) +VhostUserShared *object) {QemuUUID uuid;CharFrontend *chr = u->user->chr; -Error *local_err =NULL ;int dmabuf_fd =-1 ;int fd_num =0 ; -memcpy (uuid.data, payload->object.uuid,sizeof (payload->object.uuid)); +memcpy (uuid.data, object->uuid,sizeof (object->uuid)); - payload->u64 =0 ;switch (virtio_object_type (&uuid)) {case TYPE_DMABUF : dmabuf_fd =virtio_lookup_dmabuf (&uuid);@@ -1737,18 +1725,16 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u, {struct vhost_dev *dev =virtio_lookup_vhost_device (&uuid);if (dev ==NULL ) { - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }int ret =vhost_user_get_shared_object (dev, uuid.data, &dmabuf_fd);if (ret <0 ) { - payload->u64 = ret; +return ret; }break ; }case TYPE_INVALID : - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }if (dmabuf_fd !=-1 ) {@@ -1757,11 +1743,6 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u,if (qemu_chr_fe_set_msgfds (chr, &dmabuf_fd, fd_num) <0 ) {error_report ("Failed to set msg fds." ); - payload->u64 = -EINVAL ; - } - -if (!vhost_user_backend_send_dmabuf_fd (ioc, hdr, payload, &local_err)) { -error_report_err (local_err);return -EINVAL ; }@@ -1790,6 +1771,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,struct iovec iov; g_autofree int *fd = NULL;size_t fdsize =0 ; +bool reply_ack;int i;/* Read header */ @@ -1808,6 +1790,8 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, goto err; } + reply_ack = hdr.flags &VHOST_USER_NEED_REPLY_MASK ; +/* Read payload */ if (qio_channel_read_all (ioc, (char *) &payload, hdr.size, &local_err)) {error_report_err (local_err);@@ -1833,8 +1817,10 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, &payload.object);break ;case VHOST_USER_BACKEND_SHARED_OBJECT_LOOKUP : - ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, ioc, - &hdr, &payload); +/* The backend always expects a response */ + reply_ack = true; + ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, + &payload.object);break ;default :error_report ("Received unexpected msg type: %d." , hdr.request);@@ -1845,7 +1831,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,* REPLY_ACK feature handling. Other reply types has to be managed * directly in their request handlers. */ -if (hdr.flags &VHOST_USER_NEED_REPLY_MASK ) { +if (reply_ack) { payload.u64 = !!ret; hdr.size =sizeof (payload.u64); --MST
Re: [PULL 04/14] vhost-user: fix shared object lookup handler logic
Quoted 19 lines · Albert Esteve
Quoted 8 lines · Michael S. Tsirkin
From: Albert Esteve <[email protected]>
Refactor
backend_read()function and add areply_ackvariable to have the option for handlers to force tweak whether they should send a reply or not without depending onVHOST_USER_NEED_REPLY_MASKflag.Quoted 7 lines
This fixes an issue with
vhost_user_backend_handle_shared_object_lookup()logic, as the error path was not closing the backend channel correctly. So, we can remove the reply call from within the handler, make sure it returns early on errors as other handlers do and set thereply_ackvariable onbackend_read()to true to ensure that it will send a response, thus keeping the original intent.Hey Michal,
Quoted 7 lines
This patch was
Based-on: <[email protected]> … for main.As this was the first time I did this based-on thingy, I am just making sure that the other patch was not missed.
If this PULL is only targeting stable, then it's ok as is.
This PR is targeting master, and "vhost-user: Add SHMEM_MAP/UNMAP requests" is not present.
Albert, thanks for noticing.
Michael, I'll hold off on applying this PR for the moment.
r~
Michael S. Tsirkin
maintainerRe: [PULL 04/14] vhost-user: fix shared object lookup handler logic
In reply to Albert EsteveQuoted 17 lines · Albert Esteve
Quoted 8 lines · Michael S. Tsirkin
From: Albert Esteve <[email protected]>
Refactor
backend_read()function and add areply_ackvariable to have the option for handlers to force tweak whether they should send a reply or not without depending onVHOST_USER_NEED_REPLY_MASKflag.Quoted 7 lines
This fixes an issue with
vhost_user_backend_handle_shared_object_lookup()logic, as the error path was not closing the backend channel correctly. So, we can remove the reply call from within the handler, make sure it returns early on errors as other handlers do and set thereply_ackvariable onbackend_read()to true to ensure that it will send a response, thus keeping the original intent.
Quoted 5 lines
Hey Michal,
This patch was
Based-on: <[email protected]> … for main.
That's the SHMEM thing right? Yes but I rebased it dropping the SHMEM dependency.
At least, I think I did it correctly.
Quoted 3 lines
As this was the first time I did this based-on thingy, I am just making sure that the other patch was not missed.
If this PULL is only targeting stable, then it's ok as is.
It is targeting 10.2 which is in freeze. So equivalently same.
Quoted 132 lines
BR,
AlbertQuoted 129 lines
Fixes 1609476662 ("vhost-user: add shared_object msg")Signed-off-by Albert Esteve <[email protected]>Reviewed-by Stefano Garzarella <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-)hw/virtio/vhost-user.c +13
-28@@ -1668,14 +1668,6 @@ static bool vhost_user_send_resp(QIOChannel *ioc, VhostUserHeader *hdr,return !qio_channel_writev_all (ioc, iov,ARRAY_SIZE (iov), errp); } -static bool -vhost_user_backend_send_dmabuf_fd (QIOChannel *ioc,VhostUserHeader *hdr, -VhostUserPayload *payload,Error **errp) -{ - hdr->size =sizeof (payload->u64); -return vhost_user_send_resp (ioc, hdr, payload, errp); -} -int vhost_user_get_shared_object (struct vhost_dev *dev,unsigned char *uuid,int *dmabuf_fd) {@@ -1716,19 +1708,15 @@ int vhost_user_get_shared_object(struct vhost_dev *dev, unsigned char *uuid,static int vhost_user_backend_handle_shared_object_lookup (struct vhost_user *u, -QIOChannel *ioc, -VhostUserHeader *hdr, -VhostUserPayload *payload) +VhostUserShared *object) {QemuUUID uuid;CharFrontend *chr = u->user->chr; -Error *local_err =NULL ;int dmabuf_fd =-1 ;int fd_num =0 ; -memcpy (uuid.data, payload->object.uuid,sizeof (payload->object.uuid)); +memcpy (uuid.data, object->uuid,sizeof (object->uuid)); - payload->u64 =0 ;switch (virtio_object_type (&uuid)) {case TYPE_DMABUF : dmabuf_fd =virtio_lookup_dmabuf (&uuid);@@ -1737,18 +1725,16 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u, {struct vhost_dev *dev =virtio_lookup_vhost_device (&uuid);if (dev ==NULL ) { - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }int ret =vhost_user_get_shared_object (dev, uuid.data, &dmabuf_fd);if (ret <0 ) { - payload->u64 = ret; +return ret; }break ; }case TYPE_INVALID : - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }if (dmabuf_fd !=-1 ) {@@ -1757,11 +1743,6 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u,if (qemu_chr_fe_set_msgfds (chr, &dmabuf_fd, fd_num) <0 ) {error_report ("Failed to set msg fds." ); - payload->u64 = -EINVAL ; - } - -if (!vhost_user_backend_send_dmabuf_fd (ioc, hdr, payload, &local_err)) { -error_report_err (local_err);return -EINVAL ; }@@ -1790,6 +1771,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,struct iovec iov; g_autofree int *fd = NULL;size_t fdsize =0 ; +bool reply_ack;int i;/* Read header */ @@ -1808,6 +1790,8 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, goto err; } + reply_ack = hdr.flags &VHOST_USER_NEED_REPLY_MASK ; +/* Read payload */ if (qio_channel_read_all (ioc, (char *) &payload, hdr.size, &local_err)) {error_report_err (local_err);@@ -1833,8 +1817,10 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, &payload.object);break ;case VHOST_USER_BACKEND_SHARED_OBJECT_LOOKUP : - ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, ioc, - &hdr, &payload); +/* The backend always expects a response */ + reply_ack = true; + ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, + &payload.object);break ;default :error_report ("Received unexpected msg type: %d." , hdr.request);@@ -1845,7 +1831,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,* REPLY_ACK feature handling. Other reply types has to be managed * directly in their request handlers. */ -if (hdr.flags &VHOST_USER_NEED_REPLY_MASK ) { +if (reply_ack) { payload.u64 = !!ret; hdr.size =sizeof (payload.u64); --MST
Re: [PULL 04/14] vhost-user: fix shared object lookup handler logic
Quoted 21 lines · Michael S. Tsirkin
Quoted 19 lines · Albert Esteve
Quoted 8 lines · Michael S. Tsirkin
From: Albert Esteve <[email protected]>
Refactor
backend_read()function and add areply_ackvariable to have the option for handlers to force tweak whether they should send a reply or not without depending onVHOST_USER_NEED_REPLY_MASKflag.Quoted 7 lines
This fixes an issue with
vhost_user_backend_handle_shared_object_lookup()logic, as the error path was not closing the backend channel correctly. So, we can remove the reply call from within the handler, make sure it returns early on errors as other handlers do and set thereply_ackvariable onbackend_read()to true to ensure that it will send a response, thus keeping the original intent.Hey Michal,
Quoted 8 lines
Quoted 3 lines
This patch was
Based-on: <[email protected]> … for main.That's the SHMEM thing right? Yes but I rebased it dropping the SHMEM dependency.
At least, I think I did it correctly.
Yes, removing the dependency is correctly applied. But that was only required for the backport to stable.
If we merge this patch to main without the one it is based on, then I'd need to send a new version of the SHMEM patch with the block that you have dropped. I can do it, but I was trying to prioritize the other one, as it was a lot harder to get approved. That is why I based this patch on top of the SHMEM one and not the other way around.
Sorry if that was not clear from the message.
Quoted 141 lines
Quoted 4 lines
As this was the first time I did this based-on thingy, I am just making sure that the other patch was not missed.
If this PULL is only targeting stable, then it's ok as is.It is targeting 10.2 which is in freeze. So equivalently same.
Quoted 132 lines
BR,
AlbertQuoted 129 lines
Fixes 1609476662 ("vhost-user: add shared_object msg")Signed-off-by Albert Esteve <[email protected]>Reviewed-by Stefano Garzarella <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-)hw/virtio/vhost-user.c +13
-28@@ -1668,14 +1668,6 @@ static bool vhost_user_send_resp(QIOChannel *ioc, VhostUserHeader *hdr,return !qio_channel_writev_all (ioc, iov,ARRAY_SIZE (iov), errp); } -static bool -vhost_user_backend_send_dmabuf_fd (QIOChannel *ioc,VhostUserHeader *hdr, -VhostUserPayload *payload,Error **errp) -{ - hdr->size =sizeof (payload->u64); -return vhost_user_send_resp (ioc, hdr, payload, errp); -} -int vhost_user_get_shared_object (struct vhost_dev *dev,unsigned char *uuid,int *dmabuf_fd) {@@ -1716,19 +1708,15 @@ int vhost_user_get_shared_object(struct vhost_dev *dev, unsigned char *uuid,static int vhost_user_backend_handle_shared_object_lookup (struct vhost_user *u, -QIOChannel *ioc, -VhostUserHeader *hdr, -VhostUserPayload *payload) +VhostUserShared *object) {QemuUUID uuid;CharFrontend *chr = u->user->chr; -Error *local_err =NULL ;int dmabuf_fd =-1 ;int fd_num =0 ; -memcpy (uuid.data, payload->object.uuid,sizeof (payload->object.uuid)); +memcpy (uuid.data, object->uuid,sizeof (object->uuid)); - payload->u64 =0 ;switch (virtio_object_type (&uuid)) {case TYPE_DMABUF : dmabuf_fd =virtio_lookup_dmabuf (&uuid);@@ -1737,18 +1725,16 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u, {struct vhost_dev *dev =virtio_lookup_vhost_device (&uuid);if (dev ==NULL ) { - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }int ret =vhost_user_get_shared_object (dev, uuid.data, &dmabuf_fd);if (ret <0 ) { - payload->u64 = ret; +return ret; }break ; }case TYPE_INVALID : - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }if (dmabuf_fd !=-1 ) {@@ -1757,11 +1743,6 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u,if (qemu_chr_fe_set_msgfds (chr, &dmabuf_fd, fd_num) <0 ) {error_report ("Failed to set msg fds." ); - payload->u64 = -EINVAL ; - } - -if (!vhost_user_backend_send_dmabuf_fd (ioc, hdr, payload, &local_err)) { -error_report_err (local_err);return -EINVAL ; }@@ -1790,6 +1771,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,struct iovec iov; g_autofree int *fd = NULL;size_t fdsize =0 ; +bool reply_ack;int i;/* Read header */ @@ -1808,6 +1790,8 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, goto err; } + reply_ack = hdr.flags &VHOST_USER_NEED_REPLY_MASK ; +/* Read payload */ if (qio_channel_read_all (ioc, (char *) &payload, hdr.size, &local_err)) {error_report_err (local_err);@@ -1833,8 +1817,10 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, &payload.object);break ;case VHOST_USER_BACKEND_SHARED_OBJECT_LOOKUP : - ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, ioc, - &hdr, &payload); +/* The backend always expects a response */ + reply_ack = true; + ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, + &payload.object);break ;default :error_report ("Received unexpected msg type: %d." , hdr.request);@@ -1845,7 +1831,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,* REPLY_ACK feature handling. Other reply types has to be managed * directly in their request handlers. */ -if (hdr.flags &VHOST_USER_NEED_REPLY_MASK ) { +if (reply_ack) { payload.u64 = !!ret; hdr.size =sizeof (payload.u64); --MST
Michael S. Tsirkin
maintainerRe: [PULL 04/14] vhost-user: fix shared object lookup handler logic
Quoted 34 lines · Albert Esteve
Quoted 21 lines · Michael S. Tsirkin
Quoted 19 lines · Albert Esteve
Quoted 8 lines · Michael S. Tsirkin
From: Albert Esteve <[email protected]>
Refactor
backend_read()function and add areply_ackvariable to have the option for handlers to force tweak whether they should send a reply or not without depending onVHOST_USER_NEED_REPLY_MASKflag.Quoted 7 lines
This fixes an issue with
vhost_user_backend_handle_shared_object_lookup()logic, as the error path was not closing the backend channel correctly. So, we can remove the reply call from within the handler, make sure it returns early on errors as other handlers do and set thereply_ackvariable onbackend_read()to true to ensure that it will send a response, thus keeping the original intent.Hey Michal,
Quoted 8 lines
Quoted 3 lines
This patch was
Based-on: <[email protected]> … for main.That's the SHMEM thing right? Yes but I rebased it dropping the SHMEM dependency.
At least, I think I did it correctly.
Yes, removing the dependency is correctly applied. But that was only required for the backport to stable.
Quoted 7 lines
If we merge this patch to main without the one it is based on, then I'd need to send a new version of the SHMEM patch with the block that you have dropped. I can do it, but I was trying to prioritize the other one, as it was a lot harder to get approved. That is why I based this patch on top of the SHMEM one and not the other way around.
Sorry if that was not clear from the message.
Right but I can't apply SHMEM patch in freeze so yes, it has to go on top. Sorry it's like this.
Quoted 141 lines
Quoted 141 lines
Quoted 4 lines
As this was the first time I did this based-on thingy, I am just making sure that the other patch was not missed.
If this PULL is only targeting stable, then it's ok as is.It is targeting 10.2 which is in freeze. So equivalently same.
Quoted 132 lines
BR,
AlbertQuoted 129 lines
Fixes 1609476662 ("vhost-user: add shared_object msg")Signed-off-by Albert Esteve <[email protected]>Reviewed-by Stefano Garzarella <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-)hw/virtio/vhost-user.c +13
-28@@ -1668,14 +1668,6 @@ static bool vhost_user_send_resp(QIOChannel *ioc, VhostUserHeader *hdr,return !qio_channel_writev_all (ioc, iov,ARRAY_SIZE (iov), errp); } -static bool -vhost_user_backend_send_dmabuf_fd (QIOChannel *ioc,VhostUserHeader *hdr, -VhostUserPayload *payload,Error **errp) -{ - hdr->size =sizeof (payload->u64); -return vhost_user_send_resp (ioc, hdr, payload, errp); -} -int vhost_user_get_shared_object (struct vhost_dev *dev,unsigned char *uuid,int *dmabuf_fd) {@@ -1716,19 +1708,15 @@ int vhost_user_get_shared_object(struct vhost_dev *dev, unsigned char *uuid,static int vhost_user_backend_handle_shared_object_lookup (struct vhost_user *u, -QIOChannel *ioc, -VhostUserHeader *hdr, -VhostUserPayload *payload) +VhostUserShared *object) {QemuUUID uuid;CharFrontend *chr = u->user->chr; -Error *local_err =NULL ;int dmabuf_fd =-1 ;int fd_num =0 ; -memcpy (uuid.data, payload->object.uuid,sizeof (payload->object.uuid)); +memcpy (uuid.data, object->uuid,sizeof (object->uuid)); - payload->u64 =0 ;switch (virtio_object_type (&uuid)) {case TYPE_DMABUF : dmabuf_fd =virtio_lookup_dmabuf (&uuid);@@ -1737,18 +1725,16 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u, {struct vhost_dev *dev =virtio_lookup_vhost_device (&uuid);if (dev ==NULL ) { - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }int ret =vhost_user_get_shared_object (dev, uuid.data, &dmabuf_fd);if (ret <0 ) { - payload->u64 = ret; +return ret; }break ; }case TYPE_INVALID : - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }if (dmabuf_fd !=-1 ) {@@ -1757,11 +1743,6 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u,if (qemu_chr_fe_set_msgfds (chr, &dmabuf_fd, fd_num) <0 ) {error_report ("Failed to set msg fds." ); - payload->u64 = -EINVAL ; - } - -if (!vhost_user_backend_send_dmabuf_fd (ioc, hdr, payload, &local_err)) { -error_report_err (local_err);return -EINVAL ; }@@ -1790,6 +1771,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,struct iovec iov; g_autofree int *fd = NULL;size_t fdsize =0 ; +bool reply_ack;int i;/* Read header */ @@ -1808,6 +1790,8 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, goto err; } + reply_ack = hdr.flags &VHOST_USER_NEED_REPLY_MASK ; +/* Read payload */ if (qio_channel_read_all (ioc, (char *) &payload, hdr.size, &local_err)) {error_report_err (local_err);@@ -1833,8 +1817,10 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, &payload.object);break ;case VHOST_USER_BACKEND_SHARED_OBJECT_LOOKUP : - ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, ioc, - &hdr, &payload); +/* The backend always expects a response */ + reply_ack = true; + ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, + &payload.object);break ;default :error_report ("Received unexpected msg type: %d." , hdr.request);@@ -1845,7 +1831,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,* REPLY_ACK feature handling. Other reply types has to be managed * directly in their request handlers. */ -if (hdr.flags &VHOST_USER_NEED_REPLY_MASK ) { +if (reply_ack) { payload.u64 = !!ret; hdr.size =sizeof (payload.u64); --MST
Re: [PULL 04/14] vhost-user: fix shared object lookup handler logic
Quoted 42 lines · Michael S. Tsirkin
Quoted 40 lines · Albert Esteve
Quoted 21 lines · Michael S. Tsirkin
Quoted 19 lines · Albert Esteve
Quoted 8 lines · Michael S. Tsirkin
From: Albert Esteve <[email protected]>
Refactor
backend_read()function and add areply_ackvariable to have the option for handlers to force tweak whether they should send a reply or not without depending onVHOST_USER_NEED_REPLY_MASKflag.Quoted 7 lines
This fixes an issue with
vhost_user_backend_handle_shared_object_lookup()logic, as the error path was not closing the backend channel correctly. So, we can remove the reply call from within the handler, make sure it returns early on errors as other handlers do and set thereply_ackvariable onbackend_read()to true to ensure that it will send a response, thus keeping the original intent.Hey Michal,
Quoted 8 lines
Quoted 3 lines
This patch was
Based-on: <[email protected]> … for main.That's the SHMEM thing right? Yes but I rebased it dropping the SHMEM dependency.
At least, I think I did it correctly.
Yes, removing the dependency is correctly applied. But that was only required for the backport to stable.
If we merge this patch to main without the one it is based on, then I'd need to send a new version of the SHMEM patch with the block that you have dropped. I can do it, but I was trying to prioritize the other one, as it was a lot harder to get approved. That is why I based this patch on top of the SHMEM one and not the other way around.
Quoted 5 lines
Quoted 1 line
Sorry if that was not clear from the message.
Right but I can't apply SHMEM patch in freeze so yes, it has to go on top. Sorry it's like this.
Got it. Then it'll have to be the other way around. Thanks for handling the rebase, then. I'll send the new version of the SHMEM patch after this one lands.
Quoted 143 lines
Quoted 142 lines
Quoted 142 lines
Quoted 5 lines
As this was the first time I did this based-on thingy, I am just making sure that the other patch was not missed.
If this PULL is only targeting stable, then it's ok as is.It is targeting 10.2 which is in freeze. So equivalently same.
Quoted 132 lines
BR,
AlbertQuoted 129 lines
Fixes 1609476662 ("vhost-user: add shared_object msg")Signed-off-by Albert Esteve <[email protected]>Reviewed-by Stefano Garzarella <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-)hw/virtio/vhost-user.c +13
-28@@ -1668,14 +1668,6 @@ static bool vhost_user_send_resp(QIOChannel *ioc, VhostUserHeader *hdr,return !qio_channel_writev_all (ioc, iov,ARRAY_SIZE (iov), errp); } -static bool -vhost_user_backend_send_dmabuf_fd (QIOChannel *ioc,VhostUserHeader *hdr, -VhostUserPayload *payload,Error **errp) -{ - hdr->size =sizeof (payload->u64); -return vhost_user_send_resp (ioc, hdr, payload, errp); -} -int vhost_user_get_shared_object (struct vhost_dev *dev,unsigned char *uuid,int *dmabuf_fd) {@@ -1716,19 +1708,15 @@ int vhost_user_get_shared_object(struct vhost_dev *dev, unsigned char *uuid,static int vhost_user_backend_handle_shared_object_lookup (struct vhost_user *u, -QIOChannel *ioc, -VhostUserHeader *hdr, -VhostUserPayload *payload) +VhostUserShared *object) {QemuUUID uuid;CharFrontend *chr = u->user->chr; -Error *local_err =NULL ;int dmabuf_fd =-1 ;int fd_num =0 ; -memcpy (uuid.data, payload->object.uuid,sizeof (payload->object.uuid)); +memcpy (uuid.data, object->uuid,sizeof (object->uuid)); - payload->u64 =0 ;switch (virtio_object_type (&uuid)) {case TYPE_DMABUF : dmabuf_fd =virtio_lookup_dmabuf (&uuid);@@ -1737,18 +1725,16 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u, {struct vhost_dev *dev =virtio_lookup_vhost_device (&uuid);if (dev ==NULL ) { - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }int ret =vhost_user_get_shared_object (dev, uuid.data, &dmabuf_fd);if (ret <0 ) { - payload->u64 = ret; +return ret; }break ; }case TYPE_INVALID : - payload->u64 = -EINVAL ; -break ; +return -EINVAL ; }if (dmabuf_fd !=-1 ) {@@ -1757,11 +1743,6 @@ vhost_user_backend_handle_shared_object_lookup(struct vhost_user *u,if (qemu_chr_fe_set_msgfds (chr, &dmabuf_fd, fd_num) <0 ) {error_report ("Failed to set msg fds." ); - payload->u64 = -EINVAL ; - } - -if (!vhost_user_backend_send_dmabuf_fd (ioc, hdr, payload, &local_err)) { -error_report_err (local_err);return -EINVAL ; }@@ -1790,6 +1771,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,struct iovec iov; g_autofree int *fd = NULL;size_t fdsize =0 ; +bool reply_ack;int i;/* Read header */ @@ -1808,6 +1790,8 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, goto err; } + reply_ack = hdr.flags &VHOST_USER_NEED_REPLY_MASK ; +/* Read payload */ if (qio_channel_read_all (ioc, (char *) &payload, hdr.size, &local_err)) {error_report_err (local_err);@@ -1833,8 +1817,10 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition, &payload.object);break ;case VHOST_USER_BACKEND_SHARED_OBJECT_LOOKUP : - ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, ioc, - &hdr, &payload); +/* The backend always expects a response */ + reply_ack = true; + ret =vhost_user_backend_handle_shared_object_lookup (dev->opaque, + &payload.object);break ;default :error_report ("Received unexpected msg type: %d." , hdr.request);@@ -1845,7 +1831,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCondition condition,* REPLY_ACK feature handling. Other reply types has to be managed * directly in their request handlers. */ -if (hdr.flags &VHOST_USER_NEED_REPLY_MASK ) { +if (reply_ack) { payload.u64 = !!ret; hdr.size =sizeof (payload.u64); --MST
Michael S. Tsirkin
maintainer[PULL 09/14] tests/qtest/bios-tables-test: Prepare for _DSM change in the DSDT table
In reply to Michael S. TsirkinFrom: Shameer Kolothum <[email protected]>
Subsequent patch will fix the GPEX _DSM method. Add the affected DSDT blobs to allowed-diff list for bios-table tests.
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +16 -0
@@ -1 +1,17 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/aarch64/virt/DSDT" , +"tests/data/acpi/aarch64/virt/DSDT.acpihmatvirt" , +"tests/data/acpi/aarch64/virt/DSDT.memhp" , +"tests/data/acpi/aarch64/virt/DSDT.pxb" , +"tests/data/acpi/aarch64/virt/DSDT.topology" , +"tests/data/acpi/aarch64/virt/DSDT.acpipcihp" , +"tests/data/acpi/aarch64/virt/DSDT.hpoffacpiindex" , +"tests/data/acpi/aarch64/virt/DSDT.viot" , +"tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy" , +"tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev" , +"tests/data/acpi/riscv64/virt/DSDT" , +"tests/data/acpi/loongarch64/virt/DSDT" , +"tests/data/acpi/loongarch64/virt/DSDT.topology" , +"tests/data/acpi/loongarch64/virt/DSDT.numamem" , +"tests/data/acpi/loongarch64/virt/DSDT.memhp" , +"tests/data/acpi/x86/microvm/DSDT.pcie",
Signature · 1 line
MST
Michael S. Tsirkin
maintainer[PULL 11/14] tests/qtest/bios-tables-test: Update DSDT blobs after GPEX _DSM change
In reply to Michael S. TsirkinFrom: Shameer Kolothum <[email protected]>
Update the reference DSDT blobs after GPEX _DSM change. This affects the aarch64 'virt', riscv64 "virt", loongarch64 "virt" and the x86 'microvm' machines.
DSDT diff is the same for all the machines/tests:
/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20230628 (64-bit version)
* Copyright (c) 2000 - 2023 Intel Corporation
*
* Disassembling to symbolic ASL+ operators
*
- * Disassembly of tests/data/acpi/aarch64/virt/DSDT, Fri Oct 10 11:18:21 2025
+ * Disassembly of /tmp/aml-E6V9D3, Fri Oct 10 11:18:21 2025
*
* Original Table Header:
* Signature "DSDT"
* Length 0x000014D9 (5337)
* Revision 0x02
- * Checksum 0xA4
+ * Checksum 0xA5
* OEM ID "BOCHS "
* OEM Table ID "BXPC "
* OEM Revision 0x00000001 (1)
* Compiler ID "BXPC"
* Compiler Version 0x00000001 (1)
*/
DefinitionBlock ("", "DSDT", 2, "BOCHS ", "BXPC ", 0x00000001)
{
Scope (\_SB)
{
Device (C000)
{
Name (_HID, "ACPI0007" /* Processor Device */) // _HID: Hardware ID Name (_UID, Zero) // _UID: Unique ID
}
@@ -1822,33 +1822,33 @@
Else
{
CDW1 |= 0x04
}
Return (Arg3)
}
Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method
{
If ((Arg0 == ToUUID ("e5c937d0-3553-4d7a-9117-ea4d19c3434d") /* Device Labeling Interface */)) {
If ((Arg2 == Zero))
{
Return (Buffer (One)
{
- 0x01 // .
+ 0x00 // .
})
}
}
Return (Buffer (One)
{
0x00 // . })
}
Device (RES0)
{
Name (_HID, "PNP0C02" /* PNP Motherboard Resources */) // _HID: Hardware ID Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 16 ---------------- tests/data/acpi/aarch64/virt/DSDT | Bin 5337 -> 5337 bytes .../data/acpi/aarch64/virt/DSDT.acpihmatvirt | Bin 5423 -> 5423 bytes tests/data/acpi/aarch64/virt/DSDT.acpipcihp | Bin 6246 -> 6246 bytes .../acpi/aarch64/virt/DSDT.hpoffacpiindex | Bin 5391 -> 5391 bytes tests/data/acpi/aarch64/virt/DSDT.memhp | Bin 6698 -> 6698 bytes tests/data/acpi/aarch64/virt/DSDT.pxb | Bin 7812 -> 7812 bytes tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev | Bin 10274 -> 10274 bytes .../data/acpi/aarch64/virt/DSDT.smmuv3-legacy | Bin 10274 -> 10274 bytes tests/data/acpi/aarch64/virt/DSDT.topology | Bin 5539 -> 5539 bytes tests/data/acpi/aarch64/virt/DSDT.viot | Bin 5354 -> 5354 bytes tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4603 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5824 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4609 bytes .../data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4905 bytes tests/data/acpi/riscv64/virt/DSDT | Bin 3538 -> 3538 bytes tests/data/acpi/x86/microvm/DSDT.pcie | Bin 2985 -> 2985 bytes 17 files changed, 16 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -16
@@ -1,17 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/aarch64/virt/DSDT" , -"tests/data/acpi/aarch64/virt/DSDT.acpihmatvirt" , -"tests/data/acpi/aarch64/virt/DSDT.memhp" , -"tests/data/acpi/aarch64/virt/DSDT.pxb" , -"tests/data/acpi/aarch64/virt/DSDT.topology" , -"tests/data/acpi/aarch64/virt/DSDT.acpipcihp" , -"tests/data/acpi/aarch64/virt/DSDT.hpoffacpiindex" , -"tests/data/acpi/aarch64/virt/DSDT.viot" , -"tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy" , -"tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev" , -"tests/data/acpi/riscv64/virt/DSDT" , -"tests/data/acpi/loongarch64/virt/DSDT" , -"tests/data/acpi/loongarch64/virt/DSDT.topology" , -"tests/data/acpi/loongarch64/virt/DSDT.numamem" , -"tests/data/acpi/loongarch64/virt/DSDT.memhp" , -"tests/data/acpi/x86/microvm/DSDT.pcie",
tests/data/acpi/aarch64/virt/DSDT binary +0 -0
tests/data/acpi/aarch64/virt/DSDT.acpihmatvirt binary +0 -0
tests/data/acpi/aarch64/virt/DSDT.acpipcihp binary +0 -0
tests/data/acpi/aarch64/virt/DSDT.hpoffacpiindex binary +0 -0
tests/data/acpi/aarch64/virt/DSDT.memhp binary +0 -0
tests/data/acpi/aarch64/virt/DSDT.pxb binary +0 -0
tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev binary +0 -0
tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy binary +0 -0
tests/data/acpi/aarch64/virt/DSDT.topology binary +0 -0
tests/data/acpi/aarch64/virt/DSDT.viot binary +0 -0
tests/data/acpi/loongarch64/virt/DSDT binary +0 -0
tests/data/acpi/loongarch64/virt/DSDT.memhp binary +0 -0
tests/data/acpi/loongarch64/virt/DSDT.numamem binary +0 -0
tests/data/acpi/loongarch64/virt/DSDT.topology binary +0 -0
tests/data/acpi/riscv64/virt/DSDT binary +0 -0
tests/data/acpi/x86/microvm/DSDT.pcie binary +0 -0
Signature · 1 line
MST
Richard Henderson
AppliedQuoted 12 lines · Michael S. Tsirkin
The following changes since commit
917ac07f9aef579b9538a81d45f45850aba42906:Merge tag 'for-upstream' ofhttps://gitlab.com/bonzini/qemu into staging (2025-11-05 16:07:18 +0100)are available in the Git repository at:
https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to
97f24a0496be9e0a7216fea1fa0d54c1db9066e2:
vhost-user.rst: clarify when FDs can be sent (2025-11-09 08:25:53 -0500)
Quoted 7 lines
----------------------------------------------------------------
virtio,pci,pc: fixes for 10.2small fixes all over the place.
UDP tunnel and TSEG tweaks are kind of borderline, but I feel not making the change now will just add to compatibility headaches down the road.
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.
r~
Michael S. Tsirkin
maintainerQuoted 15 lines · Michael S. Tsirkin
The following changes since commit
917ac07f9aef579b9538a81d45f45850aba42906:Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2025-11-05 16:07:18 +0100)
are available in the Git repository at:
https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to
97f24a0496be9e0a7216fea1fa0d54c1db9066e2:
vhost-user.rst: clarify when FDs can be sent (2025-11-09 08:25:53 -0500)----------------------------------------------------------------
virtio,pci,pc: fixes for 10.2
Quoted 8 lines
small fixes all over the place.
UDP tunnel and TSEG tweaks are kind of borderline, but I feel not making the change now will just add to compatibility headaches down the road.Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Is there any issue with this pull request?
Just making sure these fixes have not been lost.
Quoted 66 lines
Albert Esteve (1):
vhost-user: fix shared object lookup handler logicAlejandro Jimenez (1):
MAINTAINERS: Update entry for AMD-Vi EmulationAlyssa Ross (1):
vhost-user.rst: clarify when FDs can be sentEric Auger (1):
hw/pci-host/gpex-acpi: Fix_DSMfunction 0 support return valueGerd Hoffmann (1):
q35: increase default tseg sizeGerman Maglione (1):
vhost-user: makevhost_set_vring_file()synchronousPaolo Abeni (1):
virtio-net: Advertise UDP tunnel GSO support by defaultSairaj Kodilkar (2):
amd_iommu: Fix handling of devices on buses != 0
amd_iommu: Support 64-bit address for IOTLB lookupShameer Kolothum (2):
tests/qtest/bios-tables-test: Prepare for_DSMchange in the DSDT table tests/qtest/bios-tables-test: Update DSDT blobs after GPEX_DSMchangeZhenzhong Duan (3):
intel_iommu: Handle PASID cache invalidation
intel_iommu: Reset pasid cache when system level reset
intel_iommu: Fix DMA failure when guest switches IOMMU domainhw/i386/amd_iommu.h | 6 +- hw/i386/intel_iommu_internal.h | 17 +++ include/hw/i386/intel_iommu.h | 6 + hw/core/machine.c | 4 + hw/i386/amd_iommu.c | 179 +++++++++++++--------- hw/i386/intel_iommu.c | 181 +++++++++++++++++++++-- hw/i386/pc.c | 4 +- hw/net/virtio-net.c | 8 +- hw/pci-host/gpex-acpi.c | 2 +- hw/pci-host/q35.c | 2 +- hw/virtio/vhost-user.c | 64 ++++---- MAINTAINERS | 6 +- docs/interop/vhost-user.rst | 7 + hw/i386/trace-events | 4 + tests/data/acpi/aarch64/virt/DSDT | Bin 5337 -> 5337 bytes tests/data/acpi/aarch64/virt/DSDT.acpihmatvirt | Bin 5423 -> 5423 bytes tests/data/acpi/aarch64/virt/DSDT.acpipcihp | Bin 6246 -> 6246 bytes tests/data/acpi/aarch64/virt/DSDT.hpoffacpiindex | Bin 5391 -> 5391 bytes tests/data/acpi/aarch64/virt/DSDT.memhp | Bin 6698 -> 6698 bytes tests/data/acpi/aarch64/virt/DSDT.pxb | Bin 7812 -> 7812 bytes tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev | Bin 10274 -> 10274 bytes tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy | Bin 10274 -> 10274 bytes tests/data/acpi/aarch64/virt/DSDT.topology | Bin 5539 -> 5539 bytes tests/data/acpi/aarch64/virt/DSDT.viot | Bin 5354 -> 5354 bytes tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4603 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5824 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4609 bytes tests/data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4905 bytes tests/data/acpi/riscv64/virt/DSDT | Bin 3538 -> 3538 bytes tests/data/acpi/x86/microvm/DSDT.pcie | Bin 2985 -> 2985 bytes 30 files changed, 371 insertions(+), 119 deletions(-)
Quoted 22 lines · Michael S. Tsirkin
Quoted 20 lines · Michael S. Tsirkin
The following changes since commit
917ac07f9aef579b9538a81d45f45850aba42906:Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2025-11-05 16:07:18 +0100)
are available in the Git repository at:
https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to
97f24a0496be9e0a7216fea1fa0d54c1db9066e2:
vhost-user.rst: clarify when FDs can be sent (2025-11-09 08:25:53 -0500)----------------------------------------------------------------
virtio,pci,pc: fixes for 10.2small fixes all over the place.
UDP tunnel and TSEG tweaks are kind of borderline, but I feel not making the change now will just add to compatibility headaches down the road.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Is there any issue with this pull request?
Just making sure these fixes have not been lost.
They were merged last week (merge commit 593aee5df98b4a862).
-- PMM