[PATCH v1 1/1] migration: add remaining params->has_* = true in migration_instance_init()

2022-07-25 Thread Leonardo Bras
Some of params->has_* = true are missing in migration_instance_init, this causes migrate_params_check() to skip some tests, allowing some unsupported scenarios. Fix this by adding all missing params->has_* = true in migration_instance_init(). Signed-off-by: Leonardo Bras --- mig

[PATCH v1 1/1] QIOChannelSocket: Add support for MSG_ZEROCOPY + IPV6

2022-08-04 Thread Leonardo Bras
c58ffc29 ("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX") Signed-off-by: Leonardo Bras --- io/channel-socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io/channel-socket.c b/io/channel-socket.c index e6e7a12ae1..4f6bb6fe37 1

[RFC PATCH v1 1/1] migration: Disable postcopy + multifd migration

2023-03-27 Thread Leonardo Bras
s not enough testing/support nor any reported users for this scenario, we should disable this combination before it may cause any problems for users. Suggested-by: Dr. David Alan Gilbert Signed-off-by: Leonardo Bras --- migration/migration.c | 5 + 1 file changed, 5 insertions(+) diff --

[PATCH v5 0/6] MSG_ZEROCOPY + multifd

2021-11-11 Thread Leonardo Bras
nges 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 (6): QIOChannel: Add io_writev_zerocopy & io_flush_zerocopy callbacks QIOChannelSocket: Add flags parameter for writing

[PATCH v5 1/6] QIOChannel: Add io_writev_zerocopy & io_flush_zerocopy callbacks

2021-11-11 Thread Leonardo Bras
them, then: - io_writev_zerocopy will return -1, - io_flush_zerocopy will return 0 without changing anything. Also, some functions like qio_channel_writev_full_all() were adapted to receive a flag parameter. That allows shared code between zerocopy and non-zerocopy writev. Signed-off-by: Leonardo

[PATCH v5 2/6] QIOChannelSocket: Add flags parameter for writing

2021-11-11 Thread Leonardo Bras
directly to sendmsg(). Signed-off-by: Leonardo Bras --- io/channel-socket.c | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/io/channel-socket.c b/io/channel-socket.c index 606ec97cf7..b57a27bf91 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c

[PATCH v5 6/6] multifd: Implement zerocopy write in multifd migration (multifd-zerocopy)

2021-11-11 Thread Leonardo Bras
zerocopy enabled, make it optional by creating a new migration parameter "zerocopy" on qapi, so low-privileged users can still perform multifd migrations. Signed-off-by: Leonardo Bras --- migration/multifd.h | 4 +++- migration/multifd.c | 37 - migra

[PATCH v5 3/6] QIOChannelSocket: Implement io_writev_zerocopy & io_flush_zerocopy for CONFIG_LINUX

2021-11-11 Thread Leonardo Bras
e, writev_zerocopy will return an error, which can abort an operation like migration, - Because of this, when an user code wants to add zerocopy 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 --- inc

[PATCH v5 4/6] migration: Add zerocopy parameter for QMP/HMP for Linux

2021-11-11 Thread Leonardo Bras
this parameter is compiled-out. Signed-off-by: Leonardo Bras --- qapi/migration.json | 18 ++ migration/migration.h | 5 + migration/migration.c | 32 migration/multifd.c | 17 + migration/socket.c| 5 + monitor/hmp-c

[PATCH v5 5/6] migration: Add migrate_use_tls() helper

2021-11-11 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 --- migration/migration.h | 1

[PATCH v1 1/2] QIOChannelSocket: Fix zero-copy flush returning code 1 when nothing sent

2022-06-27 Thread Leonardo Bras
("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX") Signed-off-by: Leonardo Bras --- io/channel-socket.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/io/channel-socket.c b/io/channel-socket.c index 4466bb1cd4..698c086b70 1

[PATCH v1 0/2] Zero copy improvements (QIOChannel + multifd)

2022-06-27 Thread Leonardo Bras
educes the frequency of multifd syncs, or else it could potentially send 20 warnings per second. ... Leonardo Bras (2): QIOChannelSocket: Fix zero-copy flush returning code 1 when nothing sent migration/multifd: Warn

[PATCH v1 2/2] migration/multifd: Warn user when zerocopy not working

2022-06-27 Thread Leonardo Bras
dirty-bitmap iterations were not able to use zero-copy send. Signed-off-by: Leonardo Bras --- migration/multifd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migration/multifd.c b/migration/multifd.c index 684c014c86..9c62aec84e 100644 --- a/migration/multifd.c +++ b/migration

[PATCH v2 0/3] Zero copy improvements (QIOChannel + multifd)

2022-07-01 Thread Leonardo Bras
used to keep track of [*]. Honestly I would like some help with this naming, which I don't think is quite good, but I could also not think on anything better. The third patch keeps track of how many zero-copy flushes retured 1 [*] Leonardo Bras (3): QIOChannelSocket: Fix zero-copy flush

[PATCH v2 1/3] QIOChannelSocket: Fix zero-copy flush returning code 1 when nothing sent

2022-07-01 Thread Leonardo Bras
("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX") Signed-off-by: Leonardo Bras --- io/channel-socket.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/io/channel-socket.c b/io/channel-socket.c index 4466bb1cd4..698c086b70 1

[PATCH v2 3/3] migration/multifd: Warn user when zerocopy not working

2022-07-01 Thread Leonardo Bras
, which checks for errors each of the previous calls to sendmsg(...,MSG_ZEROCOPY). If all of them failed to use zero-copy, then increment zero_copy_copied migration stat to let the user know about it. Signed-off-by: Leonardo Bras --- migration/ram.h | 2 ++ migration/multifd.c | 2 ++ migration

[PATCH v2 2/3] Add zero-copy-copied migration stat

2022-07-01 Thread Leonardo Bras
Signed-off-by: Leonardo Bras --- qapi/migration.json | 5 - migration/migration.c | 1 + monitor/hmp-cmds.c| 4 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/qapi/migration.json b/qapi/migration.json index 7102e474a6..925f009868 100644 --- a/qapi/migration.json

[PATCH v3 0/3] Zero copy improvements (QIOChannel + multifd)

2022-07-04 Thread Leonardo Bras
more user-friendly Changes since v1: - Idea of using a warning replaced by using a migration stat counter Leonardo Bras (3): QIOChannelSocket: Fix zero-copy flush returning code 1 when nothing sent Add dirty-sync-missed-zero-copy migration stat migration/multifd: Warn user when zerocop

[PATCH v3 1/3] QIOChannelSocket: Fix zero-copy flush returning code 1 when nothing sent

2022-07-04 Thread Leonardo Bras
("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX") Signed-off-by: Leonardo Bras --- io/channel-socket.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/io/channel-socket.c b/io/channel-socket.c index 4466bb1cd4..698c086b70 1

[PATCH v3 2/3] Add dirty-sync-missed-zero-copy migration stat

2022-07-04 Thread Leonardo Bras
Signed-off-by: Leonardo Bras --- qapi/migration.json | 7 ++- migration/migration.c | 2 ++ monitor/hmp-cmds.c| 4 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/qapi/migration.json b/qapi/migration.json index 7102e474a6..fed08b9b88 100644 --- a/qapi/migration.json

[PATCH v3 3/3] migration/multifd: Warn user when zerocopy not working

2022-07-04 Thread Leonardo Bras
, which checks for errors each of the previous calls to sendmsg(...,MSG_ZEROCOPY). If all of them failed to use zero-copy, then increment dirty_sync_missed_zero_copy migration stat to let the user know about it. Signed-off-by: Leonardo Bras --- migration/ram.h | 2 ++ migration/multifd.c | 2

[PATCH v2 1/1] migration: Disable postcopy + multifd migration

2023-04-24 Thread Leonardo Bras
there is not enough testing/support nor any reported users for this scenario, we should disable this combination before it may cause any problems for users. Suggested-by: Dr. David Alan Gilbert Signed-off-by: Leonardo Bras Acked-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert --- Changes sinc

[PATCH v1 1/1] hw/pci: Disable PCI_ERR_UNCOR_MASK register for machine type < 8.0

2023-05-02 Thread Leonardo Bras
e type <= 7.2. Fixes: 010746ae1d ("hw/pci/aer: Implement PCI_ERR_UNCOR_MASK register") Suggested-by: Michael S. Tsirkin Signed-off-by: Leonardo Bras --- include/hw/pci/pci.h | 2 ++ hw/core/machine.c| 1 + hw/pci/pci.c | 2 ++ hw/pci/pcie_aer.c| 11 +++ 4

[PATCH v1 1/1] target/i386: Mask xstate_bv based on the cpu enabled features

2022-01-29 Thread Leonardo Bras
of running the vcpu model. Signed-off-by: Leonardo Bras --- target/i386/xsave_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/xsave_helper.c b/target/i386/xsave_helper.c index ac61a96344..0628226234 100644 --- a/target/i386/xsave_helper.c +++ b/

[RFC PATCH 1/1] i386: Remove features from Epyc-Milan cpu

2022-01-29 Thread Leonardo Bras
host with these features to a host without them can be troublesome for the guest. Remove the "optional" features (erms, fsrm) from Epyc-Milan, in order to avoid possible after-migration guest issues. Signed-off-by: Leonardo Bras --- Does this make sense? Or maybe I am missing somethin

[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 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 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 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 5/8] migration: Add migrate_use_tls() helper

2022-05-12 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 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 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 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 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 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 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 ++

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

2022-05-13 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 v7 0/5] MSG_ZEROCOPY + multifd

2022-01-06 Thread Leonardo Bras
ements 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

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

2022-01-06 Thread Leonardo Bras
d-off-by: Leonardo Bras --- include/io/channel.h | 67 +++- io/channel-buffer.c | 1 + io/channel-command.c | 1 + io/channel-file.c| 1 + io/channel-socket.c | 2 ++ io/channel-tls.c | 1 + io/channel-websock.c | 1 + io/channel.c

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

2022-01-06 Thread Leonardo Bras
nism to disable it, so it can still be accessible to less privileged users. Signed-off-by: Leonardo Bras --- include/io/channel-socket.h | 2 + io/channel-socket.c | 107 ++-- 2 files changed, 105 insertions(+), 4 deletions(-) diff --git a/include/io/c

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

2022-01-06 Thread Leonardo Bras
ltid migration 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 v7 4/5] migration: Add migrate_use_tls() helper

2022-01-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

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

2022-01-06 Thread Leonardo Bras
this parameter is compiled-out. Signed-off-by: Leonardo Bras --- qapi/migration.json | 24 migration/migration.h | 5 + migration/migration.c | 32 migration/socket.c| 5 + monitor/hmp-cmds.c| 6 ++ 5 files change

[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 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 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 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 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 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 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 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 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 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 v1 1/1] migration: Fix yank on postcopy multifd crashing guest after migration

2022-11-08 Thread Leonardo Bras
ead() before MIGRATION_YANK_INSTANCE is unregistered. Fixes: b5eea99ec2 ("migration: Add yank feature") Reported-by: Li Xiaohui Signed-off-by: Leonardo Bras --- migration/migration.h | 1 + migration/migration.c | 18 +- migration/savevm.c| 2 ++ 3 files changed, 16 inse

[RFC PATCH 2/4] migration/multifd/zero-copy: Merge header & pages send in a single write

2022-10-24 Thread Leonardo Bras
which element of the array will be used as a header. Suggested-by: Juan Quintela Signed-off-by: Leonardo Bras --- migration/multifd.h | 5 - migration/multifd.c | 52 - 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/migration/multif

[RFC PATCH 3/4] QIOChannel: Add max_pending parameter to qio_channel_flush()

2022-10-24 Thread Leonardo Bras
he maximum number of pending writes remaining before the function returns. Also, implement this change in qio_channel_socket_flush(). Change current calls of qio_channel_flush() so (max_pending == 0), and the flush-all behavior is maintained. Signed-off-by: Leonardo Bras --- include/io/cha

[RFC PATCH 4/4] migration/multifd/zero-copy: Flush only the LRU half of the header array

2022-10-24 Thread Leonardo Bras
hput while consuming less cpu time. Signed-off-by: Leonardo Bras --- migration/multifd.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index c5d1f911a4..fe9df460f6 100644 --- a/migration/multifd.c +++ b/migration

[RFC PATCH 1/4] migration/multifd/zero-copy: Create helper function for flushing

2022-10-24 Thread Leonardo Bras
Move flushing code from multifd_send_sync_main() to a new helper, and call it in multifd_send_sync_main(). Signed-off-by: Leonardo Bras --- migration/multifd.c | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/migration/multifd.c b/migration

[RFC PATCH 0/4] MultiFD zero-copy improvements

2022-10-24 Thread Leonardo Bras
to happen while the most recent ones are ongoing, instead of waiting for everything to finish before sending more. It all works fine in my tests, but maybe I missed some cornercase. Please provide any feedback you find fit. Thank you all! Best regards, Leo Leonardo Bras (4): migration/multifd

[PATCH v1 1/1] QIOChannelSocket: Fix zero-copy send so socket flush works

2022-06-08 Thread Leonardo Bras
in RAM during migration. Fixes: 2bc58ffc2926 ("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX") Reported-by: 徐闯 Signed-off-by: Leonardo Bras --- io/channel-socket.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --gi

[PATCH v2 1/2] QIOChannelSocket: Reduce ifdefs to improve readability

2022-06-08 Thread Leonardo Bras
During implementation of MSG_ZEROCOPY feature, a lot of #ifdefs were introduced, particularly at qio_channel_socket_writev(). Rewrite some of those changes so it's easier to read. ... Signed-off-by: Leonardo Bras --

[PATCH v2 2/2] QIOChannelSocket: Fix zero-copy send so socket flush works

2022-06-08 Thread Leonardo Bras
corruption in RAM during migration. Fixes: 2bc58ffc2926 ("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX") Reported-by: 徐闯 Signed-off-by: Leonardo Bras --- io/channel-socket.c | 5 + 1 file changed, 5 insertions(+) diff --git a/io/channel-socket.

[PATCH v3 1/2] QIOChannelSocket: Introduce assert and reduce ifdefs to improve readability

2022-06-13 Thread Leonardo Bras
ned-off-by: Leonardo Bras --- io/channel-socket.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/io/channel-socket.c b/io/channel-socket.c index dc9c165de1..cdce7b0b45 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -578,11 +578,13 @@ stat

[PATCH v3 2/2] QIOChannelSocket: Fix zero-copy send so socket flush works

2022-06-13 Thread Leonardo Bras
corruption in RAM during migration. Fixes: 2bc58ffc2926 ("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX") Reported-by: 徐闯 Signed-off-by: Leonardo Bras --- io/channel-socket.c | 5 + 1 file changed, 5 insertions(+) diff --git a/io/channel-socket.

[PATCH v4 1/4] QIOChannelSocket: Introduce assert and reduce ifdefs to improve readability

2022-06-19 Thread Leonardo Bras
ned-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé --- io/channel-socket.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/io/channel-socket.c b/io/channel-socket.c index dc9c165de1..dac9e60c20 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c

[PATCH v4 3/4] migration: zero-copy flush only at the end of bitmap scanning

2022-06-19 Thread Leonardo Bras
meout. Change so it flushes only after a whole scanning of the dirty bimap, so it never sends a newer version of a page before an older one, while avoiding unnecessary overhead. Signed-off-by: Leonardo Bras --- migration/multifd.h | 1 + migration/multifd.c

[PATCH v4 0/4] MSG_ZEROCOPY fixes & improvements

2022-06-19 Thread Leonardo Bras
4 is about making zero-copy-send a migration capability, instead of a migration parameter. Which actually makes more sense and helps the implementation of the libvirt code. Leonardo Bras (4): QIOChannelSocket: Introduce assert and reduce ifdefs to improve readability QIOChannelSocket: Fix

[PATCH v4 2/4] QIOChannelSocket: Fix zero-copy send so socket flush works

2022-06-19 Thread Leonardo Bras
corruption in RAM during migration. Fixes: 2bc58ffc2926 ("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX") Reported-by: 徐闯 Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé --- io/channel-socket.c | 5 + 1 file changed, 5 insertions(+) d

[PATCH v4 4/4] migration: Change zero_copy_send from migration parameter to migration capability

2022-06-19 Thread Leonardo Bras
how recently the change got merged, it was decided that it's still time to make it right, and convert zero_copy_send into a Migration capability. Signed-off-by: Leonardo Bras --- qapi/migration.json | 33 --- migration/migration.c

[PATCH v1 2/4] migration/multifd: Remove unnecessary assignment on multifd_load_cleanup()

2023-02-09 Thread Leonardo Bras
Before assigning "p->quit = true" for every multifd channel, multifd_load_cleanup() will call multifd_recv_terminate_threads() which already does the same assignment, while protected by a mutex. So there is no point doing the same assignment again. Signed-off-by: Leonardo Bras -

[PATCH v1 3/4] migration/multifd: Join all multifd threads in order to avoid leaks

2023-02-09 Thread Leonardo Bras
migration is usually just ran at most a few times, and after it succeeds there is not much to be done before exiting the process. Yet still, it should not hurt performance to join all of them. Signed-off-by: Leonardo Bras --- migration/multifd.c | 3 ++- 1 file changed, 2 insertions(+), 1

[PATCH v1 4/4] migration/multifd: Move load_cleanup inside incoming_state_destroy

2023-02-09 Thread Leonardo Bras
up() to make sure nothing else is received before dirty_bitmap_mig_before_vm_start(). Signed-off-by: Leonardo Bras --- migration/multifd.h | 1 + migration/migration.c | 4 +++- migration/multifd.c | 7 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/migration/multifd.h

[PATCH v1 1/4] migration/multifd: Change multifd_load_cleanup() signature and usage

2023-02-09 Thread Leonardo Bras
n value to decide on setting autostart = false, which will never happen. In order to simplify the codebase, change multifd_load_cleanup() signature to 'void multifd_load_cleanup(void)', and for every usage remove error handling or decision made based on return value != 0. Signed-off-by:

[PATCH v1 4/4] migration/multifd: Move load_cleanup inside incoming_state_destroy

2023-02-09 Thread Leonardo Bras
up() to make sure nothing else is received before dirty_bitmap_mig_before_vm_start(). Signed-off-by: Leonardo Bras --- migration/multifd.h | 1 + migration/migration.c | 4 +++- migration/multifd.c | 7 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/migration/multifd.h

[PATCH v1 1/4] migration/multifd: Change multifd_load_cleanup() signature and usage

2023-02-09 Thread Leonardo Bras
n value to decide on setting autostart = false, which will never happen. In order to simplify the codebase, change multifd_load_cleanup() signature to 'void multifd_load_cleanup(void)', and for every usage remove error handling or decision made based on return value != 0. Signed-off-by:

[PATCH v1 3/4] migration/multifd: Join all multifd threads in order to avoid leaks

2023-02-09 Thread Leonardo Bras
migration is usually just ran at most a few times, and after it succeeds there is not much to be done before exiting the process. Yet still, it should not hurt performance to join all of them. Signed-off-by: Leonardo Bras --- migration/multifd.c | 3 ++- 1 file changed, 2 insertions(+), 1

[PATCH v1 2/4] migration/multifd: Remove unnecessary assignment on multifd_load_cleanup()

2023-02-09 Thread Leonardo Bras
Before assigning "p->quit = true" for every multifd channel, multifd_load_cleanup() will call multifd_recv_terminate_threads() which already does the same assignment, while protected by a mutex. So there is no point doing the same assignment again. Signed-off-by: Leonardo Bras -

[PATCH v4 0/3] Zero copy improvements (QIOChannel + multifd)

2022-07-11 Thread Leonardo Bras
ation release number changed from 7.2 to 7.1 - migration stat renamed from zero-copy-copied to dirty-sync-missed-zero-copy - Updated documentation to make it more user-friendly Changes since v1: - Idea of using a warning replaced by using a migration stat counter Leonardo Br

[PATCH v4 1/3] QIOChannelSocket: Fix zero-copy flush returning code 1 when nothing sent

2022-07-11 Thread Leonardo Bras
("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX") Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé Acked-by: Daniel P. Berrangé Reviewed-by: Juan Quintela --- io/channel-socket.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-)

[PATCH v4 2/3] Add dirty-sync-missed-zero-copy migration stat

2022-07-11 Thread Leonardo Bras
Signed-off-by: Leonardo Bras Acked-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé --- qapi/migration.json | 7 ++- migration/migration.c | 2 ++ monitor/hmp-cmds.c| 5 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/qapi/migration.json b/qapi

[PATCH v4 3/3] migration/multifd: Report to user when zerocopy not working

2022-07-11 Thread Leonardo Bras
, which checks for errors each of the previous calls to sendmsg(...,MSG_ZEROCOPY). If all of them failed to use zero-copy, then increment dirty_sync_missed_zero_copy migration stat to let the user know about it. Signed-off-by: Leonardo Bras Reviewed-by: Daniel P. Berrangé --- migration/ram.h

[PATCH v1 1/1] migration: Avoid false-positive on non-supported scenarios for zero-copy-send

2022-07-19 Thread Leonardo Bras
ero-copy-send on migrate_params_check(). 3) XBZRLE is also a compression capability, so it makes sense to also add it to the list of capabilities which are not supported with zero-copy-send. Fixes: 1abaec9a1b2c ("migration: Change zero_copy_send from migration parameter to migration

[PATCH v4 0/3] MSG_ZEROCOPY for multifd

2021-10-09 Thread Leonardo Bras
whenever all data was written. Leonardo Bras (3): QIOChannel: Add io_writev_zerocopy & io_flush_zerocopy callbacks QIOChannelSocket: Implement io_writev_zerocopy & io_flush_zerocopy for CONFIG_LINUX multifd: Implement zerocopy write in multifd migration (multifd-zerocopy

[PATCH v4 2/3] QIOChannelSocket: Implement io_writev_zerocopy & io_flush_zerocopy for CONFIG_LINUX

2021-10-09 Thread Leonardo Bras
o it can still be acessible to less privileged users. Signed-off-by: Leonardo Bras --- include/io/channel-socket.h | 2 + include/io/channel.h| 1 + io/channel-socket.c | 180 ++-- 3 files changed, 173 insertions(+), 10 deletions(-) diff --git a/inclu

[PATCH v4 1/3] QIOChannel: Add io_writev_zerocopy & io_flush_zerocopy callbacks

2021-10-09 Thread Leonardo Bras
then: - io_async_writev will return -1, - io_async_flush will return 0 without changing anything. Also, some functions like qio_channel_writev_full_all() were adapted to receive a flag parameter. That allows shared code between zerocopy and non-zerocopy writev. Signed-off-by: Leonardo Bras --- inclu

[PATCH v4 3/3] multifd: Implement zerocopy write in multifd migration (multifd-zerocopy)

2021-10-09 Thread Leonardo Bras
optional by creating a new parameter multifd-zerocopy on qapi, so low-privileged users can still perform multifd migrations. Signed-off-by: Leonardo Bras --- qapi/migration.json | 18 ++ migration/migration.h | 1 + migration/multifd.h | 2 +- migration/migration.c | 20

[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 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 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 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 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

  1   2   3   4   >