migration: Remove qemu_host_page_size

Replace with the maximum of the real host page size
and the target page size.  This is an exact replacement.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20240102015808.132373-12-richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2024-01-02 12:57:46 +11:00
parent b36b2b1d3d
commit 5d2203691e
1 changed files with 18 additions and 4 deletions

View File

@ -2934,7 +2934,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
{ {
RAMState **rsp = opaque; RAMState **rsp = opaque;
RAMBlock *block; RAMBlock *block;
int ret; int ret, max_hg_page_size;
if (compress_threads_save_setup()) { if (compress_threads_save_setup()) {
return -1; return -1;
@ -2949,6 +2949,12 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
} }
(*rsp)->pss[RAM_CHANNEL_PRECOPY].pss_channel = f; (*rsp)->pss[RAM_CHANNEL_PRECOPY].pss_channel = f;
/*
* ??? Mirrors the previous value of qemu_host_page_size,
* but is this really what was intended for the migration?
*/
max_hg_page_size = MAX(qemu_real_host_page_size(), TARGET_PAGE_SIZE);
WITH_RCU_READ_LOCK_GUARD() { WITH_RCU_READ_LOCK_GUARD() {
qemu_put_be64(f, ram_bytes_total_with_ignored() qemu_put_be64(f, ram_bytes_total_with_ignored()
| RAM_SAVE_FLAG_MEM_SIZE); | RAM_SAVE_FLAG_MEM_SIZE);
@ -2957,8 +2963,8 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
qemu_put_byte(f, strlen(block->idstr)); qemu_put_byte(f, strlen(block->idstr));
qemu_put_buffer(f, (uint8_t *)block->idstr, strlen(block->idstr)); qemu_put_buffer(f, (uint8_t *)block->idstr, strlen(block->idstr));
qemu_put_be64(f, block->used_length); qemu_put_be64(f, block->used_length);
if (migrate_postcopy_ram() && block->page_size != if (migrate_postcopy_ram() &&
qemu_host_page_size) { block->page_size != max_hg_page_size) {
qemu_put_be64(f, block->page_size); qemu_put_be64(f, block->page_size);
} }
if (migrate_ignore_shared()) { if (migrate_ignore_shared()) {
@ -3791,6 +3797,7 @@ static int parse_ramblock(QEMUFile *f, RAMBlock *block, ram_addr_t length)
int ret = 0; int ret = 0;
/* ADVISE is earlier, it shows the source has the postcopy capability on */ /* ADVISE is earlier, it shows the source has the postcopy capability on */
bool postcopy_advised = migration_incoming_postcopy_advised(); bool postcopy_advised = migration_incoming_postcopy_advised();
int max_hg_page_size;
assert(block); assert(block);
@ -3808,9 +3815,16 @@ static int parse_ramblock(QEMUFile *f, RAMBlock *block, ram_addr_t length)
return ret; return ret;
} }
} }
/*
* ??? Mirrors the previous value of qemu_host_page_size,
* but is this really what was intended for the migration?
*/
max_hg_page_size = MAX(qemu_real_host_page_size(), TARGET_PAGE_SIZE);
/* For postcopy we need to check hugepage sizes match */ /* For postcopy we need to check hugepage sizes match */
if (postcopy_advised && migrate_postcopy_ram() && if (postcopy_advised && migrate_postcopy_ram() &&
block->page_size != qemu_host_page_size) { block->page_size != max_hg_page_size) {
uint64_t remote_page_size = qemu_get_be64(f); uint64_t remote_page_size = qemu_get_be64(f);
if (remote_page_size != block->page_size) { if (remote_page_size != block->page_size) {
error_report("Mismatched RAM page size %s " error_report("Mismatched RAM page size %s "