From: Peter Maydell <peter.maydell@linaro.org>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Yan Vugenfirer" <yvugenfi@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [PATCH] exec/rom_reset: Free rom data during inmigrate skip
Date: Fri, 13 Mar 2020 13:21:21 +0000 [thread overview]
Message-ID: <CAFEAcA8KPovUiycEr2hHb4LP0SL-hBCTNgkA9KFKMb6FQTceuQ@mail.gmail.com> (raw)
In-Reply-To: <20200313123014.206828-1-dgilbert@redhat.com>
On Fri, 13 Mar 2020 at 12:31, 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 | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
>
> 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 on ARM
> + * so this is probably the only right thing to do here.
> + */
> + if (runstate_check(RUN_STATE_INMIGRATE) && rom->data) {
> + /*
> + * Free it so that a rom_reset after migration doesn't overwrite a
> + * potentially modified 'rom'.
> + */
> + rom_free_data(rom);
Shouldn't this condition match the condition in rom_reset()
for when we call rom_free_data()? You want the behaviour
on a subsequent reset to match the behaviour you'd get
if you did a reset on the source end without the migration.
> + }
> +
> if (rom->data == NULL) {
> continue;
> }
If you put this check above your new one you wouldn't
need to check rom->data in it. Also it would make the
loop structure better match rom_reset(), which checks
rom->fw_file first, then rom->data, then has the
condition for "do we need to call rom_free_data()".
thanks
-- PMM
next prev parent reply other threads:[~2020-03-13 13:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 12:30 [PATCH] exec/rom_reset: Free rom data during inmigrate skip Dr. David Alan Gilbert (git)
2020-03-13 13:21 ` Peter Maydell [this message]
2020-03-13 13:22 ` Peter Maydell
2020-03-13 13:34 ` Dr. David Alan Gilbert
2020-03-13 13:39 ` Peter Maydell
2020-03-13 13:57 ` Dr. David Alan Gilbert
2020-03-13 14:23 ` Peter Maydell
2020-03-13 15:43 ` Dr. David Alan Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFEAcA8KPovUiycEr2hHb4LP0SL-hBCTNgkA9KFKMb6FQTceuQ@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=dgilbert@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yvugenfi@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).