qemu-cr16/include/io
Manish Mishra 84005f4a2b io: flush zerocopy socket error queue on sendmsg failure due to ENOBUF
The kernel allocates extra metadata SKBs in case of a zerocopy send,
eventually used for zerocopy's notification mechanism. This metadata
memory is accounted for in the OPTMEM limit. The kernel queues
completion notifications on the socket error queue and this error queue
is freed when userspace reads it.

Usually, in the case of in-order processing, the kernel will batch the
notifications and merge the metadata into a single SKB and free the
rest. As a result, it never exceeds the OPTMEM limit. However, if there
is any out-of-order processing or intermittent zerocopy failures, this
error chain can grow significantly, exhausting the OPTMEM limit. As a
result, all new sendmsg requests fail to allocate any new SKB, leading
to an ENOBUF error. Depending on the amount of data queued before the
flush (i.e., large live migration iterations), even large OPTMEM limits
are prone to failure.

To work around this, if we encounter an ENOBUF error with a zerocopy
sendmsg, flush the error queue and retry once more.

Co-authored-by: Manish Mishra <manish.mishra@nutanix.com>
Signed-off-by: Tejus GK <tejus.gk@nutanix.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
[DB: change TRUE/FALSE to true/false for 'bool' type;
     add more #ifdef QEMU_MSG_ZEROCOPY blocks]
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2025-11-03 10:45:28 +00:00
..
channel-buffer.h io: Fix Lesser GPL version number 2020-10-27 16:48:49 +01:00
channel-command.h io/command: implement support for win32 2022-10-12 19:22:01 +04:00
channel-file.h io: Introduce qio_channel_file_new_dupfd 2024-03-12 15:22:23 -04:00
channel-null.h io: add a QIOChannelNull equivalent to /dev/null 2022-06-22 18:11:21 +01:00
channel-socket.h io: flush zerocopy socket error queue on sendmsg failure due to ENOBUF 2025-11-03 10:45:28 +00:00
channel-tls.h io: tls: Add qio_channel_tls_bye 2025-02-14 15:19:03 -03:00
channel-util.h io: follow coroutine AioContext in qio_channel_yield() 2023-09-07 20:32:11 -05:00
channel-watch.h io: Fix Lesser GPL version number 2020-10-27 16:48:49 +01:00
channel-websock.h io: fix use after free in websocket handshake code 2025-10-24 13:04:31 +01:00
channel.h io/channel: Have read/write functions take void * buffer argument 2025-11-03 10:05:40 +00:00
dns-resolver.h io: Fix Lesser GPL version number 2020-10-27 16:48:49 +01:00
net-listener.h qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros 2020-09-18 14:12:32 -04:00
task.h Rename "QEMU global mutex" to "BQL" in comments and docs 2024-01-08 10:45:43 -05:00