Migration Pull request

Hi
 
 This is just fixes for migration.
 - Fix rdma (dave)
 - Remove unused variable (Zhijian)
 - Fix AVX512 and XBZRLE (Matheus)
 - Fix migration preempt (Peter)
 - Fix populate_vfio_info (Steve)
 - Fix multifd send trace (Wei)
 
 Please apply.
 
 Later, Juan.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEGJn/jt6/WMzuA0uC9IfvGFhy1yMFAmQTMa0ACgkQ9IfvGFhy
 1yMKCBAAyHcE4TO3NrFpG87nGbLhr1zjXkLEKGuAA/E6NKKrf+OrSV2Wq0aBEO/B
 +yAAiXEPsjheh7gwS8FkgAgIj6PwRTtlKae/Tr0JtraukxYT4qzubkaw3X2VjEwf
 uJ8/I+BZOLBUxlZHYoyDP4CWX7elEMlzKdcShcpJCLTgLjxFXjQ9lZwQBgu51cF2
 YitYRDMsVMr77y20eTqCUrLPcSgTM+8h3PtdyDRH2D+KF1IEkjGmSuF8lBc2WiN+
 BiuW6RlaLjhQiBuWNbkrjdulArnim9qhIT5didJuE7p9L50WFSqZs3EV7a4fJjUl
 1TWJ4k/fzcYf5GF1ypVBrZ1WWCsyJe/fd8ZddGyz9Xpu6Ml7BevVA+0oGeBDYaDB
 T7o2TrHzz2vYCl20jwPbUeafjN8MppBdtHaJ2pP0nA3cPZHPziU2BE9D2/AUxMib
 ICrNe+nVqXUKqx8qZrRPzIBsnoAgmhkNC/k8T7VEhfmm+s6C+xEE0eyhE299TYJn
 ETpQCqiDPCDlkC8iL3OAd8Nn8kucT7EL7qcV2PcpWxgKPc7mCCNIHdpfpM2aZduJ
 0S/m19ICS8PSWSjFpSK2/vKLOyjA1PKA869iXFD+OOPb8jY5piTYOrj1gowkRjMx
 JOOVDX04lBxbgUVaZnC+iLuh/ZlMRFv2GFAHIk66XDsmUOzRddI=
 =Lwbm
 -----END PGP SIGNATURE-----

Merge tag 'migration-20230316-pull-request' of https://gitlab.com/juan.quintela/qemu into staging

Migration Pull request

Hi

This is just fixes for migration.
- Fix rdma (dave)
- Remove unused variable (Zhijian)
- Fix AVX512 and XBZRLE (Matheus)
- Fix migration preempt (Peter)
- Fix populate_vfio_info (Steve)
- Fix multifd send trace (Wei)

Please apply.

Later, Juan.

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEGJn/jt6/WMzuA0uC9IfvGFhy1yMFAmQTMa0ACgkQ9IfvGFhy
# 1yMKCBAAyHcE4TO3NrFpG87nGbLhr1zjXkLEKGuAA/E6NKKrf+OrSV2Wq0aBEO/B
# +yAAiXEPsjheh7gwS8FkgAgIj6PwRTtlKae/Tr0JtraukxYT4qzubkaw3X2VjEwf
# uJ8/I+BZOLBUxlZHYoyDP4CWX7elEMlzKdcShcpJCLTgLjxFXjQ9lZwQBgu51cF2
# YitYRDMsVMr77y20eTqCUrLPcSgTM+8h3PtdyDRH2D+KF1IEkjGmSuF8lBc2WiN+
# BiuW6RlaLjhQiBuWNbkrjdulArnim9qhIT5didJuE7p9L50WFSqZs3EV7a4fJjUl
# 1TWJ4k/fzcYf5GF1ypVBrZ1WWCsyJe/fd8ZddGyz9Xpu6Ml7BevVA+0oGeBDYaDB
# T7o2TrHzz2vYCl20jwPbUeafjN8MppBdtHaJ2pP0nA3cPZHPziU2BE9D2/AUxMib
# ICrNe+nVqXUKqx8qZrRPzIBsnoAgmhkNC/k8T7VEhfmm+s6C+xEE0eyhE299TYJn
# ETpQCqiDPCDlkC8iL3OAd8Nn8kucT7EL7qcV2PcpWxgKPc7mCCNIHdpfpM2aZduJ
# 0S/m19ICS8PSWSjFpSK2/vKLOyjA1PKA869iXFD+OOPb8jY5piTYOrj1gowkRjMx
# JOOVDX04lBxbgUVaZnC+iLuh/ZlMRFv2GFAHIk66XDsmUOzRddI=
# =Lwbm
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 16 Mar 2023 15:11:41 GMT
# gpg:                using RSA key 1899FF8EDEBF58CCEE034B82F487EF185872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>" [full]
# gpg:                 aka "Juan Quintela <quintela@trasno.org>" [full]
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* tag 'migration-20230316-pull-request' of https://gitlab.com/juan.quintela/qemu:
  migration: fix populate_vfio_info
  migration/multifd: correct multifd_send_thread to trace the flags
  migration/rdma: Remove deprecated variable rdma_return_path
  migration/xbzrle: fix out-of-bounds write with axv512
  migration/xbzrle: use ctz64 to avoid undefined result
  migration/rdma: Fix return-path case
  migration: Wait on preempt channel in preempt thread

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2023-03-16 20:09:08 +00:00
commit 53b90ae9b5
5 changed files with 21 additions and 18 deletions

View File

@ -677,7 +677,7 @@ static void *multifd_send_thread(void *opaque)
if (p->pending_job) {
uint64_t packet_num = p->packet_num;
uint32_t flags = p->flags;
uint32_t flags;
p->normal_num = 0;
if (use_zero_copy_send) {
@ -699,6 +699,7 @@ static void *multifd_send_thread(void *opaque)
}
}
multifd_send_fill_packet(p);
flags = p->flags;
p->flags = 0;
p->num_packets++;
p->total_normal_pages += p->normal_num;

View File

@ -1197,11 +1197,6 @@ int postcopy_ram_incoming_setup(MigrationIncomingState *mis)
}
if (migrate_postcopy_preempt()) {
/*
* The preempt channel is established in asynchronous way. Wait
* for its completion.
*/
qemu_sem_wait(&mis->postcopy_qemufile_dst_done);
/*
* This thread needs to be created after the temp pages because
* it'll fetch RAM_CHANNEL_POSTCOPY PostcopyTmpPage immediately.
@ -1668,6 +1663,12 @@ void *postcopy_preempt_thread(void *opaque)
qemu_sem_post(&mis->thread_sync_sem);
/*
* The preempt channel is established in asynchronous way. Wait
* for its completion.
*/
qemu_sem_wait(&mis->postcopy_qemufile_dst_done);
/* Sending RAM_SAVE_FLAG_EOS to terminate this thread */
qemu_mutex_lock(&mis->postcopy_prio_thread_mutex);
while (1) {

View File

@ -3373,7 +3373,8 @@ static int qemu_rdma_accept(RDMAContext *rdma)
* initialize the RDMAContext for return path for postcopy after first
* connection request reached.
*/
if (migrate_postcopy() && !rdma->is_return_path) {
if ((migrate_postcopy() || migrate_use_return_path())
&& !rdma->is_return_path) {
rdma_return_path = qemu_rdma_data_init(rdma->host_port, NULL);
if (rdma_return_path == NULL) {
rdma_ack_cm_event(cm_event);
@ -3455,7 +3456,8 @@ static int qemu_rdma_accept(RDMAContext *rdma)
}
/* Accept the second connection request for return path */
if (migrate_postcopy() && !rdma->is_return_path) {
if ((migrate_postcopy() || migrate_use_return_path())
&& !rdma->is_return_path) {
qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration,
NULL,
(void *)(intptr_t)rdma->return_path);
@ -4109,7 +4111,7 @@ static void rdma_accept_incoming_migration(void *opaque)
void rdma_start_incoming_migration(const char *host_port, Error **errp)
{
int ret;
RDMAContext *rdma, *rdma_return_path = NULL;
RDMAContext *rdma;
Error *local_err = NULL;
trace_rdma_start_incoming_migration();
@ -4155,7 +4157,6 @@ err:
g_free(rdma->host_port);
}
g_free(rdma);
g_free(rdma_return_path);
}
void rdma_start_outgoing_migration(void *opaque,
@ -4192,7 +4193,7 @@ void rdma_start_outgoing_migration(void *opaque,
}
/* RDMA postcopy need a separate queue pair for return path */
if (migrate_postcopy()) {
if (migrate_postcopy() || migrate_use_return_path()) {
rdma_return_path = qemu_rdma_data_init(host_port, errp);
if (rdma_return_path == NULL) {

View File

@ -8,6 +8,7 @@
#include "qemu/osdep.h"
#include "qapi/qapi-types-migration.h"
#include "migration.h"
#include CONFIG_DEVICES
#ifdef CONFIG_VFIO
#include "hw/vfio/vfio-common.h"
@ -17,7 +18,6 @@ void populate_vfio_info(MigrationInfo *info)
{
#ifdef CONFIG_VFIO
if (vfio_mig_active()) {
info->has_vfio = true;
info->vfio = g_malloc0(sizeof(*info->vfio));
info->vfio->transferred = vfio_mig_bytes_transferred();
}

View File

@ -12,6 +12,7 @@
*/
#include "qemu/osdep.h"
#include "qemu/cutils.h"
#include "qemu/host-utils.h"
#include "xbzrle.h"
/*
@ -196,10 +197,6 @@ int xbzrle_encode_buffer_avx512(uint8_t *old_buf, uint8_t *new_buf, int slen,
__m512i r = _mm512_set1_epi32(0);
while (count512s) {
if (d + 2 > dlen) {
return -1;
}
int bytes_to_check = 64;
uint64_t mask = 0xffffffffffffffff;
if (count512s == 1) {
@ -215,6 +212,9 @@ int xbzrle_encode_buffer_avx512(uint8_t *old_buf, uint8_t *new_buf, int slen,
bool is_same = (comp & 0x1);
while (bytes_to_check) {
if (d + 2 > dlen) {
return -1;
}
if (is_same) {
if (nzrun_len) {
d += uleb128_encode_small(dst + d, nzrun_len);
@ -233,7 +233,7 @@ int xbzrle_encode_buffer_avx512(uint8_t *old_buf, uint8_t *new_buf, int slen,
break;
}
never_same = false;
num = __builtin_ctzll(~comp);
num = ctz64(~comp);
num = (num < bytes_to_check) ? num : bytes_to_check;
zrun_len += num;
bytes_to_check -= num;
@ -262,7 +262,7 @@ int xbzrle_encode_buffer_avx512(uint8_t *old_buf, uint8_t *new_buf, int slen,
nzrun_len += 64;
break;
}
num = __builtin_ctzll(comp);
num = ctz64(comp);
num = (num < bytes_to_check) ? num : bytes_to_check;
nzrun_len += num;
bytes_to_check -= num;