From: Igor Mammedov <imammedo@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
aliguori@amazon.com, qemu-devel@nongnu.org, afaerber@suse.de,
kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] pc: add 'etc/reserved-memory-end' fw_cfg interface for SeaBIOS
Date: Thu, 14 Nov 2013 14:37:31 +0100 [thread overview]
Message-ID: <20131114143731.1b9aa8a0@thinkpad> (raw)
In-Reply-To: <20131114074012.GD12673@redhat.com>
On Thu, 14 Nov 2013 09:40:12 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Wed, Nov 13, 2013 at 01:04:10PM +0100, Igor Mammedov wrote:
> > On Wed, 13 Nov 2013 00:10:39 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> >
> > > On Tue, Nov 12, 2013 at 07:26:02PM +0100, Paolo Bonzini wrote:
> > > > Il 12/11/2013 14:58, Igor Mammedov ha scritto:
> > > > > 'etc/reserved-memory-end' will allow QEMU to tell BIOS where PCI
> > > > > BARs mapping could safely start in high memory.
> > > > >
> > > > > Allowing BIOS to start mapping 64-bit PCI BARs at address where it
> > > > > wouldn't conflict with other mappings QEMU might place before it.
> > > > >
> > > > > That permits QEMU to reserve extra address space before
> > > > > 64-bit PCI hole for memory hotplug.
> > > >
> > > > I may be royally wrong, but I think the new file should only be added to
> > > > new machine types. Otherwise, after migrating old machine types from
> > > > new QEMU to old QEMU, you may end up with PCI BARs mapped outside the
> > > > "PCI windows" that exist until before patch 1/2 of this series.
> > > >
> > > > Does this make sense?
> > >
> > > Yes.
> > > Generally FW CFG must not be added/removed for a given machine types,
> > > otherwise guest that is migrated while reading it will
> > > get a corrupted result: half old and half new.
> >
> > Is it true for a file 'etc/reserved-memory-end' though?
>
> It's true for any FW CFG entry.
>
> > I've debugged SeaBIOS to learn more about it, and new->old migration with
> > following reboot, showed that file is not found by SeaBIOS (well since old
> > QEMU doesn't have it), as result SeaBIOS fallbacks to the old behavior
> > placing 64-PCI bars right above ram_over_4G as it was intended.
> >
> > And with 'etc/reserved-memory-end' == ram_over_4G_end as it is in this
> > patch, there isn't issue whatsoever.
> >
> > Looks like there is no migrations issues with files, provided SeaBIOS knows
> > how to deal with a missing file.
>
> Here's an example of the issue:
>
> qemu_cfg_read_entry(&count, QEMU_CFG_FILE_DIR, sizeof(count));
>
> 1. <<<<<<
>
> count = be32_to_cpu(count);
>
> u32 e;
> for (e = 0; e < count; e++) {
> struct QemuCfgFile qfile;
> qemu_cfg_read(&qfile, sizeof(qfile));
> qemu_romfile_add(qfile.name, be16_to_cpu(qfile.select)
> , 0, be32_to_cpu(qfile.size));
> }
>
> 2. <<<<<<<
>
>
> If migration happens during qemu_cfg_read_entry before point 1, you can
> get a byte from old count and a byte from new, resulting in a corrupt
> count.
>
> If migration happens at point 2, you will get incorrect
> mapping between file selector and name. System will likely
> fail to boot.
>
> There are probably other issues.
>
> Bottom line: FW CFG is guest visible state. Migration must not change
> it.
Thanks for explanation,
I'll resend this patch with machine compatibility changes.
>
> > --
> > Regards,
> > Igor
--
Regards,
Igor
next prev parent reply other threads:[~2013-11-14 13:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-12 13:58 [Qemu-devel] [PATCH for-1.8 0/2 v3] pc: inform SeaBIOS where 64-bit PCI hole begins Igor Mammedov
2013-11-12 13:58 ` [Qemu-devel] [PATCH 1/2] pc: map PCI address space as catchall region for not mapped addresses Igor Mammedov
2013-11-12 16:29 ` Laszlo Ersek
2013-11-12 13:58 ` [Qemu-devel] [PATCH 2/2] pc: add 'etc/reserved-memory-end' fw_cfg interface for SeaBIOS Igor Mammedov
2013-11-12 18:26 ` Paolo Bonzini
2013-11-12 20:17 ` Igor Mammedov
2013-11-12 22:10 ` Michael S. Tsirkin
2013-11-12 23:03 ` Paolo Bonzini
2013-11-13 12:04 ` Igor Mammedov
2013-11-14 7:40 ` Michael S. Tsirkin
2013-11-14 13:37 ` Igor Mammedov [this message]
2013-11-15 1:07 ` [Qemu-devel] [PATCH 2/2 v4] " Igor Mammedov
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=20131114143731.1b9aa8a0@thinkpad \
--to=imammedo@redhat.com \
--cc=afaerber@suse.de \
--cc=aliguori@amazon.com \
--cc=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 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.