From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Mohammed Gamal <mgamal@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Pedro Principeza <pedro.principeza@canonical.com>,
Dann Frazier <dann.frazier@canonical.com>,
Guilherme Piccoli <gpiccoli@canonical.com>,
qemu-devel@nongnu.org,
Christian Ehrhardt <christian.ehrhardt@canonical.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Laszlo Ersek <lersek@redhat.com>,
fw@gpiccoli.net, pbonzini@redhat.com, mtosatti@redhat.com,
rth@twiddle.net, kvm@vger.kernel.org, libvir-list@redhat.com
Subject: Re: [PATCH 2/2] x86/cpu: Handle GUEST_MAXPHYADDR < HOST_MAXPHYADDR for hosts that don't support it
Date: Wed, 8 Jul 2020 18:26:53 +0100 [thread overview]
Message-ID: <20200708172653.GL3229307@redhat.com> (raw)
In-Reply-To: <20200708171621.GA780932@habkost.net>
On Wed, Jul 08, 2020 at 01:16:21PM -0400, Eduardo Habkost wrote:
> (CCing libvir-list, and people who were included in the OVMF
> thread[1])
>
> [1] https://lore.kernel.org/qemu-devel/99779e9c-f05f-501b-b4be-ff719f140a88@canonical.com/
>
> On Fri, Jun 19, 2020 at 05:53:44PM +0200, Mohammed Gamal wrote:
> > If the CPU doesn't support GUEST_MAXPHYADDR < HOST_MAXPHYADDR we
> > let QEMU choose to use the host MAXPHYADDR and print a warning to the
> > user.
> >
> > Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
> > ---
> > target/i386/cpu.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> > index b1b311baa2..91c57117ce 100644
> > --- a/target/i386/cpu.c
> > +++ b/target/i386/cpu.c
> > @@ -6589,6 +6589,17 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
> > uint32_t host_phys_bits = x86_host_phys_bits();
> > static bool warned;
> >
> > + /*
> > + * If host doesn't support setting physical bits on the guest,
> > + * report it and return
> > + */
> > + if (cpu->phys_bits < host_phys_bits &&
> > + !kvm_has_smaller_maxphyaddr()) {
> > + warn_report("Host doesn't support setting smaller phys-bits."
> > + " Using host phys-bits\n");
> > + cpu->phys_bits = host_phys_bits;
> > + }
> > +
>
> This looks like a regression from existing behavior. Today,
> using smaller phys-bits doesn't crash most guests, and still
> allows live migration to smaller hosts. I agree using the host
> phys-bits is probably a better default, but we shouldn't override
> options set explicitly in the command line.
Yeah, this looks like it would cause a behaviour change / regression
so looks questionable.
> Also, it's important that we work with libvirt and management
> software to ensure they have appropriate APIs to choose what to
> do when a cluster has hosts with different MAXPHYADDR.
There's been so many complex discussions that it is hard to have any
understanding of what we should be doing going forward. There's enough
problems wrt phys bits, that I think we would benefit from a doc that
outlines the big picture expectation for how to handle this in the
virt stack.
As mentioned in the thread quoted above, using host_phys_bits is a
obvious thing to do when the user requested "-cpu host".
The harder issue is how to handle other CPU models. I had suggested
we should try associating a phys bits value with them, which would
probably involve creating Client/Server variants for all our CPU
models which don't currently have it. I still think that's worth
exploring as a strategy and with versioned CPU models we should
be ok wrt back compatibility with that approach.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2020-07-08 17:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 15:53 [PATCH 0/2] kvm: x86/cpu: Support guest MAXPHYADDR < host MAXPHYADDR Mohammed Gamal
2020-06-19 15:53 ` [PATCH 1/2] kvm: Add support for KVM_CAP_HAS_SMALLER_MAXPHYADDR Mohammed Gamal
2020-06-19 15:53 ` [PATCH 2/2] x86/cpu: Handle GUEST_MAXPHYADDR < HOST_MAXPHYADDR for hosts that don't support it Mohammed Gamal
2020-06-19 16:25 ` Paolo Bonzini
2020-07-08 17:16 ` Eduardo Habkost
2020-07-08 17:26 ` Daniel P. Berrangé [this message]
2020-07-09 9:44 ` Gerd Hoffmann
2020-07-09 9:55 ` Mohammed Gamal
2020-07-09 10:11 ` Paolo Bonzini
2020-07-09 17:00 ` Jim Mattson
2020-07-09 19:13 ` Eduardo Habkost
2020-07-10 7:22 ` Paolo Bonzini
2020-07-10 16:02 ` Eduardo Habkost
2020-07-10 16:49 ` Paolo Bonzini
2020-07-10 7:21 ` Paolo Bonzini
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=20200708172653.GL3229307@redhat.com \
--to=berrange@redhat.com \
--cc=christian.ehrhardt@canonical.com \
--cc=dann.frazier@canonical.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=fw@gpiccoli.net \
--cc=gpiccoli@canonical.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lersek@redhat.com \
--cc=libvir-list@redhat.com \
--cc=mgamal@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pedro.principeza@canonical.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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