All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 0/5] MSG_ZEROCOPY + multifd
@ 2022-01-06 22:13 Leonardo Bras
  2022-01-06 22:13 ` [PATCH v7 1/5] QIOChannel: Add flags on io_writev and introduce io_flush callback Leonardo Bras
                   ` (4 more replies)
  0 siblings, 5 replies; 40+ messages in thread
From: Leonardo Bras @ 2022-01-06 22:13 UTC (permalink / raw)
  To: Daniel P. Berrangé,
	Juan Quintela, Dr. David Alan Gilbert, Eric Blake,
	Markus Armbruster, Peter Xu
  Cc: Leonardo Bras, qemu-devel

This patch series intends to enable MSG_ZEROCOPY in QIOChannel, and make
use of it for multifd migration performance improvement, by reducing cpu
usage.

Patch #1 creates new callbacks for QIOChannel, allowing the implementation
of zero copy writing.

Patch #2 implements io_writev flags and io_flush() on QIOChannelSocket,
making use of MSG_ZEROCOPY on Linux.

Patch #3 adds a "zero_copy" migration property, only available with
CONFIG_LINUX, and compiled-out in any other architectures.
This migration property has to be enabled before multifd migration starts.

Patch #4 adds a helper function that allows to see if TLS is going to be used.
This helper will be later used in patch #5.

Patch #5 Makes use of QIOChannelSocket zero_copy implementation on
nocomp multifd migration.

Results:
In preliminary tests, the resource usage of __sys_sendmsg() reduced 15 times,
and the overall migration took 13-22% less time, based in synthetic cpu
workload.

In further tests, it was noted that, on multifd migration with 8 channels:
- On idle hosts, migration time reduced in 10% to 21%.
- On hosts busy with heavy cpu stress (1 stress thread per cpu, but
  not cpu-pinned) migration time reduced in ~25% by enabling zero-copy.
- On hosts with heavy cpu-pinned workloads (1 stress thread per cpu, 
  cpu-pinned), migration time reducted in ~66% by enabling zero-copy.

Above tests setup:
- Sending and Receiving hosts:
  - CPU : Intel(R) Xeon(R) Platinum 8276L CPU @ 2.20GHz (448 CPUS)
  - Network card: E810-C (100Gbps)
  - >1TB RAM
  - QEMU: Upstream master branch + This patchset
  - Linux: Upstream v5.15 
- VM configuration:
  - 28 VCPUs
  - 512GB RAM


---
Changes since v6:
- Remove io_writev_zero_copy(), and makes use of io_writev() new flags
  to achieve the same results.
- Rename io_flush_zero_copy() to io_flush()
- Previous patch #2 became too small, so it was squashed in previous
  patch #3 (now patch #2)

Changes since v5:
- flush_zero_copy now returns -1 on fail, 0 on success, and 1 when all
  processed writes were not able to use zerocopy in kernel.
- qio_channel_socket_poll() removed, using qio_channel_wait() instead
- ENOBUFS is now processed inside qio_channel_socket_writev_flags()
- Most zerocopy parameter validation moved to migrate_params_check(),
  leaving only feature test to socket_outgoing_migration() callback
- Naming went from *zerocopy to *zero_copy or *zero-copy, due to QAPI/QMP
  preferences
- Improved docs

Changes since v4:
- 3 patches got splitted in 6
- Flush is used for syncing after each iteration, instead of only at the end
- If zerocopy is not available, fail in connect instead of failing on write
- 'multifd-zerocopy' property renamed to 'zerocopy'
- Fail migrations that don't support zerocopy, if it's enabled.
- Instead of checking for zerocopy at each write, save the flags in
  MultiFDSendParams->write_flags and use them on write
- Reorganized flag usage in QIOChannelSocket 
- A lot of typos fixed
- More doc on buffer restrictions

Changes since v3:
- QIOChannel interface names changed from io_async_{writev,flush} to
  io_{writev,flush}_zerocopy
- Instead of falling back in case zerocopy is not implemented, return
  error and abort operation.
- Flush now waits as long as needed, or return error in case anything
  goes wrong, aborting the operation.
- Zerocopy is now conditional in multifd, being set by parameter
  multifd-zerocopy
- Moves zerocopy_flush to multifd_send_sync_main() from multifd_save_cleanup
  so migration can abort if flush goes wrong.
- Several other small improvements

Changes since v2:
- Patch #1: One more fallback
- Patch #2: Fall back to sync if fails to lock buffer memory in MSG_ZEROCOPY send.

Changes since v1:
- Reimplemented the patchset using async_write + async_flush approach.
- Implemented a flush to be able to tell whenever all data was written.


Leonardo Bras (5):
  QIOChannel: Add flags on io_writev and introduce io_flush callback
  QIOChannelSocket: Implement io_writev zero copy flag & io_flush for
    CONFIG_LINUX
  migration: Add zero-copy parameter for QMP/HMP for Linux
  migration: Add migrate_use_tls() helper
  multifd: Implement zero copy write in multifd migration
    (multifd-zero-copy)

 qapi/migration.json         |  24 ++++++++
 include/io/channel-socket.h |   2 +
 include/io/channel.h        |  67 +++++++++++++++++-----
 migration/migration.h       |   6 ++
 migration/multifd.h         |   4 +-
 io/channel-buffer.c         |   1 +
 io/channel-command.c        |   1 +
 io/channel-file.c           |   1 +
 io/channel-socket.c         | 109 ++++++++++++++++++++++++++++++++++--
 io/channel-tls.c            |   1 +
 io/channel-websock.c        |   1 +
 io/channel.c                |  51 ++++++++++++-----
 migration/channel.c         |   6 +-
 migration/migration.c       |  52 ++++++++++++++++-
 migration/multifd.c         |  45 ++++++++++++---
 migration/ram.c             |  29 +++++++---
 migration/rdma.c            |   1 +
 migration/socket.c          |   6 ++
 monitor/hmp-cmds.c          |   6 ++
 19 files changed, 360 insertions(+), 53 deletions(-)

-- 
2.34.1




^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2022-02-21 16:33 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 22:13 [PATCH v7 0/5] MSG_ZEROCOPY + multifd Leonardo Bras
2022-01-06 22:13 ` [PATCH v7 1/5] QIOChannel: Add flags on io_writev and introduce io_flush callback Leonardo Bras
2022-01-13  6:28   ` Peter Xu
2022-01-18 20:45     ` Leonardo Bras Soares Passos
2022-01-19  1:58       ` Peter Xu
2022-01-19 18:29         ` Leonardo Bras Soares Passos
2022-01-13 10:52   ` Daniel P. Berrangé
2022-01-19  4:38     ` Leonardo Bras Soares Passos
2022-01-06 22:13 ` [PATCH v7 2/5] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX Leonardo Bras
2022-01-13  6:48   ` Peter Xu
2022-01-13 10:06     ` Daniel P. Berrangé
2022-01-13 10:34       ` Peter Xu
2022-01-13 10:42         ` Daniel P. Berrangé
2022-01-13 12:12           ` Peter Xu
2022-01-19 17:23             ` Leonardo Bras Soares Passos
2022-01-19 17:22           ` Leonardo Bras Soares Passos
2022-01-20  1:28             ` Peter Xu
2022-01-19 17:16         ` Leonardo Bras Soares Passos
2022-01-19 17:01     ` Leonardo Bras Soares Passos
2022-02-01  4:23     ` Leonardo Bras Soares Passos
2022-01-13 13:05   ` Daniel P. Berrangé
2022-01-19 17:24     ` Leonardo Bras Soares Passos
2022-01-06 22:13 ` [PATCH v7 3/5] migration: Add zero-copy parameter for QMP/HMP for Linux Leonardo Bras
2022-01-13  7:00   ` Peter Xu
2022-01-19 17:53     ` Leonardo Bras Soares Passos
2022-01-13 13:09   ` Daniel P. Berrangé
2022-01-19 18:03     ` Leonardo Bras Soares Passos
2022-01-19 18:15       ` Daniel P. Berrangé
2022-01-19 18:46         ` Leonardo Bras Soares Passos
2022-02-18 16:31           ` Juan Quintela
2022-02-21 16:23             ` Leonardo Bras Soares Passos
2022-01-06 22:13 ` [PATCH v7 4/5] migration: Add migrate_use_tls() helper Leonardo Bras
2022-01-13  7:02   ` Peter Xu
2022-01-19 18:06     ` Leonardo Bras Soares Passos
2022-01-20  1:37       ` Peter Xu
2022-01-13 13:10   ` Daniel P. Berrangé
2022-01-19 18:07     ` Leonardo Bras Soares Passos
2022-01-06 22:13 ` [PATCH v7 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy) Leonardo Bras
2022-01-13  7:15   ` Peter Xu
2022-01-19 18:23     ` Leonardo Bras Soares Passos

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.