qemu-e2k/include
Leonardo Bras 2bc58ffc29 QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX
For CONFIG_LINUX, implement the new zero copy flag and the optional callback
io_flush on QIOChannelSocket, but enables it only when MSG_ZEROCOPY
feature is available in the host kernel, which is checked on
qio_channel_socket_connect_sync()

qio_channel_socket_flush() was implemented by counting how many times
sendmsg(...,MSG_ZEROCOPY) was successfully called, and then reading the
socket's error queue, in order to find how many of them finished sending.
Flush will loop until those counters are the same, or until some error occurs.

Notes on using writev() with QIO_CHANNEL_WRITE_FLAG_ZERO_COPY:
1: Buffer
- As MSG_ZEROCOPY tells the kernel to use the same user buffer to avoid copying,
some caution is necessary to avoid overwriting any buffer before it's sent.
If something like this happen, a newer version of the buffer may be sent instead.
- If this is a problem, it's recommended to call qio_channel_flush() before freeing
or re-using the buffer.

2: Locked memory
- When using MSG_ZERCOCOPY, the buffer memory will be locked after queued, and
unlocked after it's sent.
- Depending on the size of each buffer, and how often it's sent, it may require
a larger amount of locked memory than usually available to non-root user.
- If the required amount of locked memory is not available, writev_zero_copy
will return an error, which can abort an operation like migration,
- Because of this, when an user code wants to add zero copy as a feature, it
requires a mechanism to disable it, so it can still be accessible to less
privileged users.

Signed-off-by: Leonardo Bras <leobras@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20220513062836.965425-4-leobras@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2022-05-16 13:56:24 +01:00
..
authz Prefer 'on' | 'off' over 'yes' | 'no' for bool options 2021-01-29 17:07:53 +00:00
block nbd/server: Allow MULTI_CONN for shared writable exports 2022-05-12 13:10:52 +02:00
chardev Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
crypto Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
disas disas: Remove old libopcode ppc disassembler 2022-05-09 08:21:05 +02:00
exec Clean up decorations and whitespace around header guards 2022-05-11 16:50:32 +02:00
fpu Clean up decorations and whitespace around header guards 2022-05-11 16:50:32 +02:00
hw machine: make memory-backend a link property 2022-05-12 12:29:44 +02:00
io QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX 2022-05-16 13:56:24 +01:00
libdecnumber Replace config-time define HOST_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
migration migration: Remove load_state_old and minimum_version_id_old 2022-03-02 18:20:45 +00:00
monitor Move error_printf_unless_qmp() with monitor unit 2022-04-21 17:09:09 +04:00
net Replace config-time define HOST_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
qapi include: move qdict_{crumple,flatten} declarations 2022-04-21 17:03:51 +04:00
qemu * small cleanups for pc-bios/optionrom Makefiles 2022-05-12 10:52:15 -07:00
qom compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATED 2022-03-22 14:40:51 +04:00
scsi scsi: inline sg_io_sense_from_errno() into the callers. 2021-03-06 11:42:56 +01:00
semihosting semihosting: Move include/hw/semihosting/ -> include/semihosting/ 2021-03-10 15:34:12 +00:00
standard-headers linux-headers: Update to v5.18-rc6 2022-05-13 08:20:11 -06:00
sysemu machine: use QAPI struct for boot configuration 2022-05-12 12:29:43 +02:00
tcg Normalize header guard symbol definition 2022-05-11 16:50:26 +02:00
ui Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
user Clean up decorations and whitespace around header guards 2022-05-11 16:50:32 +02:00
elf.h elf: Add machine type value for LoongArch 2021-12-21 13:17:06 -08:00
glib-compat.h compiler.h: replace QEMU_NORETURN with G_NORETURN 2022-04-21 17:03:51 +04:00
qemu-io.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
qemu-main.h Simplify softmmu/main.c 2022-04-21 16:56:55 +04:00