Migration fixes pull 2022-08-02

Small migration (and virtiofsd) fixes.
 
 Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEERfXHG0oMt/uXep+pBRYzHrxb/ecFAmLpR80ACgkQBRYzHrxb
 /edDiQ//VWx6VFpq3j/cFe+aZudCJWbHD5HI8e0wABoCAMzfYnRRq5pMP7DaVy/x
 Su0Lr6AO7vqSZzAqjsSm4DLQJHYM28YXxo0un/aJvnOZFGiXJzFe9OIE1LUwekQe
 g6OrsyhOAf7wHY9MsoC6RRitKdSo/z7YZYZY6wEv2cyIJDda1+b9jpD6mWADQ2z1
 7eU5T0Kxfg2nArgF1MwgMWzPzjw4xN6BbqLLkWKdf3RD8Vl0BOdwxfXPDECqouUi
 08vcNB4jRV7WSJ5mnOEW2EMQvgmUkSe9HUhMhkD39LmbeeJ4a84oRoKZkQuvrb1h
 qsbwoMlWhg8nxqyqB7ChTUw/27V3lfzlr/k6r6ExXsDL+zUwJXg4LrFuzyaqWdb2
 vH5cp/mZkSho+PcIF+KeFQMEj51yV/y0ucU4JWwyyKCnGoJYofmZnBWG2czGOotq
 2qX44srufFkTDISpZ+NVUsaFl06nTrS7W9aTZdISYpGuxzHphOtrnYj8Pqqdwv4B
 F6CyNmUcVbLLnGIRASYYEYMByfptmiRQgGhOtv1IJyYgzIgg0PJQUR5Dbjgb96vR
 0jhvLucKAkBrQaxkxxMVuIUJ9JdLeVbyEaSrc38qfr3FinRt8rgNr0mnFPAcNS7s
 oAy4Ei9jZ3MoAITs/JD+ODglC/f58o0oHaSA6RFrOxmxxkrXowk=
 =b2BF
 -----END PGP SIGNATURE-----

Merge tag 'pull-migration-20220802c' of https://gitlab.com/dagrh/qemu into staging

Migration fixes pull 2022-08-02

Small migration (and virtiofsd) fixes.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEERfXHG0oMt/uXep+pBRYzHrxb/ecFAmLpR80ACgkQBRYzHrxb
# /edDiQ//VWx6VFpq3j/cFe+aZudCJWbHD5HI8e0wABoCAMzfYnRRq5pMP7DaVy/x
# Su0Lr6AO7vqSZzAqjsSm4DLQJHYM28YXxo0un/aJvnOZFGiXJzFe9OIE1LUwekQe
# g6OrsyhOAf7wHY9MsoC6RRitKdSo/z7YZYZY6wEv2cyIJDda1+b9jpD6mWADQ2z1
# 7eU5T0Kxfg2nArgF1MwgMWzPzjw4xN6BbqLLkWKdf3RD8Vl0BOdwxfXPDECqouUi
# 08vcNB4jRV7WSJ5mnOEW2EMQvgmUkSe9HUhMhkD39LmbeeJ4a84oRoKZkQuvrb1h
# qsbwoMlWhg8nxqyqB7ChTUw/27V3lfzlr/k6r6ExXsDL+zUwJXg4LrFuzyaqWdb2
# vH5cp/mZkSho+PcIF+KeFQMEj51yV/y0ucU4JWwyyKCnGoJYofmZnBWG2czGOotq
# 2qX44srufFkTDISpZ+NVUsaFl06nTrS7W9aTZdISYpGuxzHphOtrnYj8Pqqdwv4B
# F6CyNmUcVbLLnGIRASYYEYMByfptmiRQgGhOtv1IJyYgzIgg0PJQUR5Dbjgb96vR
# 0jhvLucKAkBrQaxkxxMVuIUJ9JdLeVbyEaSrc38qfr3FinRt8rgNr0mnFPAcNS7s
# oAy4Ei9jZ3MoAITs/JD+ODglC/f58o0oHaSA6RFrOxmxxkrXowk=
# =b2BF
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 02 Aug 2022 08:50:37 AM PDT
# gpg:                using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full]

* tag 'pull-migration-20220802c' of https://gitlab.com/dagrh/qemu:
  virtiofsd: Disable killpriv_v2 by default
  migration: Define BLK_MIG_BLOCK_SIZE as unsigned long long
  migration: Assert that migrate_multifd_compression() returns an in-range value
  Revert "migration: Simplify unqueue_page()"
  migration: add remaining params->has_* = true in migration_instance_init()

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2022-08-02 10:03:18 -07:00
commit 430a388ef4
5 changed files with 36 additions and 24 deletions

View File

@ -28,7 +28,7 @@
#include "sysemu/block-backend.h"
#include "trace.h"
#define BLK_MIG_BLOCK_SIZE (1 << 20)
#define BLK_MIG_BLOCK_SIZE (1ULL << 20)
#define BDRV_SECTORS_PER_DIRTY_CHUNK (BLK_MIG_BLOCK_SIZE >> BDRV_SECTOR_BITS)
#define BLK_MIG_FLAG_DEVICE_BLOCK 0x01

View File

@ -2617,6 +2617,7 @@ MultiFDCompression migrate_multifd_compression(void)
s = migrate_get_current();
assert(s->parameters.multifd_compression < MULTIFD_COMPRESSION__MAX);
return s->parameters.multifd_compression;
}
@ -4451,6 +4452,7 @@ static void migration_instance_init(Object *obj)
/* Set has_* up only for parameter checks */
params->has_compress_level = true;
params->has_compress_threads = true;
params->has_compress_wait_thread = true;
params->has_decompress_threads = true;
params->has_throttle_trigger_threshold = true;
params->has_cpu_throttle_initial = true;
@ -4471,6 +4473,9 @@ static void migration_instance_init(Object *obj)
params->has_announce_max = true;
params->has_announce_rounds = true;
params->has_announce_step = true;
params->has_tls_creds = true;
params->has_tls_hostname = true;
params->has_tls_authz = true;
qemu_sem_init(&ms->postcopy_pause_sem, 0);
qemu_sem_init(&ms->postcopy_pause_rp_sem, 0);

View File

@ -1612,7 +1612,6 @@ static RAMBlock *unqueue_page(RAMState *rs, ram_addr_t *offset)
{
struct RAMSrcPageRequest *entry;
RAMBlock *block = NULL;
size_t page_size;
if (!postcopy_has_request(rs)) {
return NULL;
@ -1629,13 +1628,10 @@ static RAMBlock *unqueue_page(RAMState *rs, ram_addr_t *offset)
entry = QSIMPLEQ_FIRST(&rs->src_page_requests);
block = entry->rb;
*offset = entry->offset;
page_size = qemu_ram_pagesize(block);
/* Each page request should only be multiple page size of the ramblock */
assert((entry->len % page_size) == 0);
if (entry->len > page_size) {
entry->len -= page_size;
entry->offset += page_size;
if (entry->len > TARGET_PAGE_SIZE) {
entry->len -= TARGET_PAGE_SIZE;
entry->offset += TARGET_PAGE_SIZE;
} else {
memory_region_unref(block->mr);
QSIMPLEQ_REMOVE_HEAD(&rs->src_page_requests, next_req);
@ -1643,9 +1639,6 @@ static RAMBlock *unqueue_page(RAMState *rs, ram_addr_t *offset)
migration_consume_urgent_request();
}
trace_unqueue_page(block->idstr, *offset,
test_bit((*offset >> TARGET_PAGE_BITS), block->bmap));
return block;
}
@ -2069,8 +2062,30 @@ static bool get_queued_page(RAMState *rs, PageSearchStatus *pss)
{
RAMBlock *block;
ram_addr_t offset;
bool dirty;
block = unqueue_page(rs, &offset);
do {
block = unqueue_page(rs, &offset);
/*
* We're sending this page, and since it's postcopy nothing else
* will dirty it, and we must make sure it doesn't get sent again
* even if this queue request was received after the background
* search already sent it.
*/
if (block) {
unsigned long page;
page = offset >> TARGET_PAGE_BITS;
dirty = test_bit(page, block->bmap);
if (!dirty) {
trace_get_queued_page_not_dirty(block->idstr, (uint64_t)offset,
page);
} else {
trace_get_queued_page(block->idstr, (uint64_t)offset, page);
}
}
} while (block && !dirty);
if (block) {
/* See comment above postcopy_preempted_contains() */

View File

@ -85,6 +85,8 @@ put_qlist_end(const char *field_name, const char *vmsd_name) "%s(%s)"
qemu_file_fclose(void) ""
# ram.c
get_queued_page(const char *block_name, uint64_t tmp_offset, unsigned long page_abs) "%s/0x%" PRIx64 " page_abs=0x%lx"
get_queued_page_not_dirty(const char *block_name, uint64_t tmp_offset, unsigned long page_abs) "%s/0x%" PRIx64 " page_abs=0x%lx"
migration_bitmap_sync_start(void) ""
migration_bitmap_sync_end(uint64_t dirty_pages) "dirty_pages %" PRIu64
migration_bitmap_clear_dirty(char *str, uint64_t start, uint64_t size, unsigned long page) "rb %s start 0x%"PRIx64" size 0x%"PRIx64" page 0x%lx"
@ -110,7 +112,6 @@ ram_save_iterate_big_wait(uint64_t milliconds, int iterations) "big wait: %" PRI
ram_load_complete(int ret, uint64_t seq_iter) "exit_code %d seq iteration %" PRIu64
ram_write_tracking_ramblock_start(const char *block_id, size_t page_size, void *addr, size_t length) "%s: page_size: %zu addr: %p length: %zu"
ram_write_tracking_ramblock_stop(const char *block_id, size_t page_size, void *addr, size_t length) "%s: page_size: %zu addr: %p length: %zu"
unqueue_page(char *block, uint64_t offset, bool dirty) "ramblock '%s' offset 0x%"PRIx64" dirty %d"
postcopy_preempt_triggered(char *str, unsigned long page) "during sending ramblock %s offset 0x%lx"
postcopy_preempt_restored(char *str, unsigned long page) "ramblock %s offset 0x%lx"
postcopy_preempt_hit(char *str, uint64_t offset) "ramblock %s offset 0x%"PRIx64

View File

@ -767,19 +767,10 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
fuse_log(FUSE_LOG_DEBUG, "lo_init: enabling killpriv_v2\n");
conn->want |= FUSE_CAP_HANDLE_KILLPRIV_V2;
lo->killpriv_v2 = 1;
} else if (lo->user_killpriv_v2 == -1 &&
conn->capable & FUSE_CAP_HANDLE_KILLPRIV_V2) {
/*
* User did not specify a value for killpriv_v2. By default enable it
* if connection offers this capability
*/
fuse_log(FUSE_LOG_DEBUG, "lo_init: enabling killpriv_v2\n");
conn->want |= FUSE_CAP_HANDLE_KILLPRIV_V2;
lo->killpriv_v2 = 1;
} else {
/*
* Either user specified to disable killpriv_v2, or connection does
* not offer this capability. Disable killpriv_v2 in both the cases
* Either user specified to disable killpriv_v2, or did not
* specify anything. Disable killpriv_v2 in both the cases.
*/
fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling killpriv_v2\n");
conn->want &= ~FUSE_CAP_HANDLE_KILLPRIV_V2;