Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1824168pxb; Fri, 10 Sep 2021 15:10:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUcYyHWnD1dIF3rg7/wWlVt0ZW3MxtMfe9HLlbSuxHBMAqQqYUTf0bFHj09LhZ+dsaNZyD X-Received: by 2002:a05:6e02:1bab:: with SMTP id n11mr8202141ili.85.1631311806598; Fri, 10 Sep 2021 15:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631311806; cv=none; d=google.com; s=arc-20160816; b=sYghg0Ajbb+aRnzxvfX3jUcGvK11wTO0orcUKPZocYDJrGp4NpTIpIugMPvGjWPkjX E7akEEm9COXZyLpLjYJjBzqWil77eg4zzVMcZ6k2qYhD+mH4gT0JUKkIPdqPLkKR8NKn ncK329KszFYfYcashpqo+hJmoNSnLk+aqI9aGLx0JPtXS2Xtp+6AI3nI8kE26T+75z3+ rNGtL4wpCvpnfCtoSvbT8rQBGWtDrtgqWnKRA31vIOpRxgE5s4zB4umbCQgUPhwm1vD1 ELrrkTK7GudBiOROlv9vLHKnC5HMzpEqI8NP34h3dt03GTeBHpGEY6klVyWzkDreEjdk 27qA== 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=9FSHaiKmU7r6eoknlZw4Tmerh8r1h9JIhLnGLeFKRfg=; b=T1gszvzwmNUgBQz2FhD/uvIiuULuo4nx8P1tN++q2rQE5DEvL5Abnychx62A6x6roM zd5+bCXoFXUm2a3nWG+PgcmkLcr22BBsjK/5CKbXbfgzuotELeRkZOFVaDV8ZN7A83AL 8RlPUIJOn5D9PJmeg5sQfcxDRSq90n0GFfj5XRCDd4FUc7Od3Oh2Rc+cxdNvvMqVZSiq LcEV/BV6UGUhQW1q9L3HDxIRBcVdLK+VSZ6WFsw0550r3z2CCB5pGzq44XH41RasOlvX M4jUrXnhmxrP7diJktkyN5pT5ujMNTzlL8K3M1P+vmKCHrTB+fBecl6ReOz2IIiz6PJD WRRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="G/P3vZlt"; 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 o7si5777379ioh.56.2021.09.10.15.09.55; Fri, 10 Sep 2021 15:10:06 -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=20210112 header.b="G/P3vZlt"; 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 S234692AbhIJWJL (ORCPT + 99 others); Fri, 10 Sep 2021 18:09:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234705AbhIJWJK (ORCPT ); Fri, 10 Sep 2021 18:09:10 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8C2DC061756 for ; Fri, 10 Sep 2021 15:07:57 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id s10so6890109lfr.11 for ; Fri, 10 Sep 2021 15:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9FSHaiKmU7r6eoknlZw4Tmerh8r1h9JIhLnGLeFKRfg=; b=G/P3vZlt/dEQxiZPFdpGAUmPZFfpKBRNSi6J7BHvbh7Wpf29XFdgEE7pYRwYZxHm/+ ej+ISKZAvYhKlABn3wz0dL2AT955Fn2yW8XhaToLWPJH5RJAEe/HblVaKwd0zGTxesoP 7Kc1mxMO5PjX9Le0u5y5GR4QqWr+SHRUfqtSdoKQefOGy+OnCT1yORE4H1p1zkPkWKCq C4ivajCwzljDJsLjxR8A3/no8bYwkdsQU5PHiRxb+XozbKqGvc7A78WyIQ7t19oeQChQ X/ZYmNE4qc64ilpe1dovx67R34maYKVCri60eMrC4aBBKOxMj1vrRByA51A14J+DBPCA UM1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9FSHaiKmU7r6eoknlZw4Tmerh8r1h9JIhLnGLeFKRfg=; b=bX3S7luUcDc7KDwfJcO/QpmAfgmunB6xIICy1RVgr8BiXLTfrST0YytO+HLECbcpLp 9Y2JdC7EUyqOwDT2/z8g1tI9CDNEy5/zPJXE9vHHwAENLweminyNwkz4dMb5dUolLXQC JoC290V8Ttfzt2NWOpYkF3VNcU/q6hgB/voMoTCUS8DOKg+a+CFKW4fYmhkEaH2O/+8b t6HdBqbhgPzW5t0bcDhrTqZIF5wrXG3ujRISmtBWW9tm2Dmqr6lGAOJyn1jXUO2pV6Ig P5O9zonN2CfL976XniOsjJhg2fDkgZtGcJqt0CdZD5KJ2Sdbwkc2bxsIIVHm+7Ty1I88 FAUw== X-Gm-Message-State: AOAM530vtQY4nLdk0L2KfiZM/e06a3m3AMAjuZDWogUN9Ch02nsWd1Jx +//REbSN1AThnNcuOj1iBk+wn7EzjEETpC5eyoqeAg== X-Received: by 2002:a05:6512:22cc:: with SMTP id g12mr5564550lfu.456.1631311676036; Fri, 10 Sep 2021 15:07:56 -0700 (PDT) MIME-Version: 1.0 References: <20210902181751.252227-1-pgonda@google.com> <20210902181751.252227-2-pgonda@google.com> In-Reply-To: From: Peter Gonda Date: Fri, 10 Sep 2021 16:07:44 -0600 Message-ID: Subject: Re: [PATCH 1/3 V7] KVM, SEV: Add support for SEV intra host migration To: Sean Christopherson Cc: kvm list , Marc Orr , Paolo Bonzini , David Rientjes , "Dr . David Alan Gilbert" , Brijesh Singh , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , 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 Fri, Sep 10, 2021 at 4:03 PM Sean Christopherson wrote: > > On Fri, Sep 10, 2021, Peter Gonda wrote: > > > Do we really want to bury this under KVM_CAP? Even KVM_CAP_VM_COPY_ENC_CONTEXT_FROM > > > is a bit of a stretch, but at least that's a one-way "enabling", whereas this > > > migration routine should be able to handle multiple migrations, e.g. migrate A->B > > > and B->A. Peeking at your selftest, it should be fairly easy to add in this edge > > > case. > > > > > > This is probably a Paolo question, I've no idea if there's a desire to expand > > > KVM_CAP versus adding a new ioctl(). > > > > Thanks for the review Sean. I put this under KVM_CAP as you suggested > > following the idea of svm_vm_copy_asid_from. Paolo or anyone else have > > thoughts here? It doesn't really matter to me. > > Ah, sorry :-/ I obviously don't have a strong preference either. I am going to suggest leaving it under KVM_CAP for this reason. I don't see a great use case for A->B then B->A migrations. And if we are going to move to dst must be not SEV or SEV-ES enabled, which I think makes sense. Then your VM can only ever have migrated from 1 other VM since once it has it will be SEV/SEV-ES enabled. Does that seem reasonable? > > > > > +Architectures: x86 SEV enabled > > > > +Type: vm > > > > +Parameters: args[0] is the fd of the source vm > > > > +Returns: 0 on success > > > > > > It'd be helpful to provide a brief description of the error cases. Looks like > > > -EINVAL is the only possible error? > > > > > > > +This capability enables userspace to migrate the encryption context > > > > > > I would prefer to scope this beyond "encryption context". Even for SEV, it > > > copies more than just the "context", which was an abstraction of SEV's ASID, > > > e.g. this also hands off the set of encrypted memory regions. Looking toward > > > the future, if TDX wants to support this it's going to need to hand over a ton > > > of stuff, e.g. S-EPT tables. > > > > > > Not sure on a name, maybe MIGRATE_PROTECTED_VM_FROM? > > > > Protected VM sounds reasonable. I was using 'context' here to mean all > > metadata related to a CoCo VM as with the > > KVM_CAP_VM_COPY_ENC_CONTEXT_FROM. Is it worth diverging naming here? > > Yes, as they are two similar but slightly different things, IMO we want to diverge > so that it's obvious they operate on different data. Sounds good I'll rename.