OSDN Git Service

migration: Fix migration crash when target psize larger than host
authorPeter Xu <peterx@redhat.com>
Fri, 20 Jan 2023 16:31:47 +0000 (11:31 -0500)
committerJuan Quintela <quintela@redhat.com>
Mon, 6 Feb 2023 18:22:56 +0000 (19:22 +0100)
commit301d7ffe5f630dc5d0e2a3638b9eae7a00b1088a
treea8cd4918a0505460881c0e9f8a52e379bdda12a7
parent6661b8c7fe3f8b5687d2d90f7b4f3f23d70e3e8b
migration: Fix migration crash when target psize larger than host

Commit d9e474ea56 overlooked the case where the target psize is even larger
than the host psize.  One example is Alpha has 8K page size and migration
will start to crash the source QEMU when running Alpha migration on x86.

Fix it by detecting that case and set host start/end just to cover the
single page to be migrated.

This will slightly optimize the common case where host psize equals to
guest psize so we don't even need to do the roundups, but that's trivial.

Cc: qemu-stable@nongnu.org
Reported-by: Thomas Huth <thuth@redhat.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1456
Fixes: d9e474ea56 ("migration: Teach PSS about host page")
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
migration/ram.c