From: Mohammed Gamal <mgamal@redhat.com>
To: "Gerd Hoffmann" <kraxel@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
mtosatti@redhat.com,
Pedro Principeza <pedro.principeza@canonical.com>,
kvm@vger.kernel.org, libvir-list@redhat.com,
Dann Frazier <dann.frazier@canonical.com>,
Guilherme Piccoli <gpiccoli@canonical.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Christian Ehrhardt <christian.ehrhardt@canonical.com>,
qemu-devel@nongnu.org, pbonzini@redhat.com,
Laszlo Ersek <lersek@redhat.com>,
fw@gpiccoli.net, rth@twiddle.net
Subject: Re: [PATCH 2/2] x86/cpu: Handle GUEST_MAXPHYADDR < HOST_MAXPHYADDR for hosts that don't support it
Date: Thu, 09 Jul 2020 11:55:50 +0200 [thread overview]
Message-ID: <8ed00a46daec6b41e7369123e807342e0ecfe751.camel@redhat.com> (raw)
In-Reply-To: <20200709094415.yvdh6hsfukqqeadp@sirius.home.kraxel.org>
On Thu, 2020-07-09 at 11:44 +0200, Gerd Hoffmann wrote:
> Hi,
>
> > > (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/
> > > 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.
>
> Well, the fundamental issue is not that hard actually. We have three
> cases:
>
> (1) GUEST_MAXPHYADDR == HOST_MAXPHYADDR
>
> Everything is fine ;)
>
> (2) GUEST_MAXPHYADDR < HOST_MAXPHYADDR
>
> Mostly fine. Some edge cases, like different page fault errors
> for
> addresses above GUEST_MAXPHYADDR and below
> HOST_MAXPHYADDR. Which I
> think Mohammed fixed in the kernel recently.
>
> (3) GUEST_MAXPHYADDR > HOST_MAXPHYADDR
>
> Broken. If the guest uses addresses above HOST_MAXPHYADDR
> everything
> goes south.
>
> The (2) case isn't much of a problem. We only need to figure
> whenever
> we want qemu allow this unconditionally (current state) or only in
> case
> the kernel fixes are present (state with this patch applied if I read
> it
> correctly).
>
> The (3) case is the reason why guest firmware never ever uses
> GUEST_MAXPHYADDR and goes with very conservative heuristics instead,
> which in turn leads to the consequences discussed at length in the
> OVMF thread linked above.
>
> Ideally we would simply outlaw (3), but it's hard for backward
> compatibility reasons. Second best solution is a flag somewhere
> (msr, cpuid, ...) telling the guest firmware "you can use
> GUEST_MAXPHYADDR, we guarantee it is <= HOST_MAXPHYADDR".
Problem is GUEST_MAXPHYADDR > HOST_MAXPHYADDR is actually a supported
configuration on some setups. Namely when memory encryption is enabled
on AMD CPUs[1].
>
> > 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.
>
> Yep, better defaults for GUEST_MAXPHYADDR would be good too, but that
> is a separate (although related) discussion.
>
> take care,
> Gerd
>
[1] - https://lkml.org/lkml/2020/6/19/2371
WARNING: multiple messages have this Message-ID (diff)
From: Mohammed Gamal <mgamal@redhat.com>
To: "Gerd Hoffmann" <kraxel@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Cc: Guilherme Piccoli <gpiccoli@canonical.com>,
Pedro Principeza <pedro.principeza@canonical.com>,
Eduardo Habkost <ehabkost@redhat.com>,
kvm@vger.kernel.org, libvir-list@redhat.com,
Dann Frazier <dann.frazier@canonical.com>,
mtosatti@redhat.com,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Christian Ehrhardt <christian.ehrhardt@canonical.com>,
qemu-devel@nongnu.org, pbonzini@redhat.com,
Laszlo Ersek <lersek@redhat.com>,
fw@gpiccoli.net, rth@twiddle.net
Subject: Re: [PATCH 2/2] x86/cpu: Handle GUEST_MAXPHYADDR < HOST_MAXPHYADDR for hosts that don't support it
Date: Thu, 09 Jul 2020 11:55:50 +0200 [thread overview]
Message-ID: <8ed00a46daec6b41e7369123e807342e0ecfe751.camel@redhat.com> (raw)
In-Reply-To: <20200709094415.yvdh6hsfukqqeadp@sirius.home.kraxel.org>
On Thu, 2020-07-09 at 11:44 +0200, Gerd Hoffmann wrote:
> Hi,
>
> > > (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/
> > > 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.
>
> Well, the fundamental issue is not that hard actually. We have three
> cases:
>
> (1) GUEST_MAXPHYADDR == HOST_MAXPHYADDR
>
> Everything is fine ;)
>
> (2) GUEST_MAXPHYADDR < HOST_MAXPHYADDR
>
> Mostly fine. Some edge cases, like different page fault errors
> for
> addresses above GUEST_MAXPHYADDR and below
> HOST_MAXPHYADDR. Which I
> think Mohammed fixed in the kernel recently.
>
> (3) GUEST_MAXPHYADDR > HOST_MAXPHYADDR
>
> Broken. If the guest uses addresses above HOST_MAXPHYADDR
> everything
> goes south.
>
> The (2) case isn't much of a problem. We only need to figure
> whenever
> we want qemu allow this unconditionally (current state) or only in
> case
> the kernel fixes are present (state with this patch applied if I read
> it
> correctly).
>
> The (3) case is the reason why guest firmware never ever uses
> GUEST_MAXPHYADDR and goes with very conservative heuristics instead,
> which in turn leads to the consequences discussed at length in the
> OVMF thread linked above.
>
> Ideally we would simply outlaw (3), but it's hard for backward
> compatibility reasons. Second best solution is a flag somewhere
> (msr, cpuid, ...) telling the guest firmware "you can use
> GUEST_MAXPHYADDR, we guarantee it is <= HOST_MAXPHYADDR".
Problem is GUEST_MAXPHYADDR > HOST_MAXPHYADDR is actually a supported
configuration on some setups. Namely when memory encryption is enabled
on AMD CPUs[1].
>
> > 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.
>
> Yep, better defaults for GUEST_MAXPHYADDR would be good too, but that
> is a separate (although related) discussion.
>
> take care,
> Gerd
>
[1] - https://lkml.org/lkml/2020/6/19/2371
next prev parent reply other threads:[~2020-07-09 9:56 UTC|newest]
Thread overview: 29+ 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 ` 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 ` 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 15:53 ` Mohammed Gamal
2020-06-19 16:25 ` Paolo Bonzini
2020-06-19 16:25 ` Paolo Bonzini
2020-07-08 17:16 ` Eduardo Habkost
2020-07-08 17:16 ` Eduardo Habkost
2020-07-08 17:26 ` Daniel P. Berrangé
2020-07-08 17:26 ` Daniel P. Berrangé
2020-07-09 9:44 ` Gerd Hoffmann
2020-07-09 9:44 ` Gerd Hoffmann
2020-07-09 9:55 ` Mohammed Gamal [this message]
2020-07-09 9:55 ` Mohammed Gamal
2020-07-09 10:11 ` Paolo Bonzini
2020-07-09 10:11 ` Paolo Bonzini
2020-07-09 17:00 ` Jim Mattson
2020-07-09 19:13 ` Eduardo Habkost
2020-07-09 19:13 ` Eduardo Habkost
2020-07-10 7:22 ` Paolo Bonzini
2020-07-10 7:22 ` Paolo Bonzini
2020-07-10 16:02 ` Eduardo Habkost
2020-07-10 16:02 ` Eduardo Habkost
2020-07-10 16:49 ` Paolo Bonzini
2020-07-10 16:49 ` Paolo Bonzini
2020-07-10 7:21 ` 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=8ed00a46daec6b41e7369123e807342e0ecfe751.camel@redhat.com \
--to=mgamal@redhat.com \
--cc=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=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 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.