From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0968CC432BE for ; Tue, 17 Aug 2021 22:05:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E032360FD7 for ; Tue, 17 Aug 2021 22:05:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235130AbhHQWFo (ORCPT ); Tue, 17 Aug 2021 18:05:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229700AbhHQWFn (ORCPT ); Tue, 17 Aug 2021 18:05:43 -0400 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAA3FC061764 for ; Tue, 17 Aug 2021 15:05:09 -0700 (PDT) Received: by mail-il1-x12e.google.com with SMTP id x5so96320ill.3 for ; Tue, 17 Aug 2021 15:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OZqPgounEIER6ocdPyrnXbdW3TYtXZWjlNEg5NQfLK8=; b=hRJyAcxfN5jVh6JWF7HUfeYFRkenRRp99StwCAkKyZPNNfrG6a/NC4COGxHzCvLlQz I6UwnYV58HANPjcsP+De8UwFM5Ro/+lnePUBlXbAtenAkq9loOCb8XAkORhs6jI4ZD68 HjF0Xog7zdzjiuNljLfPYFT4/jDtn/yRf8qCcxHpOO3ziLuB4ckrsfme7TtnCqMbiC7Y VtJo82ezAZwhl/nYkl5QBJzeKZOH8TlxLwSIIFupdoCetchMUzmC0kouyoQfT82UXGp2 yRPAR2D5W993Yx9G7yITCkeSJdKh+JJ72NQnWSFLqq4CyOaaZy1o0BqO5Kl20wozqX1M b3iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OZqPgounEIER6ocdPyrnXbdW3TYtXZWjlNEg5NQfLK8=; b=SyOqnXw8uaNMA2UzMKFXMoe/rSthG1sM1l7XXzvOkBAwjwljssoQj4/bULXEtu/Cl7 q/8h4uAGGSjqmAxu/4XvwuOYldydjxmGPTzavT45G1JVsWRvwPY/wOuYhUhN2oIEfcpu FK+3Xrk3woVMZR4EkKVnYgDcrA1faUxP4W8+00Qqg6zGtlWIHB4TPeg0/PsI3qe3wdC7 Ejlb0VF276QhDV9pb8qOk7azWotoNjc98ATAg0GVP8204B8ZxjynqI9aHRDJyqiPK17O n9koD49zPUc0i5n0Lh9VBp8pWfmXGBYTWajYDcBq8F3dhILOjcjCMnPM9i/zNNASBtXZ HYzA== X-Gm-Message-State: AOAM533h+kH9l72GssaJu/Pmby+VUMxECNyivN8SHHyftcegA6UKl3GO 8J5N1avrou1V3phh7h0kmdtQbzoG9Gqjnbi9l4Z/9A== X-Google-Smtp-Source: ABdhPJxlYq9gxQzuDtH+0kqvgJ74s7MMMkyqidnNO4T4Qi8RoJvXSbWnXgHR/zI+wGlJhp33pfEuo3XvpED6dR4bes0= X-Received: by 2002:a05:6e02:688:: with SMTP id o8mr4088723ils.182.1629237908890; Tue, 17 Aug 2021 15:05:08 -0700 (PDT) MIME-Version: 1.0 References: <0fcfafde-a690-f53a-01fc-542054948bb2@redhat.com> <37796fd1-bbc2-f22c-b786-eb44f4d473b9@linux.ibm.com> In-Reply-To: <37796fd1-bbc2-f22c-b786-eb44f4d473b9@linux.ibm.com> From: Steve Rutherford Date: Tue, 17 Aug 2021 15:04:32 -0700 Message-ID: Subject: Re: [RFC PATCH 00/13] Add support for Mirror VM. To: Tobin Feldman-Fitzthum Cc: Paolo Bonzini , Ashish Kalra , thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com, tobin@ibm.com, jejb@linux.ibm.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, dgilbert@redhat.com, frankeh@us.ibm.com, dovmurik@linux.vnet.ibm.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tue, Aug 17, 2021 at 1:50 PM Tobin Feldman-Fitzthum wrote: > > > On 8/17/21 12:32 PM, Paolo Bonzini wrote: > > There's three possibilities for this: > > > > 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...). > > This is essentially what we do in our prototype, although we have an > even simpler approach. We have a 1:1 mapping that maps an address to > itself with the cbit set. During Migration QEMU asks the migration > handler to import/export encrypted pages and provides the GPA for said > page. Since the migration handler only exports/imports encrypted pages, > we can have the cbit set for every page in our mapping. We can still use > OVMF functions with these mappings because they are on encrypted pages. > The MH does need to use a few shared pages (to communicate with QEMU, > for instance), so we have another mapping without the cbit that is at a > large offset. > > I think this is basically equivalent to what you suggest. As you point > out above, this approach does require that any page that will be > exported/imported by the MH is mapped in the guest. Is this a bad > assumption? The VMSA for SEV-ES is one example of a region that is > encrypted but not mapped in the guest (the PSP handles it directly). We > have been planning to map the VMSA into the guest to support migration > with SEV-ES (along with other changes). Ahh, It sounds like you are looking into sidestepping the existing AMD-SP flows for migration. I assume the idea is to spin up a VM on the target side, and have the two VMs attest to each other. How do the two sides know if the other is legitimate? I take it that the source is directing the LAUNCH flows? --Steve From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97B4AC432BE for ; Tue, 17 Aug 2021 22:06:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24C8560EB5 for ; Tue, 17 Aug 2021 22:06:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 24C8560EB5 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:54538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mG7Dz-0000vw-41 for qemu-devel@archiver.kernel.org; Tue, 17 Aug 2021 18:06:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mG7Cz-00007i-Fa for qemu-devel@nongnu.org; Tue, 17 Aug 2021 18:05:22 -0400 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]:33546) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mG7Cu-00079G-MQ for qemu-devel@nongnu.org; Tue, 17 Aug 2021 18:05:20 -0400 Received: by mail-il1-x12c.google.com with SMTP id z2so138675iln.0 for ; Tue, 17 Aug 2021 15:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OZqPgounEIER6ocdPyrnXbdW3TYtXZWjlNEg5NQfLK8=; b=hRJyAcxfN5jVh6JWF7HUfeYFRkenRRp99StwCAkKyZPNNfrG6a/NC4COGxHzCvLlQz I6UwnYV58HANPjcsP+De8UwFM5Ro/+lnePUBlXbAtenAkq9loOCb8XAkORhs6jI4ZD68 HjF0Xog7zdzjiuNljLfPYFT4/jDtn/yRf8qCcxHpOO3ziLuB4ckrsfme7TtnCqMbiC7Y VtJo82ezAZwhl/nYkl5QBJzeKZOH8TlxLwSIIFupdoCetchMUzmC0kouyoQfT82UXGp2 yRPAR2D5W993Yx9G7yITCkeSJdKh+JJ72NQnWSFLqq4CyOaaZy1o0BqO5Kl20wozqX1M b3iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OZqPgounEIER6ocdPyrnXbdW3TYtXZWjlNEg5NQfLK8=; b=Vbp/+dHPqvZJQ1NTxCATaSNtrEoEpkUU9LAPlcJm7SNtVHMVnRUmfVh16qvFoPuInf Y6zEDjexO4/04450CadZvwMwjFfqf7x3cE+2Ec9bajo9csF0MeCZN6gM3/zr8/vDh7Ti 7qAfRsTmmYSZWFliidVyhFmj9XKVd9v69NwYWqcSvZV9N0QwE7XvLuJe6g+frqhR9Jmb skzvf3kJKzlK7eZZ0KjSeVr5MI1rOP4qr0Od3/L2Byk1bN+LvhTyj4ALId8nk8T3rz/f JiiVA2NRMDjiwxZok67VtuGRbrzX5W958eNabpR5b69cgXnoq2Ug+DOLRGR8Yx376GFg ZmkQ== X-Gm-Message-State: AOAM5307KoMdy+zlTwJgDw/1WsP4EMlVGsuCfLeHWYcFW19FjmqPpGmu tgJeuigCKDetnnYjdRHvwMgkYvmv4yjSn1S5p2rKyA== X-Google-Smtp-Source: ABdhPJxlYq9gxQzuDtH+0kqvgJ74s7MMMkyqidnNO4T4Qi8RoJvXSbWnXgHR/zI+wGlJhp33pfEuo3XvpED6dR4bes0= X-Received: by 2002:a05:6e02:688:: with SMTP id o8mr4088723ils.182.1629237908890; Tue, 17 Aug 2021 15:05:08 -0700 (PDT) MIME-Version: 1.0 References: <0fcfafde-a690-f53a-01fc-542054948bb2@redhat.com> <37796fd1-bbc2-f22c-b786-eb44f4d473b9@linux.ibm.com> In-Reply-To: <37796fd1-bbc2-f22c-b786-eb44f4d473b9@linux.ibm.com> From: Steve Rutherford Date: Tue, 17 Aug 2021 15:04:32 -0700 Message-ID: Subject: Re: [RFC PATCH 00/13] Add support for Mirror VM. To: Tobin Feldman-Fitzthum Cc: Paolo Bonzini , Ashish Kalra , thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com, tobin@ibm.com, jejb@linux.ibm.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, dgilbert@redhat.com, frankeh@us.ibm.com, dovmurik@linux.vnet.ibm.com Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::12c; envelope-from=srutherford@google.com; helo=mail-il1-x12c.google.com X-Spam_score_int: -175 X-Spam_score: -17.6 X-Spam_bar: ----------------- X-Spam_report: (-17.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Tue, Aug 17, 2021 at 1:50 PM Tobin Feldman-Fitzthum wrote: > > > On 8/17/21 12:32 PM, Paolo Bonzini wrote: > > There's three possibilities for this: > > > > 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...). > > This is essentially what we do in our prototype, although we have an > even simpler approach. We have a 1:1 mapping that maps an address to > itself with the cbit set. During Migration QEMU asks the migration > handler to import/export encrypted pages and provides the GPA for said > page. Since the migration handler only exports/imports encrypted pages, > we can have the cbit set for every page in our mapping. We can still use > OVMF functions with these mappings because they are on encrypted pages. > The MH does need to use a few shared pages (to communicate with QEMU, > for instance), so we have another mapping without the cbit that is at a > large offset. > > I think this is basically equivalent to what you suggest. As you point > out above, this approach does require that any page that will be > exported/imported by the MH is mapped in the guest. Is this a bad > assumption? The VMSA for SEV-ES is one example of a region that is > encrypted but not mapped in the guest (the PSP handles it directly). We > have been planning to map the VMSA into the guest to support migration > with SEV-ES (along with other changes). Ahh, It sounds like you are looking into sidestepping the existing AMD-SP flows for migration. I assume the idea is to spin up a VM on the target side, and have the two VMs attest to each other. How do the two sides know if the other is legitimate? I take it that the source is directing the LAUNCH flows? --Steve