Migration & virtiofs fixes for 5.2

A bunch of small fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEERfXHG0oMt/uXep+pBRYzHrxb/ecFAl+tgEEACgkQBRYzHrxb
 /ecT7g/5Aamy5RpHUibvkpBq6SNEgePLwrifVL934WCMykzkktOWM4dMMjW1klXS
 b/0a+YUaUS0Ig2NKEJQxFEF1JTevQ74I/ZeqmMJCghkprjlMT7Px4HpNiaL/Dmcn
 19U/GnDTdpDfZWj1XjAcdd72rEbn8Pd0npOOhIMXnlUiEi3/kmdDllViK7bi1rwG
 bkUWtn9WffuVmE99HzgqIXOdScu2BV/j2w30xZqfk/luXJFVPnuKSfGjdpBeJ+XY
 ugrduubGrT/DRVWqbKHxAjA0oBGloPU9oSBOhw3r0PePJNAbwMiq3fW8njhTwPh7
 uFw2RJWUmv8Q0l46ogF/xR+kI1g22sn2WoeIYr6tYnKgYw7eM+1q+Flkk2NHou9I
 xaIxeCES5rsEq/5Q1fkit6qbkfbohgB6tKZtWtmhKOVQRHKdoQzc4kWOiQjFr6E9
 kY5dQhKShB6egYt/diqR+dxQvy3EnYWnIFtgYZ+egkG2jgrZ4+GjIACXaZ6GQ05J
 wHVNOx09bRMIC+XSAosHGPw/0T4K+GoBrusTdhvFgRQGQKKZ2bH6VLuDvPa8oa0p
 G8ySPX0jXrW+wSX2WCpHUYaohGVLyOmzrPLMZUtz3DREVVQQXgw28pKT4sd+xyXj
 OkcIZ+kZmjja9R8CvB01oTBqIZLQw7V+rbjNiHDJuUF670pTUoQ=
 =tfAA
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20201112a' into staging

Migration & virtiofs fixes for 5.2

A bunch of small fixes.

# gpg: Signature made Thu 12 Nov 2020 18:34:41 GMT
# gpg:                using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full]
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-migration-20201112a:
  virtiofsd: check whether strdup lo.source return NULL in main func
  virtiofsd: check whether lo_map_reserve returns NULL in, main func
  tools/virtiofsd/buffer.c: check whether buf is NULL in fuse_bufvec_advance func
  virtiofsd: Announce submounts even without statx()
  migration: handle CANCELLING state in migration_completion()
  multifd/tls: fix memoryleak of the QIOChannelSocket object when cancelling migration
  migration/dirtyrate: simplify includes in dirtyrate.c
  migration: fix uninitialized variable warning in migrate_send_rp_req_pages()
  migration/multifd: fix hangup with TLS-Multifd due to blocking handshake
  ACPI: Avoid infinite recursion when dump-vmstate
  migration/ram: Fix hexadecimal format string specifier

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-11-12 20:13:01 +00:00
commit 4cfac0152e
7 changed files with 52 additions and 23 deletions

View File

@ -322,6 +322,16 @@ static const VMStateDescription vmstate_ged_state = {
}
};
static const VMStateDescription vmstate_ghes = {
.name = "acpi-ghes",
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
VMSTATE_UINT64(ghes_addr_le, AcpiGhesState),
VMSTATE_END_OF_LIST()
},
};
static bool ghes_needed(void *opaque)
{
AcpiGedState *s = opaque;
@ -335,7 +345,7 @@ static const VMStateDescription vmstate_ghes_state = {
.needed = ghes_needed,
.fields = (VMStateField[]) {
VMSTATE_STRUCT(ghes_state, AcpiGedState, 1,
vmstate_ghes_state, AcpiGhesState),
vmstate_ghes, AcpiGhesState),
VMSTATE_END_OF_LIST()
}
};

View File

@ -11,17 +11,12 @@
*/
#include "qemu/osdep.h"
#include <zlib.h>
#include "qapi/error.h"
#include "cpu.h"
#include "qemu/config-file.h"
#include "exec/memory.h"
#include "exec/ramblock.h"
#include "exec/target_page.h"
#include "qemu/rcu_queue.h"
#include "qapi/qapi-commands-migration.h"
#include "migration.h"
#include "ram.h"
#include "trace.h"
#include "dirtyrate.h"

View File

@ -365,7 +365,7 @@ int migrate_send_rp_req_pages(MigrationIncomingState *mis,
RAMBlock *rb, ram_addr_t start, uint64_t haddr)
{
void *aligned = (void *)(uintptr_t)(haddr & (-qemu_ram_pagesize(rb)));
bool received;
bool received = false;
WITH_QEMU_LOCK_GUARD(&mis->page_request_mutex) {
received = ramblock_recv_bitmap_test_byte_offset(rb, start);
@ -3061,6 +3061,8 @@ static void migration_completion(MigrationState *s)
qemu_savevm_state_complete_postcopy(s->to_dst_file);
trace_migration_completion_postcopy_end_after_complete();
} else if (s->state == MIGRATION_STATUS_CANCELLING) {
goto fail;
}
/*

View File

@ -739,6 +739,19 @@ static void multifd_tls_outgoing_handshake(QIOTask *task,
multifd_channel_connect(p, ioc, err);
}
static void *multifd_tls_handshake_thread(void *opaque)
{
MultiFDSendParams *p = opaque;
QIOChannelTLS *tioc = QIO_CHANNEL_TLS(p->c);
qio_channel_tls_handshake(tioc,
multifd_tls_outgoing_handshake,
p,
NULL,
NULL);
return NULL;
}
static void multifd_tls_channel_connect(MultiFDSendParams *p,
QIOChannel *ioc,
Error **errp)
@ -752,14 +765,13 @@ static void multifd_tls_channel_connect(MultiFDSendParams *p,
return;
}
object_unref(OBJECT(ioc));
trace_multifd_tls_outgoing_handshake_start(ioc, tioc, hostname);
qio_channel_set_name(QIO_CHANNEL(tioc), "multifd-tls-outgoing");
qio_channel_tls_handshake(tioc,
multifd_tls_outgoing_handshake,
p,
NULL,
NULL);
p->c = QIO_CHANNEL(tioc);
qemu_thread_create(&p->thread, "multifd-tls-handshake-worker",
multifd_tls_handshake_thread, p,
QEMU_THREAD_JOINABLE);
}
static bool multifd_channel_connect(MultiFDSendParams *p,

View File

@ -3741,7 +3741,7 @@ int ram_dirty_bitmap_reload(MigrationState *s, RAMBlock *block)
}
if (end_mark != RAMBLOCK_RECV_BITMAP_ENDING) {
error_report("%s: ramblock '%s' end mark incorrect: 0x%"PRIu64,
error_report("%s: ramblock '%s' end mark incorrect: 0x%"PRIx64,
__func__, block->idstr, end_mark);
ret = -EINVAL;
goto out;

View File

@ -246,6 +246,10 @@ static int fuse_bufvec_advance(struct fuse_bufvec *bufv, size_t len)
{
const struct fuse_buf *buf = fuse_bufvec_current(bufv);
if (!buf) {
return 0;
}
bufv->off += len;
assert(bufv->off <= buf->size);
if (bufv->off == buf->size) {

View File

@ -610,14 +610,6 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
"does not support it\n");
lo->announce_submounts = false;
}
#ifndef CONFIG_STATX
if (lo->announce_submounts) {
fuse_log(FUSE_LOG_WARNING, "lo_init: Cannot announce submounts, there "
"is no statx()\n");
lo->announce_submounts = false;
}
#endif
}
static void lo_getattr(fuse_req_t req, fuse_ino_t ino,
@ -3433,6 +3425,7 @@ int main(int argc, char *argv[])
.proc_self_fd = -1,
};
struct lo_map_elem *root_elem;
struct lo_map_elem *reserve_elem;
int ret = -1;
/* Don't mask creation mode, kernel already did that */
@ -3452,8 +3445,17 @@ int main(int argc, char *argv[])
* [1] Root inode
*/
lo_map_init(&lo.ino_map);
lo_map_reserve(&lo.ino_map, 0)->in_use = false;
reserve_elem = lo_map_reserve(&lo.ino_map, 0);
if (!reserve_elem) {
fuse_log(FUSE_LOG_ERR, "failed to alloc reserve_elem.\n");
goto err_out1;
}
reserve_elem->in_use = false;
root_elem = lo_map_reserve(&lo.ino_map, lo.root.fuse_ino);
if (!root_elem) {
fuse_log(FUSE_LOG_ERR, "failed to alloc root_elem.\n");
goto err_out1;
}
root_elem->inode = &lo.root;
lo_map_init(&lo.dirp_map);
@ -3515,6 +3517,10 @@ int main(int argc, char *argv[])
}
} else {
lo.source = strdup("/");
if (!lo.source) {
fuse_log(FUSE_LOG_ERR, "failed to strdup source\n");
goto err_out1;
}
}
if (lo.xattrmap) {