* [PATCH v2] exec/rom_reset: Free rom data during inmigrate skip
@ 2020-03-13 15:59 Dr. David Alan Gilbert (git)
2020-03-13 16:02 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2020-03-13 15:59 UTC (permalink / raw)
To: qemu-devel, pbonzini, philmd, yvugenfi, peter.maydell
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Commit 355477f8c73e9 skips rom reset when we're an incoming migration
so as not to overwrite shared ram in the ignore-shared migration
optimisation.
However, it's got an unexpected side effect that because it skips
freeing the ROM data, when rom_reset gets called later on, after
migration (e.g. during a reboot), the ROM does get reset to the original
file contents. Because of seabios/x86's weird reboot process
this confuses a reboot into hanging after a migration.
Fixes: 355477f8c73e9 ("migration: do not rom_reset() during incoming migration")
https://bugzilla.redhat.com/show_bug.cgi?id=1809380
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
hw/core/loader.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index d1b78f60cd..eeef6da9a1 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -1119,19 +1119,26 @@ static void rom_reset(void *unused)
{
Rom *rom;
- /*
- * We don't need to fill in the RAM with ROM data because we'll fill
- * the data in during the next incoming migration in all cases. Note
- * that some of those RAMs can actually be modified by the guest on ARM
- * so this is probably the only right thing to do here.
- */
- if (runstate_check(RUN_STATE_INMIGRATE))
- return;
-
QTAILQ_FOREACH(rom, &roms, next) {
if (rom->fw_file) {
continue;
}
+ /*
+ * We don't need to fill in the RAM with ROM data because we'll fill
+ * the data in during the next incoming migration in all cases. Note
+ * that some of those RAMs can actually be modified by the guest.
+ */
+ if (runstate_check(RUN_STATE_INMIGRATE)) {
+ if (rom->data && rom->isrom) {
+ /*
+ * Free it so that a rom_reset after migration doesn't
+ * overwrite a potentially modified 'rom'.
+ */
+ rom_free_data(rom);
+ }
+ continue;
+ }
+
if (rom->data == NULL) {
continue;
}
--
2.24.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] exec/rom_reset: Free rom data during inmigrate skip
2020-03-13 15:59 [PATCH v2] exec/rom_reset: Free rom data during inmigrate skip Dr. David Alan Gilbert (git)
@ 2020-03-13 16:02 ` Peter Maydell
2020-03-14 9:59 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2020-03-13 16:02 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git)
Cc: Paolo Bonzini, Yan Vugenfirer, Philippe Mathieu-Daudé,
QEMU Developers
On Fri, 13 Mar 2020 at 15:59, Dr. David Alan Gilbert (git)
<dgilbert@redhat.com> wrote:
>
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Commit 355477f8c73e9 skips rom reset when we're an incoming migration
> so as not to overwrite shared ram in the ignore-shared migration
> optimisation.
> However, it's got an unexpected side effect that because it skips
> freeing the ROM data, when rom_reset gets called later on, after
> migration (e.g. during a reboot), the ROM does get reset to the original
> file contents. Because of seabios/x86's weird reboot process
> this confuses a reboot into hanging after a migration.
>
> Fixes: 355477f8c73e9 ("migration: do not rom_reset() during incoming migration")
> https://bugzilla.redhat.com/show_bug.cgi?id=1809380
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> hw/core/loader.c | 25 ++++++++++++++++---------
> 1 file changed, 16 insertions(+), 9 deletions(-)
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] exec/rom_reset: Free rom data during inmigrate skip
2020-03-13 16:02 ` Peter Maydell
@ 2020-03-14 9:59 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-03-14 9:59 UTC (permalink / raw)
To: Peter Maydell, Dr. David Alan Gilbert (git)
Cc: Yan Vugenfirer, Philippe Mathieu-Daudé, QEMU Developers
On 13/03/20 17:02, Peter Maydell wrote:
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-14 9:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 15:59 [PATCH v2] exec/rom_reset: Free rom data during inmigrate skip Dr. David Alan Gilbert (git)
2020-03-13 16:02 ` Peter Maydell
2020-03-14 9:59 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.