Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp831324pxb; Thu, 2 Sep 2021 16:36:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxR6Jk6avbkPEXHR4GrYDZ/rUJLQ5YSxPYZOqPhNVNzN4R6LILnhERmtkzcnnIQOT7RFxgh X-Received: by 2002:a5d:8784:: with SMTP id f4mr719929ion.48.1630625770698; Thu, 02 Sep 2021 16:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630625770; cv=none; d=google.com; s=arc-20160816; b=RT5GZakn4eXCcsU4zEQV2T2FXQIkV39G2yKo010MXYuq8cSHLISxXLOouAxxNIoDnD NAHPBwc6xDaeIcFvNKWwi//G0gW0fBkWEkzYCt6ME7R5bqIjw0ltU/0rSfk23U5L8c/F 2X5lccvUdv0h9GTMWAB7CBl8k5eeYdBlNRHveKgft1wxv803o4Pl5rOkAN61RzxGEbBj 1FYPYw7VDRV4wAmQMhjV54pFRrOJVO944fzx4mgX/eHDQigzsUrNFt1J/UtI0rhOg2+Z eO+MA+silTp3ep67CzzAZpd/txumMg+76hpFkVVVHxdX5GnsUoZu7nkeFLLcnK4EIvYf 5eLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=B3cxyL9Tlf0A8OUkJsk3pi4jzzMr5KvAck0t+WC1GK0=; b=U8K8bGHFyF7ERTqnJuvIvkGEHVPhU1Jgg2/Lmhqw5CgSvBzm2U5+EjI3W/ycuM4Hgu NC1i//bPhP/dKjULy+cAJ/69YApKWQB75QGunCZbD0gxNaNjDOdlqW8uX2PLI8smDTg4 qm6qW3eDTfJ1T64jcoKGDTx7vYSuOcNbQuvVpWsMHTTi28B/qM2dcwVbVlsiqNEWveXG HKVWLZyMVGvDeveHxcxSXt8Vc3WNZuGfZR2BJybJmLnI0RG+DuCKPyi6QNKR9RSb2s7b fQbpmgqorNs9rfnLE69TxauFIuXBLmbYKLB+9zNgBX9IHO1CU+ShDymvTrUA5zUR81cy GO6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=iJNWEwOH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i126si3184985iof.61.2021.09.02.16.35.57; Thu, 02 Sep 2021 16:36:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=iJNWEwOH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347201AbhIBSyf (ORCPT + 99 others); Thu, 2 Sep 2021 14:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347324AbhIBSy2 (ORCPT ); Thu, 2 Sep 2021 14:54:28 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E25B3C061757 for ; Thu, 2 Sep 2021 11:53:27 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id bq28so6482280lfb.7 for ; Thu, 02 Sep 2021 11:53:27 -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=B3cxyL9Tlf0A8OUkJsk3pi4jzzMr5KvAck0t+WC1GK0=; b=iJNWEwOHkzKi8Knu9Iio+Dab8ggreKIblCRRgyHXfpTveV3pjRbas56xLTsHYrPCDk tUEeZA0BjFf3rdBlGbFrafI7wtWv90RNG90ceJ7XoFlsIHPkSOEza0Kio3i8i5o8R+Gp 2yLztoD7TwwatWEJyZC9G+lQ8nA0jrneqbEc/5L81JdHYIxDsWKAmR1WII32gviCyirr vh9MPjU/PRHFwEIqGB+Kv+Jbf0zFW0JegPy+CowKXCL9QV2jKRPOX+5tVmHON372++tq auJq8mlgCvw+o+MyQ9Za1RDVOIvh/3vHGai1nXUt/BCbD7/A8yTP4/QZeCjcUmnp94FP zi8w== 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=B3cxyL9Tlf0A8OUkJsk3pi4jzzMr5KvAck0t+WC1GK0=; b=Lm1T77wBdpQuIaVFIbak2/lNnG19MmGR68CEwbm/3HEOj3o5aRJMOvld1vwAryUs7P TCvjio/4NWP0Up0wj7SegMo2ozGrKmXgK3iA7IEHFhTIuemdwH4OgeexnEVf3/ys5bHO cpAq/Fl/0KjN+kMyuFVkJNvIZAZ1Ia2vs9DgKt8QFp5E+glTRr71kJ3UbsyvRLLRre4V DX8YzPeWDWBQ8kEbwNYSB7RLiMsJ2jyC4SWMYnUcVsxMRvCpizt47Knss0ZeyFjeg340 pCXxgCENNwQyuY30vE7rEZe53N6ZqwzDhA7p5ZU7AOcGKCu94ik3GtZ+V+IT+oJvnbSZ YC3Q== X-Gm-Message-State: AOAM533HH2m91aMJuDo6twVnNrJJ83uNLb3vz4Jhx57sim+hTIbLZSlK pzQivXffvJpViT2Yp6qs82w4yQYuqMpw/1jFz1SLLw== X-Received: by 2002:a05:6512:3b12:: with SMTP id f18mr3260148lfv.423.1630608805872; Thu, 02 Sep 2021 11:53:25 -0700 (PDT) MIME-Version: 1.0 References: <20210902181751.252227-1-pgonda@google.com> In-Reply-To: From: Peter Gonda Date: Thu, 2 Sep 2021 12:53:13 -0600 Message-ID: Subject: Re: [PATCH 0/2 V7] Add AMD SEV and SEV-ES intra host migration support To: Sean Christopherson Cc: kvm list , Marc Orr , Paolo Bonzini , David Rientjes , "Dr. David Alan Gilbert" , "Singh, Brijesh" , Joerg Roedel , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 2, 2021 at 12:45 PM Sean Christopherson wrote: > > Please Cc the cover letter to anyone that was Cc'd on one or more patches. That's > especially helpful if some recipients aren't subscribed to KVM. Oh, and Cc lkml > as well, otherwise I believe lore, patchwork, etc... won't have the cover letter. Add CCs here. Thanks. > > On Thu, Sep 02, 2021, Peter Gonda wrote: > > Intra host migration provides a low-cost mechanism for userspace VMM > > upgrades. It is an alternative to traditional (i.e., remote) live > > migration. Whereas remote migration handles moving a guest to a new host, > > intra host migration only handles moving a guest to a new userspace VMM > > within a host. This can be used to update, rollback, change flags of the > > VMM, etc. The lower cost compared to live migration comes from the fact > > that the guest's memory does not need to be copied between processes. A > > handle to the guest memory simply gets passed to the new VMM, this could > > be done via /dev/shm with share=on or similar feature. > > > > The guest state can be transferred from an old VMM to a new VMM as follows: > > 1. Export guest state from KVM to the old user-space VMM via a getter > > user-space/kernel API 2. Transfer guest state from old VMM to new VMM via > > IPC communication 3. Import guest state into KVM from the new user-space > > VMM via a setter user-space/kernel API VMMs by exporting from KVM using > > getters, sending that data to the new VMM, then setting it again in KVM. > > > > In the common case for intra host migration, we can rely on the normal > > ioctls for passing data from one VMM to the next. SEV, SEV-ES, and other > > confidential compute environments make most of this information opaque, and > > render KVM ioctls such as "KVM_GET_REGS" irrelevant. As a result, we need > > the ability to pass this opaque metadata from one VMM to the next. The > > easiest way to do this is to leave this data in the kernel, and transfer > > ownership of the metadata from one KVM VM (or vCPU) to the next. For > > example, we need to move the SEV enabled ASID, VMSAs, and GHCB metadata > > from one VMM to the next. In general, we need to be able to hand off any > > data that would be unsafe/impossible for the kernel to hand directly to > > userspace (and cannot be reproduced using data that can be handed safely to > > userspace). > > > > For the intra host operation the SEV required metadata, the source VM FD is > > sent to the target VMM. The target VMM calls the new cap ioctl with the > > source VM FD, KVM then moves all the SEV state to the target VM from the > > source VM.