All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <jejb@linux.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Steve Rutherford <srutherford@google.com>
Cc: Ashish Kalra <Ashish.Kalra@amd.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Thomas Lendacky <thomas.lendacky@amd.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	"Habkost, Eduardo" <ehabkost@redhat.com>,
	"S. Tsirkin, Michael" <mst@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Tobin Feldman-Fitzthum <tobin@ibm.com>,
	Dov Murik <dovmurik@linux.vnet.ibm.com>,
	Hubertus Franke <frankeh@us.ibm.com>,
	David Gilbert <dgilbert@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: [RFC PATCH 00/13] Add support for Mirror VM.
Date: Tue, 17 Aug 2021 18:57:32 -0400	[thread overview]
Message-ID: <b1b5adcdbf51112d7b3cc2c66123dea5276a4a6d.camel@linux.ibm.com> (raw)
In-Reply-To: <CABgObfZbyTxSO9ScE0RMK2vgyOam_REo+SgLA+-1XyP=8Vx+uQ@mail.gmail.com>

On Wed, 2021-08-18 at 00:37 +0200, Paolo Bonzini wrote:
> On Tue, Aug 17, 2021 at 11:54 PM Steve Rutherford
> <srutherford@google.com> wrote:
> > > 1) the easy one: the bottom 4G of guest memory are mapped in the
> > > mirror
> > > VM 1:1.  The ram_addr_t-based addresses are shifted by either 4G
> > > or a
> > > huge value such as 2^42 (MAXPHYADDR - physical address reduction
> > > - 1).
> > > This even lets the migration helper reuse the OVMF runtime
> > > services
> > > memory map (but be careful about thread safety...).
> > 
> > If I understand what you are proposing, this would only work for
> > SEV/SEV-ES, since the RMP prevents these remapping games. This
> > makes
> > me less enthusiastic about this (but I suspect that's why you call
> > this less future proof).
> 
> I called it less future proof because it allows the migration helper
> to rely more on OVMF details, but those may not apply in the future.
> 
> However you're right about SNP; the same page cannot be mapped twice
> at different GPAs by a single ASID (which includes the VM and the
> migration helper). :( That does throw a wrench in the idea of mapping
> pages by ram_addr_t(*), and this applies to both schemes.

Right, but in the current IBM approach, since we use the same mapping
for guest and mirror, we have the same GPA in both and it should work
with -SNP.

> Migrating RAM in PCI BARs is a mess anyway for SNP, because PCI BARs
> can be moved and every time they do the migration helper needs to
> wait for validation to happen. :(

Realistically, migration is becoming a royal pain, not just for
confidential computing, but for virtual functions in general.  I really
think we should look at S3 suspend, where we shut down the drivers and
then reattach on S3 resume as the potential pathway to getting
migration working both for virtual functions and this use case.

James



WARNING: multiple messages have this Message-ID (diff)
From: James Bottomley <jejb@linux.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Steve Rutherford <srutherford@google.com>
Cc: Thomas Lendacky <thomas.lendacky@amd.com>,
	Ashish Kalra <Ashish.Kalra@amd.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	"Habkost, Eduardo" <ehabkost@redhat.com>,
	kvm <kvm@vger.kernel.org>, "S. Tsirkin, Michael" <mst@redhat.com>,
	Tobin Feldman-Fitzthum <tobin@ibm.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	David Gilbert <dgilbert@redhat.com>,
	Hubertus Franke <frankeh@us.ibm.com>,
	Dov Murik <dovmurik@linux.vnet.ibm.com>
Subject: Re: [RFC PATCH 00/13] Add support for Mirror VM.
Date: Tue, 17 Aug 2021 18:57:32 -0400	[thread overview]
Message-ID: <b1b5adcdbf51112d7b3cc2c66123dea5276a4a6d.camel@linux.ibm.com> (raw)
In-Reply-To: <CABgObfZbyTxSO9ScE0RMK2vgyOam_REo+SgLA+-1XyP=8Vx+uQ@mail.gmail.com>

On Wed, 2021-08-18 at 00:37 +0200, Paolo Bonzini wrote:
> On Tue, Aug 17, 2021 at 11:54 PM Steve Rutherford
> <srutherford@google.com> wrote:
> > > 1) the easy one: the bottom 4G of guest memory are mapped in the
> > > mirror
> > > VM 1:1.  The ram_addr_t-based addresses are shifted by either 4G
> > > or a
> > > huge value such as 2^42 (MAXPHYADDR - physical address reduction
> > > - 1).
> > > This even lets the migration helper reuse the OVMF runtime
> > > services
> > > memory map (but be careful about thread safety...).
> > 
> > If I understand what you are proposing, this would only work for
> > SEV/SEV-ES, since the RMP prevents these remapping games. This
> > makes
> > me less enthusiastic about this (but I suspect that's why you call
> > this less future proof).
> 
> I called it less future proof because it allows the migration helper
> to rely more on OVMF details, but those may not apply in the future.
> 
> However you're right about SNP; the same page cannot be mapped twice
> at different GPAs by a single ASID (which includes the VM and the
> migration helper). :( That does throw a wrench in the idea of mapping
> pages by ram_addr_t(*), and this applies to both schemes.

Right, but in the current IBM approach, since we use the same mapping
for guest and mirror, we have the same GPA in both and it should work
with -SNP.

> Migrating RAM in PCI BARs is a mess anyway for SNP, because PCI BARs
> can be moved and every time they do the migration helper needs to
> wait for validation to happen. :(

Realistically, migration is becoming a royal pain, not just for
confidential computing, but for virtual functions in general.  I really
think we should look at S3 suspend, where we shut down the drivers and
then reattach on S3 resume as the potential pathway to getting
migration working both for virtual functions and this use case.

James




  reply	other threads:[~2021-08-17 22:57 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16 13:25 [RFC PATCH 00/13] Add support for Mirror VM Ashish Kalra
2021-08-16 13:26 ` [RFC PATCH 01/13] machine: Add mirrorvcpus=N suboption to -smp Ashish Kalra
2021-08-16 21:23   ` Eric Blake
2021-08-16 21:23     ` Eric Blake
2021-08-16 13:27 ` [RFC PATCH 02/13] hw/boards: Add mirror_vcpu flag to CPUArchId Ashish Kalra
2021-08-16 13:27 ` [RFC PATCH 03/13] hw/i386: Mark mirror vcpus in possible_cpus Ashish Kalra
2021-08-16 13:27 ` [RFC PATCH 04/13] hw/acpi: Don't include mirror vcpus in ACPI tables Ashish Kalra
2021-08-16 13:28 ` [RFC PATCH 05/13] cpu: Add boolean mirror_vcpu field to CPUState Ashish Kalra
2021-08-16 13:28 ` [RFC PATCH 06/13] hw/i386: Set CPUState.mirror_vcpu=true for mirror vcpus Ashish Kalra
2021-08-16 13:29 ` [RFC PATCH 07/13] kvm: Add Mirror VM ioctl and enable cap interfaces Ashish Kalra
2021-08-16 13:29 ` [RFC PATCH 08/13] kvm: Add Mirror VM support Ashish Kalra
2021-08-16 13:29 ` [RFC PATCH 09/13] kvm: create Mirror VM and share primary VM's encryption context Ashish Kalra
2021-08-16 13:30 ` [RFC PATCH 10/13] softmmu/cpu: Skip mirror vcpu's for pause, resume and synchronization Ashish Kalra
2021-08-16 13:30 ` [RFC PATCH 11/13] kvm/apic: Disable in-kernel APIC support for mirror vcpu's Ashish Kalra
2021-08-16 13:31 ` [RFC PATCH 12/13] hw/acpi: disable modern CPU hotplug interface " Ashish Kalra
2021-08-16 13:31 ` [RFC PATCH 13/13] hw/i386/pc: reduce fw_cfg boot cpu count taking into account " Ashish Kalra
2021-08-16 14:01 ` [RFC PATCH 00/13] Add support for Mirror VM Claudio Fontana
2021-08-16 14:01   ` Claudio Fontana
2021-08-16 14:15 ` Paolo Bonzini
2021-08-16 14:15   ` Paolo Bonzini
2021-08-16 14:23   ` Daniel P. Berrangé
2021-08-16 14:23     ` Daniel P. Berrangé
2021-08-16 15:00     ` Paolo Bonzini
2021-08-16 15:00       ` Paolo Bonzini
2021-08-16 15:16       ` Daniel P. Berrangé
2021-08-16 15:16         ` Daniel P. Berrangé
2021-08-16 15:35         ` Paolo Bonzini
2021-08-16 15:35           ` Paolo Bonzini
2021-08-16 14:44   ` Ashish Kalra
2021-08-16 14:58     ` Paolo Bonzini
2021-08-16 14:58       ` Paolo Bonzini
2021-08-16 15:13       ` Ashish Kalra
2021-08-16 15:38         ` Paolo Bonzini
2021-08-16 15:38           ` Paolo Bonzini
2021-08-16 15:48           ` Dr. David Alan Gilbert
2021-08-16 15:48             ` Dr. David Alan Gilbert
2021-08-18 10:31           ` Ashish Kalra
2021-08-18 11:25             ` James Bottomley
2021-08-18 11:25               ` James Bottomley
2021-08-18 15:31               ` Dr. David Alan Gilbert
2021-08-18 15:31                 ` Dr. David Alan Gilbert
2021-08-18 15:35                 ` James Bottomley
2021-08-18 15:35                   ` James Bottomley
2021-08-18 15:43                   ` Dr. David Alan Gilbert
2021-08-18 15:43                     ` Dr. David Alan Gilbert
2021-08-18 16:28                     ` James Bottomley
2021-08-18 16:28                       ` James Bottomley
2021-08-18 17:30                       ` Dr. David Alan Gilbert
2021-08-18 17:30                         ` Dr. David Alan Gilbert
2021-08-18 18:51                         ` James Bottomley
2021-08-18 18:51                           ` James Bottomley
2021-08-18 19:47             ` Paolo Bonzini
2021-08-16 17:23   ` Dr. David Alan Gilbert
2021-08-16 17:23     ` Dr. David Alan Gilbert
2021-08-16 20:53     ` Paolo Bonzini
2021-08-16 23:53 ` Steve Rutherford
2021-08-16 23:53   ` Steve Rutherford
2021-08-17  7:05   ` Michael S. Tsirkin
2021-08-17  7:05     ` Michael S. Tsirkin
2021-08-17  8:38   ` Dr. David Alan Gilbert
2021-08-17  8:38     ` Dr. David Alan Gilbert
2021-08-17 14:08     ` Ashish Kalra
2021-08-17 16:32   ` Paolo Bonzini
2021-08-17 16:32     ` Paolo Bonzini
2021-08-17 20:50     ` Tobin Feldman-Fitzthum
2021-08-17 20:50       ` Tobin Feldman-Fitzthum
2021-08-17 22:04       ` Steve Rutherford
2021-08-17 22:04         ` Steve Rutherford
2021-08-18 15:32         ` Tobin Feldman-Fitzthum
2021-08-18 15:32           ` Tobin Feldman-Fitzthum
2021-08-18 19:04           ` Dr. David Alan Gilbert
2021-08-18 19:04             ` Dr. David Alan Gilbert
2021-08-18 21:42             ` Tobin Feldman-Fitzthum
2021-08-18 21:42               ` Tobin Feldman-Fitzthum
2021-08-19  8:22               ` Dr. David Alan Gilbert
2021-08-19  8:22                 ` Dr. David Alan Gilbert
2021-08-19 14:06                 ` James Bottomley
2021-08-19 14:06                   ` James Bottomley
2021-08-19 14:28                   ` Dr. David Alan Gilbert
2021-08-19 14:28                     ` Dr. David Alan Gilbert
2021-08-19 22:10                     ` James Bottomley
2021-08-19 22:10                       ` James Bottomley
2021-08-23 12:26                       ` Dr. David Alan Gilbert
2021-08-23 12:26                         ` Dr. David Alan Gilbert
2021-08-23 16:28                         ` Tobin Feldman-Fitzthum
2021-08-23 16:28                           ` Tobin Feldman-Fitzthum
2021-08-19 14:07                 ` Tobin Feldman-Fitzthum
2021-08-19 14:07                   ` Tobin Feldman-Fitzthum
2021-08-17 23:20       ` Paolo Bonzini
2021-08-17 23:20         ` Paolo Bonzini
2021-08-17 21:54     ` Steve Rutherford
2021-08-17 21:54       ` Steve Rutherford
2021-08-17 22:37       ` Paolo Bonzini
2021-08-17 22:37         ` Paolo Bonzini
2021-08-17 22:57         ` James Bottomley [this message]
2021-08-17 22:57           ` James Bottomley
2021-08-17 23:10           ` Steve Rutherford
2021-08-17 23:10             ` Steve Rutherford
2021-08-18  2:49             ` James Bottomley
2021-08-18  2:49               ` James Bottomley
2021-08-18 14:06         ` Ashish Kalra
2021-08-18 17:07           ` Ashish Kalra
2021-08-16 15:07 Tobin Feldman-Fitzthum
2021-08-16 15:07 ` Tobin Feldman-Fitzthum

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=b1b5adcdbf51112d7b3cc2c66123dea5276a4a6d.camel@linux.ibm.com \
    --to=jejb@linux.ibm.com \
    --cc=Ashish.Kalra@amd.com \
    --cc=brijesh.singh@amd.com \
    --cc=dgilbert@redhat.com \
    --cc=dovmurik@linux.vnet.ibm.com \
    --cc=ehabkost@redhat.com \
    --cc=frankeh@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=srutherford@google.com \
    --cc=thomas.lendacky@amd.com \
    --cc=tobin@ibm.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 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.