From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Thomas Lamprecht <t.lamprecht@proxmox.com>,
qemu-discuss@nongnu.org, edk2-devel-01 <edk2-devel@lists.01.org>
Subject: Re: How to handle pflash backed OVMF FW upgrade and live migration best?
Date: Fri, 2 Mar 2018 12:53:46 +0000 [thread overview]
Message-ID: <20180302125345.GA8948@work-vm> (raw)
In-Reply-To: <03691be2-0fcd-ace6-2ec9-d005f85782c3@redhat.com>
* Laszlo Ersek (lersek@redhat.com) wrote:
> CC Dave
>
> On 03/01/18 12:21, Thomas Lamprecht wrote:
> > Hi,
> >
> > I'm currently evaluating how to update the firmware (OVMF) code image
> > without impacting a KVM/QEMU VM on live migration. I.e., the FW code lives
> > under /usr/share/OVMF/OVMF_CODE.fd and gets passed to the QEMU command with:
> >
> > qemu-binary [...] -drive "if=pflash,unit=0,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd"
> >
> > Now if the target node has an updated version of OVMF the VM does not really
> > likes that, as from its POV it gets effectively another code image loaded
> > from one moment at the other without any notice.
>
> This should not cause any issues. On the destination host, the
> destination QEMU instance should load the (different) OVMF_CODE.fd image
> into the pflash chip, at startup. However, the incoming migration stream
> contains, as a RAMBlock, the original OVMF_CODE.fd image. In other
> words, the original firmware image is migrated (in memory, as part of
> the migration stream) too.
Yep.
> (
>
> BTW, there is very little firmware code in OVMF that actually *executes*
> from pflash -- that's just the SEC module. SEC decompresses the PEI and
> DXE firmware volumes from pflash to RAM, and the rest of the firmware
> runs from normal RAM. This applies to runtime firmware services as well.
> So about the only times when OVMF_CODE.fd (in the pflash chip) and
> migration intersect are:
> - if you migrate while SEC is running from pflash (i.e. the earliest
> part of the boot),
> - if you warm-reboot on the destination host after migration -- in this
> case, the OVMF_CODE.fd binary (that got migrated in the pflash RAMBlock
> from the source host) will again boot from pflash.
>
> )
>
> > So my questions is if it would make sense to see this read-only pflash
> > content as "VM state" and send it over during live migration?
>
> That's what already happens.
>
> Now, if you have a differently *sized* OVMF_CODE.fd image on the
> destination host, that could be a problem. Avoiding such problems is an
> IT / distro job.
Yeh; padding the binaries to a power-of-2 with a bit of space left is
a good rule of thumb.
> There are some "build aspects" of OVMF that can make two OVMF binaries
> "incompatible" in this sense. Using *some* different build flags it's
> also possible to make (a) an OVMF binary and (b) a varstore file
> originally created for another OVMF binary, incompatible.
Fun.
> > This would
> > make migration way easier. Else we need to save all FW files and track which
> > one the VM is using, so that when starting the migration target VM we pass
> > along the correct pflash drive file. Sending over a pflash drive could maybe
> > only get done when a special flag is set for the pflash drive?
> >
> > As said I can work around in our management stack, but saving the FW image
> > and tracking which VM uses what version, and that cluster wide, may get
> > quite a headache and we would need to keep all older OVMF binaries around...
>
> When you deploy new OVMF binaries (packages) to a subset of your
> virtualization hosts, you are responsible for keeping those compatible.
> (They *can* contain code updates, but those updates have to be
> compatible.) If a new OVMF binary is built that is known to be
> incompatible, then it has to be installed under a different pathname
> (either via a separate package; or in the same package, but still under
> a different pathname).
>
> To give you the simplest example, binaries (and varstores) corresponding
> to FD_SIZE_2MB and FD_SIZE_4MB are incompatible. If a domain is
> originally defined on top of an FD_SIZE_2MB OVMF, then it likely cannot
> be migrated to a host where the same OVMF pathname refers to an
> FD_SIZE_4MB binary. If you have a mixed environment, then you need to
> carry both binaries to all hosts (and if you backport fixes from
> upstream edk2, you need to backport those to both binaries).
>
> In addition, assuming the domain is powered down for good (the QEMU
> process terminates), and you update the domain XML from the FD_SIZE_2MB
> OVMF binary to the FD_SIZE_4MB binary, you *also* have to
> delete/recreate the domain's variable store file (losing all UEFI
> variables the domain has accumulated until then). This is because the
> FD_SIZE_4MB binary is incompatible with the varstore that was originally
> created for the FD_SIZE_2MB binary (and vice versa).
I assume that gives a clear and obvious error message - right?
Dave
> Thanks
> Laszlo
>
> > If I'm missing something and there's already an easy way for this I'd be
> > very happy to hear from it.
> >
> > Besides qemu-discuss I posted it to edk2-devel as there maybe more people
> > are in the QEMU and OVMF user intersection. :)
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2018-03-02 12:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 11:21 How to handle pflash backed OVMF FW upgrade and live migration best? Thomas Lamprecht
2018-03-02 12:19 ` Laszlo Ersek
2018-03-02 12:53 ` Dr. David Alan Gilbert [this message]
2018-03-05 8:29 ` Laszlo Ersek
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-list 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=20180302125345.GA8948@work-vm \
--to=devel@edk2.groups.io \
/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