[PATCH v8 0/5] MSG_ZEROCOPY + multifd

2022-01-31 Thread Leonardo Bras
mplemented 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-send parameter for

[PATCH v8 2/5] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-01-31 Thread Leonardo Bras
nism to disable it, so it can still be accessible to less privileged users. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé --- include/io/channel-socket.h | 2 + io/channel-socket.c | 108 ++-- 2 files changed, 106 i

[PATCH v8 1/5] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-01-31 Thread Leonardo Bras
flags. Signed-off-by: Leonardo Bras --- include/io/channel.h| 38 - chardev/char-io.c | 2 +- hw/remote/mpqemu-link.c | 2 +- io/channel-buffer.c | 1 + io/channel-command.c| 1 + io/channel-f

[PATCH v8 3/5] migration: Add zero-copy-send parameter for QMP/HMP for Linux

2022-01-31 Thread Leonardo Bras
. On non-Linux builds this parameter is compiled-out. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé --- qapi/migration.json | 24 migration/migration.h | 5 + migration/migration.c | 32 migr

[PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-01-31 Thread Leonardo Bras
with zero-copy enabled, so disabling the feature should be necessary for low-privileged users trying to perform multifd migrations. Signed-off-by: Leonardo Bras --- migration/multifd.h | 4 +++- migration/migration.c | 11 ++- migration/multifd.c

[PATCH v8 4/5] migration: Add migrate_use_tls() helper

2022-01-31 Thread Leonardo Bras
A lot of places check parameters.tls_creds in order to evaluate if TLS is in use, and sometimes call migrate_get_current() just for that test. Add new helper function migrate_use_tls() in order to simplify testing for TLS usage. Signed-off-by: Leonardo Bras Reviewed-by: Juan Quintela Reviewed

[PATCH v1 0/3] QIOChannel flags + multifd zerocopy

2021-08-31 Thread Leonardo Bras
ltifd. Results: So far, the resource usage of __sys_sendmsg() reduced 15 times, and the overall migration took 13-18% less time, based in synthetic workload. The objective is to reduce migration time in hosts with heavy cpu usage. Leonardo Bras (3): io: Enable write flags for QIOChannel io

[PATCH v1 2/3] io: Add zerocopy and errqueue

2021-08-31 Thread Leonardo Bras
that would benefit of zerocopy; Step 3 is done with qio_channel_socket_errq_proc(), that runs after SOCKET_ERRQ_THRESH (16k) iovs sent, dealing with any error found. Signed-off-by: Leonardo Bras --- include/io/channel-socket.h | 2 + include/io/channel.h| 29 ++ io/channe

[PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-08-31 Thread Leonardo Bras
approach. Signed-off-by: Leonardo Bras --- migration/multifd-zlib.c | 7 --- migration/multifd-zstd.c | 7 --- migration/multifd.c | 9 ++--- migration/multifd.h | 3 ++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/migration/multifd-zlib.c b/migration

[PATCH v1 1/3] io: Enable write flags for QIOChannel

2021-08-31 Thread Leonardo Bras
abled for QIOChannelSocket, but can be easily extended to any other QIOChannel implementation. Signed-off-by: Leonardo Bras --- chardev/char-io.c | 2 +- hw/remote/mpqemu-link.c | 2 +- include/io/channel.h| 56 - io/ch

[PATCH v9 0/7] MSG_ZEROCOPY + multifd

2022-04-25 Thread Leonardo Bras
- Implemented a flush to be able to tell whenever all data was written. Leonardo Bras (7): 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-send parameter

[PATCH v9 1/7] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-04-25 Thread Leonardo Bras
flags. Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé Reviewed-by: Peter Xu Reviewed-by: Juan Quintela --- include/io/channel.h| 38 +- chardev/char-io.c | 2 +- hw/remote/mpqemu-link.c | 2 +- io/channel-buf

[PATCH v9 3/7] migration: Add zero-copy-send parameter for QMP/HMP for Linux

2022-04-25 Thread Leonardo Bras
. On non-Linux builds this parameter is compiled-out. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela --- qapi/migration.json | 24 migration/migration.h | 5 + migration/migration.c

[PATCH v9 2/7] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-04-25 Thread Leonardo Bras
nism to disable it, so it can still be accessible to less privileged users. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela --- include/io/channel-socket.h | 2 + io/channel-socket.c | 108 +

[PATCH v9 7/7] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-04-25 Thread Leonardo Bras
tion with zero-copy enabled, so disabling the feature should be necessary for low-privileged users trying to perform multifd migrations. Signed-off-by: Leonardo Bras --- migration/multifd.h | 2 ++ migration/migration.c | 11 ++- migration/multifd.c

[PATCH v9 5/7] multifd: multifd_send_sync_main now returns negative on error

2022-04-25 Thread Leonardo Bras
(This change is important to next patch on multifd zero copy implementation, to make it sure an error in zero-copy flush does not go unnoticed. Signed-off-by: Leonardo Bras --- migration/multifd.h | 2 +- migration/multifd.c | 10 ++ migration/ram.c | 29 ++---

[PATCH v9 6/7] multifd: Send header packet without flags if zero-copy-send is enabled

2022-04-25 Thread Leonardo Bras
happening before. This only changes how a migration with zero-copy-send=true works, not changing any current behavior for migrations with zero-copy-send=false. Signed-off-by: Leonardo Bras --- migration/multifd.c | 29 ++--- 1 file changed, 26 insertions(+), 3 deletions(-) di

[PATCH v9 4/7] migration: Add migrate_use_tls() helper

2022-04-25 Thread Leonardo Bras
A lot of places check parameters.tls_creds in order to evaluate if TLS is in use, and sometimes call migrate_get_current() just for that test. Add new helper function migrate_use_tls() in order to simplify testing for TLS usage. Signed-off-by: Leonardo Bras Reviewed-by: Juan Quintela Reviewed

[PATCH v10 0/7] MSG_ZEROCOPY + multifd

2022-04-26 Thread Leonardo Bras
uffer 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 (7): QIOChannel: Add flags on io_writev and introduce io_flush callback QIOChannelSoc

[PATCH v10 1/7] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-04-26 Thread Leonardo Bras
flags. Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé Reviewed-by: Peter Xu Reviewed-by: Juan Quintela --- include/io/channel.h| 38 +- chardev/char-io.c | 2 +- hw/remote/mpqemu-link.c | 2 +- io/channel-buf

[PATCH v10 2/7] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-04-26 Thread Leonardo Bras
nism to disable it, so it can still be accessible to less privileged users. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela --- include/io/channel-socket.h | 2 + io/channel-socket.c | 108 +

[PATCH v10 3/7] migration: Add zero-copy-send parameter for QMP/HMP for Linux

2022-04-26 Thread Leonardo Bras
. On non-Linux builds this parameter is compiled-out. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela --- qapi/migration.json | 24 migration/migration.h | 5 + migration/migration.c

[PATCH v10 6/7] multifd: Send header packet without flags if zero-copy-send is enabled

2022-04-26 Thread Leonardo Bras
happening before. This only changes how a migration with zero-copy-send=true works, not changing any current behavior for migrations with zero-copy-send=false. Signed-off-by: Leonardo Bras --- migration/multifd.c | 23 --- 1 file changed, 20 insertions(+), 3 deletions(-) di

[PATCH v10 7/7] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-04-26 Thread Leonardo Bras
tion with zero-copy enabled, so disabling the feature should be necessary for low-privileged users trying to perform multifd migrations. Signed-off-by: Leonardo Bras --- migration/multifd.h | 2 ++ migration/migration.c | 11 ++- migration/multifd.c

[PATCH v10 5/7] multifd: multifd_send_sync_main now returns negative on error

2022-04-26 Thread Leonardo Bras
(This change is important to next patch on multifd zero copy implementation, to make it sure an error in zero-copy flush does not go unnoticed. Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé Reviewed-by: Peter Xu --- migration/multifd.h | 2 +- migration/multifd.c | 10 ++

[PATCH v10 4/7] migration: Add migrate_use_tls() helper

2022-04-26 Thread Leonardo Bras
A lot of places check parameters.tls_creds in order to evaluate if TLS is in use, and sometimes call migrate_get_current() just for that test. Add new helper function migrate_use_tls() in order to simplify testing for TLS usage. Signed-off-by: Leonardo Bras Reviewed-by: Juan Quintela Reviewed

[PATCH v11 3/7] migration: Add zero-copy-send parameter for QMP/HMP for Linux

2022-05-04 Thread Leonardo Bras
. On non-Linux builds this parameter is compiled-out. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela Acked-by: Markus Armbruster --- qapi/migration.json | 24 migration/migration.h | 5 + migr

[PATCH v11 4/7] migration: Add migrate_use_tls() helper

2022-05-04 Thread Leonardo Bras
A lot of places check parameters.tls_creds in order to evaluate if TLS is in use, and sometimes call migrate_get_current() just for that test. Add new helper function migrate_use_tls() in order to simplify testing for TLS usage. Signed-off-by: Leonardo Bras Reviewed-by: Juan Quintela Reviewed

[PATCH v11 5/7] multifd: multifd_send_sync_main now returns negative on error

2022-05-04 Thread Leonardo Bras
(This change is important to next patch on multifd zero copy implementation, to make it sure an error in zero-copy flush does not go unnoticed. Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé Reviewed-by: Peter Xu --- migration/multifd.h | 2 +- migration/multifd.c | 10 ++

[PATCH v11 1/7] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-05-04 Thread Leonardo Bras
flags. Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé Reviewed-by: Peter Xu Reviewed-by: Juan Quintela --- include/io/channel.h| 38 +- chardev/char-io.c | 2 +- hw/remote/mpqemu-link.c | 2 +- io/channel-buf

[PATCH v11 0/7] MSG_ZEROCOPY + multifd

2022-05-04 Thread Leonardo Bras
rite + async_flush approach. - Implemented a flush to be able to tell whenever all data was written. Leonardo Bras (7): 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 z

[PATCH v11 2/7] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-05-04 Thread Leonardo Bras
nism to disable it, so it can still be accessible to less privileged users. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela --- include/io/channel-socket.h | 2 + io/channel-socket.c | 120 +

[PATCH v11 6/7] multifd: Send header packet without flags if zero-copy-send is enabled

2022-05-04 Thread Leonardo Bras
happening before. This only changes how a migration with zero-copy-send=true works, not changing any current behavior for migrations with zero-copy-send=false. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé --- migration/multifd.c | 22 +++-

[PATCH v11 7/7] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-05-04 Thread Leonardo Bras
tion with zero-copy enabled, so disabling the feature should be necessary for low-privileged users trying to perform multifd migrations. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé --- migration/multifd.h | 2 ++ migration/migration.c

[PATCH v12 0/7] MSG_ZEROCOPY + multifd

2022-05-06 Thread Leonardo Bras
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 (7): QIOC

[PATCH v12 2/7] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-05-06 Thread Leonardo Bras
nism to disable it, so it can still be accessible to less privileged users. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela --- include/io/channel-socket.h | 2 + io/channel-socket.c | 117 +

[PATCH v12 1/7] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-05-06 Thread Leonardo Bras
flags. Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé Reviewed-by: Peter Xu Reviewed-by: Juan Quintela --- include/io/channel.h| 38 +- chardev/char-io.c | 2 +- hw/remote/mpqemu-link.c | 2 +- io/channel-buf

[PATCH v12 5/7] multifd: multifd_send_sync_main now returns negative on error

2022-05-06 Thread Leonardo Bras
(This change is important to next patch on multifd zero copy implementation, to make it sure an error in zero-copy flush does not go unnoticed. Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé Reviewed-by: Peter Xu --- migration/multifd.h | 2 +- migration/multifd.c | 10 ++

[PATCH v12 3/7] migration: Add zero-copy-send parameter for QMP/HMP for Linux

2022-05-06 Thread Leonardo Bras
. On non-Linux builds this parameter is compiled-out. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela Acked-by: Markus Armbruster --- qapi/migration.json | 24 migration/migration.h | 5 + migr

[PATCH v12 4/7] migration: Add migrate_use_tls() helper

2022-05-06 Thread Leonardo Bras
A lot of places check parameters.tls_creds in order to evaluate if TLS is in use, and sometimes call migrate_get_current() just for that test. Add new helper function migrate_use_tls() in order to simplify testing for TLS usage. Signed-off-by: Leonardo Bras Reviewed-by: Juan Quintela Reviewed

[PATCH v12 6/7] multifd: Send header packet without flags if zero-copy-send is enabled

2022-05-06 Thread Leonardo Bras
happening before. This only changes how a migration with zero-copy-send=true works, not changing any current behavior for migrations with zero-copy-send=false. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé --- migration/multifd.c | 22 +++-

[PATCH v12 7/7] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-05-06 Thread Leonardo Bras
tion with zero-copy enabled, so disabling the feature should be necessary for low-privileged users trying to perform multifd migrations. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé --- migration/multifd.h | 2 ++ migration/migration.c

[PATCH v13 7/8] multifd: Send header packet without flags if zero-copy-send is enabled

2022-05-12 Thread Leonardo Bras
happening before. This only changes how a migration with zero-copy-send=true works, not changing any current behavior for migrations with zero-copy-send=false. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé --- migration/multifd.c | 22 +++-

[PATCH v13 1/8] meson.build: Fix docker-test-build@alpine when including linux/errqueue.h

2022-05-12 Thread Leonardo Bras
mmand failed === As above error message suggests, 'struct __kernel_timespec' was already defined by liburing/compat.h. Fix alpine CI by adding test to disable liburing in configure step if a redefinition happens between linux/errqueue.h and liburing/compat.h. Signed-off-by: Leonar

[PATCH v13 0/8] MSG_ZEROCOPY + multifd

2022-05-12 Thread Leonardo Bras
- 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 t

[PATCH v13 2/8] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-05-12 Thread Leonardo Bras
flags. Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé Reviewed-by: Peter Xu Reviewed-by: Juan Quintela --- include/io/channel.h| 38 +- chardev/char-io.c | 2 +- hw/remote/mpqemu-link.c | 2 +- io/channel-buf

[PATCH v13 4/8] migration: Add zero-copy-send parameter for QMP/HMP for Linux

2022-05-12 Thread Leonardo Bras
. On non-Linux builds this parameter is compiled-out. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela Acked-by: Markus Armbruster --- qapi/migration.json | 24 migration/migration.h | 5 + migr

[PATCH v13 3/8] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-05-12 Thread Leonardo Bras
nism to disable it, so it can still be accessible to less privileged users. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela --- include/io/channel-socket.h | 2 + io/channel-socket.c | 116 +

[PATCH v13 8/8] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-05-12 Thread Leonardo Bras
tion with zero-copy enabled, so disabling the feature should be necessary for low-privileged users trying to perform multifd migrations. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé --- migration/multifd.h | 2 ++ migration/migration.c

[PATCH v13 5/8] migration: Add migrate_use_tls() helper

2022-05-13 Thread Leonardo Bras
A lot of places check parameters.tls_creds in order to evaluate if TLS is in use, and sometimes call migrate_get_current() just for that test. Add new helper function migrate_use_tls() in order to simplify testing for TLS usage. Signed-off-by: Leonardo Bras Reviewed-by: Juan Quintela Reviewed

[PATCH v13 6/8] multifd: multifd_send_sync_main now returns negative on error

2022-05-13 Thread Leonardo Bras
(This change is important to next patch on multifd zero copy implementation, to make it sure an error in zero-copy flush does not go unnoticed. Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé Reviewed-by: Peter Xu --- migration/multifd.h | 2 +- migration/multifd.c | 10 ++

Re: [PATCH v8 1/5] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-02-01 Thread Leonardo Bras Soares Passos
Hello Daniel, thanks for reviewing! On Tue, Feb 1, 2022 at 6:35 AM Daniel P. Berrangé wrote: > > On Tue, Feb 01, 2022 at 03:28:59AM -0300, Leonardo Bras wrote: > > Add flags to io_writev and introduce io_flush as optional callback to > > QIOChannelClass, allowing the implement

Re: [PATCH v8 1/5] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-02-07 Thread Leonardo Bras Soares Passos
Hello Peter, On Mon, Feb 7, 2022 at 9:50 AM Peter Xu wrote: > > On Tue, Feb 01, 2022 at 03:28:59AM -0300, Leonardo Bras wrote: > > Add flags to io_writev and introduce io_flush as optional callback to > > QIOChannelClass, allowing the implementation of zero copy writes

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-02-07 Thread Leonardo Bras Soares Passos
Hello Peter, thanks for reviewing! On Mon, Feb 7, 2022 at 11:22 PM Peter Xu wrote: > > On Tue, Feb 01, 2022 at 03:29:03AM -0300, Leonardo Bras wrote: > > -void multifd_send_sync_main(QEMUFile *f) > > +int multifd_send_sync_main(QEMUFile *f) > > { > > int i;

Re: [PATCH v1 0/3] QIOChannel flags + multifd zerocopy

2021-09-01 Thread Leonardo Bras Soares Passos
Hello Peter, On Tue, Aug 31, 2021 at 6:24 PM Peter Xu wrote: > > On Tue, Aug 31, 2021 at 08:02:36AM -0300, Leonardo Bras wrote: > > Results: > > So far, the resource usage of __sys_sendmsg() reduced 15 times, and the > > overall migration took 13-18% less time, bas

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-01 Thread Leonardo Bras Soares Passos
Hello Daniel, thank you for the feedback! Comments inline. On Tue, Aug 31, 2021 at 9:57 AM Daniel P. Berrangé wrote: > > On Tue, Aug 31, 2021 at 08:02:38AM -0300, Leonardo Bras wrote: > > MSG_ZEROCOPY is a feature that enables copy avoidance in TCP/UDP socket > > send ca

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-01 Thread Leonardo Bras Soares Passos
Thanks for this feedback Peter! I ended up reading/replying the e-mails in thread order, so I may have been redundant with your argument, sorry about that. I will add my comments inline, but I will add references to the previous mail I sent Daniel, so please read it too. On Tue, Aug 31, 2021 at

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-02 Thread Leonardo Bras Soares Passos
Hello Daniel,. A few more comments: On Wed, Sep 1, 2021 at 5:51 AM Daniel P. Berrangé wrote: > > On Tue, Aug 31, 2021 at 04:27:04PM -0400, Peter Xu wrote: > > On Tue, Aug 31, 2021 at 01:57:33PM +0100, Daniel P. Berrangé wrote: > > > On Tue, Aug 31, 2021 at 08:02:38AM -0300

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
Hello Daniel, thanks for the feedback ! On Tue, Aug 31, 2021 at 10:17 AM Daniel P. Berrangé wrote: > > On Tue, Aug 31, 2021 at 08:02:39AM -0300, Leonardo Bras wrote: > > Call qio_channel_set_zerocopy(true) in the start of every multifd thread. > > > > Change the send_writ

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
Hello Peter, thank you for this feedback! On Tue, Aug 31, 2021 at 5:29 PM Peter Xu wrote: > Yes it would be great to be a migration capability in parallel to multifd. At > initial phase if it's easy to be implemented on multi-fd only, we can add a > dependency between the caps. In the future we

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
A few more comments on this one: On Wed, Sep 1, 2021 at 12:44 PM Daniel P. Berrangé wrote: > > > From the safe side we may want to only enable one of them until we prove > > they'll work together I guess.. > > MPTCP is good when we're network limited for migration > > KTLS will be good when we're

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
; On Tue, Aug 31, 2021 at 02:16:42PM +0100, Daniel P. Berrangé wrote: > >>>> On Tue, Aug 31, 2021 at 08:02:39AM -0300, Leonardo Bras wrote: > >>>>> Call qio_channel_set_zerocopy(true) in the start of every multifd > >>>>> thread. > >>>

Re: [PATCH v1 1/3] io: Enable write flags for QIOChannel

2021-09-02 Thread Leonardo Bras Soares Passos
Thanks for the feedback Eric! On Wed, Sep 1, 2021 at 5:54 PM Eric Blake wrote: > > On Tue, Aug 31, 2021 at 08:02:37AM -0300, Leonardo Bras wrote: > > Some syscalls used for writting, such as sendmsg(), accept flags that > > can modify their behavior, even allowing the usage o

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
On Thu, Sep 2, 2021 at 5:21 AM Daniel P. Berrangé wrote: > > On Thu, Sep 02, 2021 at 04:22:55AM -0300, Leonardo Bras Soares Passos wrote: > > Hello Daniel, thanks for the feedback ! > > > > On Tue, Aug 31, 2021 at 10:17 AM Daniel P. Berrangé > > wrote: > > &

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-02 Thread Leonardo Bras Soares Passos
On Thu, Sep 2, 2021 at 5:47 AM Daniel P. Berrangé wrote: > > On Thu, Sep 02, 2021 at 03:38:11AM -0300, Leonardo Bras Soares Passos wrote: > > Hello Daniel, thank you for the feedback! > > > > Comments inline. > > > > On Tue, Aug 31, 2021 at 9:57 AM Daniel P.

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
On Thu, Sep 2, 2021 at 6:20 AM Daniel P. Berrangé wrote: > > On Thu, Sep 02, 2021 at 05:52:15AM -0300, Leonardo Bras Soares Passos wrote: > > On Thu, Sep 2, 2021 at 5:21 AM Daniel P. Berrangé > > wrote: > > > > > > On Thu, Sep 02, 2021 at 04:22:55A

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-02 Thread Leonardo Bras Soares Passos
On Thu, Sep 2, 2021 at 6:50 AM Daniel P. Berrangé wrote: > > On Thu, Sep 02, 2021 at 06:34:01AM -0300, Leonardo Bras Soares Passos wrote: > > On Thu, Sep 2, 2021 at 5:47 AM Daniel P. Berrangé > > wrote: > > > > > > On Thu, Sep 02, 2021 at 03:38:11A

Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy

2021-09-02 Thread Leonardo Bras Soares Passos
On Thu, Sep 2, 2021 at 6:59 AM Daniel P. Berrangé wrote: > > On Thu, Sep 02, 2021 at 06:49:06AM -0300, Leonardo Bras Soares Passos wrote: > > On Thu, Sep 2, 2021 at 6:20 AM Daniel P. Berrangé > > wrote: > > > > > > On Thu, Sep 02, 2021 at 05:52:15A

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-08 Thread Leonardo Bras Soares Passos
On Tue, Sep 7, 2021 at 1:44 PM Peter Xu wrote: > > On Thu, Sep 02, 2021 at 03:59:25AM -0300, Leonardo Bras Soares Passos wrote: > > I also suggested something like that, but I thought it could be good if we > > could > > fall back to io_writev() if we didn't have the

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-08 Thread Leonardo Bras Soares Passos
On Tue, Sep 7, 2021 at 8:06 AM Dr. David Alan Gilbert wrote: > > Possibly, yes. This really need David G's input since he understands > > the code in way more detail than me. > > Hmm I'm not entirely sure why we have the sync after each iteration; > the case I can think of is if we're doing async

Re: [PATCH v1 2/3] io: Add zerocopy and errqueue

2021-09-08 Thread Leonardo Bras Soares Passos
Could someone help me with that? FWIW, what I had in mind for a (theoretical) migration setup with io_async_writev() + io_async_flush(): - For guest RAM we can decide not to rw_lock memory on zerocopy, because there is no need, - For headers, we can decide to not use async (use io_writev() instead), - flush() can happen each iteration of migration, or at each N seconds, or at the end. Thank you for the great discussion :) Leonardo Bras

Re: [PATCH v8 1/5] QIOChannel: Add flags on io_writev and introduce io_flush callback

2022-02-21 Thread Leonardo Bras Soares Passos
Thanks for reviewing, Juan! On Fri, Feb 18, 2022 at 1:36 PM Juan Quintela wrote: > > Leonardo Bras wrote: > > Add flags to io_writev and introduce io_flush as optional callback to > > QIOChannelClass, allowing the implementation of zero copy writes by > > subclasses.

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-02-21 Thread Leonardo Bras Soares Passos
Hello Juan, thanks for the feedback! On Fri, Feb 18, 2022 at 1:57 PM Juan Quintela wrote: > > Leonardo Bras wrote: > > Implement zero copy send on nocomp_send_write(), by making use of QIOChannel > > writev + flags & flush interface. > > > > Change multifd_s

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-02-21 Thread Leonardo Bras Soares Passos
On Fri, Feb 18, 2022 at 2:36 PM Juan Quintela wrote: > > Leonardo Bras Soares Passos wrote: > > Hello Peter, thanks for reviewing! > > > > On Mon, Feb 7, 2022 at 11:22 PM Peter Xu wrote: > >> > >> On Tue, Feb 01, 2022 at 03:29:03AM -0300, Leonardo Bras

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-02-21 Thread Leonardo Bras Soares Passos
On Mon, Feb 21, 2022 at 4:41 PM Leonardo Bras Soares Passos wrote: > > Hello Juan, thanks for the feedback! > > On Fri, Feb 18, 2022 at 1:57 PM Juan Quintela wrote: > > > > Leonardo Bras wrote: > > > Implement zero copy send on nocomp_send_write(), b

Re: [PATCH v8 5/5] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-03-07 Thread Leonardo Bras Soares Passos
On Tue, Mar 1, 2022 at 12:57 AM Peter Xu wrote: > > On Fri, Feb 18, 2022 at 05:57:13PM +0100, Juan Quintela wrote: > > I did a change on: > > > > commit d48c3a044537689866fe44e65d24c7d39a68868a > > Author: Juan Quintela > > Date: Fri Nov 19 15:35:58 2021 +0100 > > > > multifd: Use a single

Re: [PATCH v9 5/7] multifd: multifd_send_sync_main now returns negative on error

2022-04-26 Thread Leonardo Bras Soares Passos
On Tue, Apr 26, 2022 at 9:59 AM Peter Xu wrote: > > On Mon, Apr 25, 2022 at 06:50:54PM -0300, Leonardo Bras wrote: > > Even though multifd_send_sync_main() currently emits error_reports, it's > > callers don't really check it before continuing. > > > > Chan

Re: [PATCH v9 6/7] multifd: Send header packet without flags if zero-copy-send is enabled

2022-04-26 Thread Leonardo Bras Soares Passos
Hello Daniel, thank you for the feedback! On Tue, Apr 26, 2022 at 5:11 AM Daniel P. Berrangé wrote: > > On Mon, Apr 25, 2022 at 06:50:55PM -0300, Leonardo Bras wrote: > > Since d48c3a0445 ("multifd: Use a single writev on the send side"), > > sending the header

Re: [PATCH v9 7/7] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-04-26 Thread Leonardo Bras Soares Passos
Hello Peter, thanks for helping! On Tue, Apr 26, 2022 at 1:02 PM Peter Xu wrote: > > Leo, > > This patch looks mostly good to me, a few nitpicks below. > > On Mon, Apr 25, 2022 at 06:50:56PM -0300, Leonardo Bras wrote: [...] > > } > > + > > +/* &g

Re: [PATCH v10 6/7] multifd: Send header packet without flags if zero-copy-send is enabled

2022-04-27 Thread Leonardo Bras Soares Passos
On Tue, Apr 26, 2022 at 8:26 PM Peter Xu wrote: > > On Tue, Apr 26, 2022 at 08:06:55PM -0300, Leonardo Bras wrote: > > Since d48c3a0445 ("multifd: Use a single writev on the send side"), > > sending the header packet and the memory pages happens in the same > >

Re: [PATCH v10 7/7] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-04-27 Thread Leonardo Bras Soares Passos
On Wed, Apr 27, 2022 at 5:46 AM Daniel P. Berrangé wrote: > > On Tue, Apr 26, 2022 at 08:06:56PM -0300, Leonardo Bras wrote: > > Implement zero copy send on nocomp_send_write(), by making use of QIOChannel > > writev + flags & flush interface. > > > >

Re: [PATCH v10 6/7] multifd: Send header packet without flags if zero-copy-send is enabled

2022-04-27 Thread Leonardo Bras Soares Passos
On Wed, Apr 27, 2022 at 5:44 AM Daniel P. Berrangé wrote: > > On Tue, Apr 26, 2022 at 08:06:55PM -0300, Leonardo Bras wrote: > > Since d48c3a0445 ("multifd: Use a single writev on the send side"), > > sending the header packet and the memory pages happens in th

Re: [PATCH v10 7/7] multifd: Implement zero copy write in multifd migration (multifd-zero-copy)

2022-04-27 Thread Leonardo Bras Soares Passos
On Tue, Apr 26, 2022 at 8:26 PM Peter Xu wrote: > > On Tue, Apr 26, 2022 at 08:06:56PM -0300, Leonardo Bras wrote: > > Implement zero copy send on nocomp_send_write(), by making use of QIOChannel > > writev + flags & flush interface. > > > > Change multifd_s

Re: [PATCH v10 0/7] MSG_ZEROCOPY + multifd

2022-04-28 Thread Leonardo Bras Soares Passos
On Thu, Apr 28, 2022 at 11:08 AM Dr. David Alan Gilbert wrote: > > * Leonardo Bras (leob...@redhat.com) wrote: > > This patch series intends to enable MSG_ZEROCOPY in QIOChannel, and make > > use of it for multifd migration performance improvement, by reducing cpu > >

Re: [PATCH v9 3/7] migration: Add zero-copy-send parameter for QMP/HMP for Linux

2022-05-04 Thread Leonardo Bras Soares Passos
On Wed, May 4, 2022 at 7:48 AM Markus Armbruster wrote: > > Leonardo Bras writes: > > > Add property that allows zero-copy migration of memory pages > > on the sending side, and also includes a helper function > > migrate_use_zero_copy_send() to check if it&#x

Re: [PATCH v11 2/7] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-05-04 Thread Leonardo Bras Soares Passos
On Wed, May 4, 2022 at 4:53 PM Peter Xu wrote: > > On Wed, May 04, 2022 at 04:18:31PM -0300, Leonardo Bras wrote: > > +/* > > + * Zero-copy defines bellow are included to avoid breaking builds on > > systems > > + * that don't support MSG_ZEROCOPY, while keepi

Re: [PATCH v11 2/7] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-05-05 Thread Leonardo Bras Soares Passos
On Thu, May 5, 2022 at 5:05 AM Daniel P. Berrangé wrote: > > On Wed, May 04, 2022 at 04:18:31PM -0300, Leonardo Bras wrote: > > For CONFIG_LINUX, implement the new zero copy flag and the optional callback > > io_flush on QIOChannelSocket, but enables it only when MSG_ZEROC

Re: [PATCH v11 2/7] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-05-05 Thread Leonardo Bras Soares Passos
On Thu, May 5, 2022 at 12:55 PM Daniel P. Berrangé wrote: > > On Thu, May 05, 2022 at 12:42:47PM -0300, Leonardo Bras Soares Passos wrote: > > > > Hello Daniel, > > > > But what if this gets compiled in a Linux system without MSG_ZEROCOPY > > support? > &

Re: [External] [PATCH v13 3/8] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-06-07 Thread Leonardo Bras Soares Passos
Hello 徐闯, Thanks for reviewing! On Wed, Jun 1, 2022 at 6:37 AM 徐闯 wrote: [...] > Hi, Leonardo. I'm also paying attention to the application of > MSG_ZEROCOPY in live migration recently. I noticed that you defined a > member `zero_copy_queued` in the struct QIOChannelSocket, but I can't > find ou

Re: [External] [PATCH v13 3/8] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-06-08 Thread Leonardo Bras Soares Passos
Hello Peter, On Wed, Jun 1, 2022 at 10:58 AM Peter Xu wrote: > [...] > > Hi, Leonardo. I'm also paying attention to the application of MSG_ZEROCOPY > > in live migration recently. I noticed that you defined a member > > `zero_copy_queued` in the struct QIOChannelSocket, but I can't find out > > w

Re: [External] [PATCH v13 3/8] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-06-08 Thread Leonardo Bras Soares Passos
On Wed, Jun 8, 2022 at 8:41 AM Peter Xu wrote: > > On Wed, Jun 08, 2022 at 02:37:28AM -0300, Leonardo Bras Soares Passos wrote: > > (1) is not an option, as the interface currently uses ret=1 to make > > sure MSG_ZEROCOPY is getting used, > > I added that so the user of qi

Re: [External] [PATCH v13 3/8] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-06-13 Thread Leonardo Bras Soares Passos
Hello Peter, On Wed, Jun 8, 2022 at 5:23 PM Peter Xu wrote: [...] > > In a previous iteration of the patchset, it was made clear that it's > > desirable to detect when the kernel falls back to copying mechanism, > > so the user of 'QIOChannelSocket' can switch to copying and avoid the > > overhea

Re: [External] [PATCH v13 3/8] QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX

2022-06-13 Thread Leonardo Bras Soares Passos
On Mon, Jun 13, 2022 at 7:53 PM Peter Xu wrote: > > On Mon, Jun 13, 2022 at 05:58:44PM -0300, Leonardo Bras Soares Passos wrote: > > Hello Peter, > > > > On Wed, Jun 8, 2022 at 5:23 PM Peter Xu wrote: > > [...] > > > > In a previous iteration of

Re: [PATCH v2 02/16] migration: Correct transferred bytes value

2023-05-26 Thread Leonardo Bras Soares Passos
On Fri, May 26, 2023 at 5:04 AM Juan Quintela wrote: > > Leonardo Brás wrote: > > On Mon, 2023-05-15 at 21:56 +0200, Juan Quintela wrote: > >> We forget several places to add to trasferred amount of data. With > >> this fixes I get: > >> > >>qemu_file_transferred() + multifd_bytes == transfe

Re: [PATCH v2 03/16] migration: Move setup_time to mig_stats

2023-05-26 Thread Leonardo Bras Soares Passos
On Fri, May 26, 2023 at 5:07 AM Juan Quintela wrote: > > Leonardo Brás wrote: > > On Mon, 2023-05-15 at 21:56 +0200, Juan Quintela wrote: > >> It is a time that needs to be cleaned each time cancel migration. > >> Once there create migration_time_since() to calculate how time since a > >> time in

Re: [PATCH v2 04/16] qemu-file: Account for rate_limit usage on qemu_fflush()

2023-05-26 Thread Leonardo Bras Soares Passos
On Fri, May 26, 2023 at 5:09 AM Juan Quintela wrote: > > Leonardo Brás wrote: > > On Mon, 2023-05-15 at 21:56 +0200, Juan Quintela wrote: > >> That is the moment we know we have transferred something. > >> > >> Signed-off-by: Juan Quintela > >> Reviewed-by: Cédric Le Goater > >> --- > >> migra

Re: [PATCH v2 08/16] migration: Use migration_transferred_bytes() to calculate rate_limit

2023-05-26 Thread Leonardo Bras Soares Passos
On Fri, May 26, 2023 at 5:17 AM Juan Quintela wrote: > > Leonardo Brás wrote: > > On Mon, 2023-05-15 at 21:57 +0200, Juan Quintela wrote: > >> Signed-off-by: Juan Quintela > >> Reviewed-by: Cédric Le Goater > >> --- > >> migration/migration-stats.h | 8 +++- > >> migration/migration-stats.

Re: [PATCH v2 09/16] migration: We don't need the field rate_limit_used anymore

2023-05-26 Thread Leonardo Bras Soares Passos
gt; Already in tree. > > See explanation for the split on previous patch. > > The other reason for the split is that this part of the patch is trivial > to review O:-) :-) > > Later, Juan. > > > > > Reviewed-by: Leonardo Bras >

Re: [PATCH v2 15/16] migration/rdma: Simplify the function that saves a page

2023-05-26 Thread Leonardo Bras Soares Passos
* the current chunk. So, we have to call qemu_update_position() > >> - * later on when the actual write occurs. > >> - */ > >> -if (bytes_sent) { > >> -*bytes_sent = 1; > >> -} > >> - > >> /* > >> * Drain the Completion Queue if possible, but do not block, > >> * just poll. > > > > Oh, so this one complements 13/16. > > Since it doesn't do imaginary transfers anymore, there is no need to use > > bytes_sent pointer to keep track of them anymore. > > > > Other than the pages_sent above that I couldn't understand: > > Reviewed-by: Leonardo Bras > > Dropping that bit. > > Thanks. >

Re: [PATCH v2 16/16] migration/multifd: Compute transferred bytes correctly

2023-05-26 Thread Leonardo Bras Soares Passos
eturn 0; > >> } > > > > Humm, those are atomic ops, right? > > > > You think we could have 'multifd_bytes' and 'transferred' in the same > > cacheline, > > to avoid 2 cacheline bounces? > > Don't matter on next series. > > mig_stats.transferred is dropped. > > And transferred becomes: > > qemu_file_transferred + multifd_bytes + rdma_bytes. > > So everytime that we do a write, we only update one counter. That's even better :) Thanks! > > > Well, it's unrelated to this patchset, so: > > > > Reviewed-by: Leonardo Bras >

  1   2   >