multifd: We already account for this packet on the multifd thread
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Lukas Straub <lukasstraub2@web.de>
migration: Move ram_stats to its own file migration-stats.[ch]
There is already include/qemu/stats.h, so stats.h was a bad idea. We want this file to not depend on anything else, we will move all the migration counters/stats to this struct. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Lukas Straub <lukasstraub2@web.de>
migration: Rename ram_counters to mig_stats
migration_stats is just too long, and it is going to have more than ram counters in the near future. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Lukas Straub <lukasstraub2@web.de>
migration: Rename RAMStats to MigrationAtomicStats
It is lousely based on MigrationStats, but that name is taken, so this is the best one that I came with. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Lukas Straub <lukasstraub2@web.de> --- If you have any good suggestion for the name, I am all ears.
migration/rdma: Split the zero page case from acct_update_position
Now that we have atomic counters, we can do it on the place that we need it, no need to do it inside ram.c. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Lukas Straub <lukasstraub2@web.de>
migration/rdma: Unfold last user of acct_update_position()
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Lukas Straub <lukasstraub2@web.de>
migration: Drop unused parameter for migration_tls_get_creds()
It is not needed since we moved the accessor for tls properties to options.c. Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
migration: Drop unused parameter for migration_tls_client_create()
It is not needed since we moved the accessor for tls properties to options.c. Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
qtest/migration-test.c: Add tests with compress enabled
There has never been tests for migration with compress enabled. Add suitable tests, testing with compress-wait-thread = false too. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Acked-by: Peter Xu <peterx@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
qtest/migration-test.c: Add postcopy tests with compress enabled
Add postcopy tests with compress enabled to ensure nothing breaks with the refactoring in the next commits. preempt+compress is blocked, so no test needed for that case. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
ram.c: Let the compress threads return a CompressResult enum
This will be used in the next commits to move save_page_header() out of compress code. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
ram.c: Dont change param->block in the compress thread
Instead introduce a extra parameter to trigger the compress thread. Now, when the compress thread is done, we know what RAMBlock and offset it did compress. This will be used in the next commits to move save_page_header() out of compress code. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
ram.c: Reset result after sending queued data
And take the param->mutex lock for the whole section to ensure thread-safety. Now, it is explicitly clear if there is no queued data to send. Before, this was handled by param->file stream being empty and thus qemu_put_qemu_file() not sending anything. This will be used in the next commits to move save_page_header() out of compress code. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
ram.c: Do not call save_page_header() from compress threads
save_page_header() accesses several global variables, so calling it from multiple threads is pretty ugly. Instead, call save_page_header() before writing out the compressed data from the compress buffer to the migration stream. This also makes the core compress code more independend from ram.c. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
ram.c: Call update_compress_thread_counts from compress_send_queued_data
This makes the core compress code more independend from ram.c. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
ram.c: Remove last ram.c dependency from the core compress code
Make compression interfaces take send_queued_data() as an argument. Remove save_page_use_compression() from flush_compressed_data(). This removes the last ram.c dependency from the core compress code. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
ram.c: Move core compression code into its own file
No functional changes intended. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
ram.c: Move core decompression code into its own file
No functional changes intended. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
ram compress: Assert that the file buffer matches the result
Before this series, "nothing to send" was handled by the file buffer being empty. Now it is tracked via param->result. Assert that the file buffer state matches the result. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
ram-compress.c: Make target independent
Make ram-compress.c target independent. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
migration: Initialize and cleanup decompression in migration.c
This fixes compress with colo. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Merge tag 'migration-20230428-pull-request' of https://gitlab.com/jua…
…n.quintela/qemu into staging Migration Pull request (20230429 vintage) Hi In this series: - compression code cleanup (lukas) nice, nice, nice. - drop useless parameters from migration_tls* (juan) - first part of remove QEMUFileHooks series (juan) Please apply. # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEEGJn/jt6/WMzuA0uC9IfvGFhy1yMFAmRMF90ACgkQ9IfvGFhy # 1yPVUBAApRj2d6K6T0FwW8axL0LUD+7QXmMnTkhO9/QJDBHGban9hWuaH4n3Om+0 # 89tHl5Fo6bgOJMagUGfIuF1Xt9tJSFZMp3OMFxrV2+yhLqHQ7LlJSIFrO+ILeRQJ # 3kKzTzBEb9LNVFPKrD2SyEvhGxxD1kHfnNydKdU3XqvyAWPXqr1BonxsF06+i5ud # WRhEJ9iL9eFP4CkCPOMHxBhfme6gP+NkxaB6R2Eb30jNTP1U9nTlKaV2fGLVn/zY # VRC1bV9Ujy3wGeKBp8Lm9FIa8yBIf/HImI+nWGFROYslECMAR0kMfEU+aWY5y8By # t0xDD0OEh2QB7rjGpx1B3Pb2He5YznzQNG4kmjNqWcH+PWurRbBaN++1r1DHrQzk # fhfsT3A9eWUM06JsMm2Y+IhHwzT+PddmjWjHDU/kPNn1+GnxFytC55Ie5ew62PLu # jWtOTERSg38e6m2gdFM5PLnfP5aLmjH0An78CDFhVy8f8I0R89tIC915p4QECuaa # IIetvv70NF92EOXEtV9IEt8XvCsOomXrUCCtQMSAthHsh37Vn3W2U8fmXluAclua # AW/mllj1AqEaUHVvCyST5bq0xqzE90dqjUB474oKi+wtPIzpXb8LP0xVZvcU8zWo # 53MNFybvcDoZdva1JynzUvug06k5o2t91wIkLyUvigZZQ+3Osrg= # =rl9X # -----END PGP SIGNATURE----- # gpg: Signature made Fri 28 Apr 2023 08:00:45 PM BST # gpg: using RSA key 1899FF8EDEBF58CCEE034B82F487EF185872D723 # gpg: Good signature from "Juan Quintela <quintela@redhat.com>" [undefined] # gpg: aka "Juan Quintela <quintela@trasno.org>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 1899 FF8E DEBF 58CC EE03 4B82 F487 EF18 5872 D723 * tag 'migration-20230428-pull-request' of https://gitlab.com/juan.quintela/qemu: (21 commits) migration: Initialize and cleanup decompression in migration.c ram-compress.c: Make target independent ram compress: Assert that the file buffer matches the result ram.c: Move core decompression code into its own file ram.c: Move core compression code into its own file ram.c: Remove last ram.c dependency from the core compress code ram.c: Call update_compress_thread_counts from compress_send_queued_data ram.c: Do not call save_page_header() from compress threads ram.c: Reset result after sending queued data ram.c: Dont change param->block in the compress thread ram.c: Let the compress threads return a CompressResult enum qtest/migration-test.c: Add postcopy tests with compress enabled qtest/migration-test.c: Add tests with compress enabled migration: Drop unused parameter for migration_tls_client_create() migration: Drop unused parameter for migration_tls_get_creds() migration/rdma: Unfold last user of acct_update_position() migration/rdma: Split the zero page case from acct_update_position migration: Rename RAMStats to MigrationAtomicStats migration: Rename ram_counters to mig_stats migration: Move ram_stats to its own file migration-stats.[ch] ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>