Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3493311pxb; Mon, 4 Apr 2022 18:45:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx928njGhlDTHgp0M/+EW+MeKf3fYfbGcQkq2sER7lPnltuXPsP+sxO4m4GzZ4qmL9yOiq6 X-Received: by 2002:a17:903:41c2:b0:156:a033:a649 with SMTP id u2-20020a17090341c200b00156a033a649mr1160843ple.32.1649123123210; Mon, 04 Apr 2022 18:45:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649123123; cv=none; d=google.com; s=arc-20160816; b=QWv5DFNwVUy0qzp41ZtWqyKNJr/JnwHgXGkzO6dJxpBqjFzQ4JHhZWi6JLL6Tnt2SM Wc8+4NbBrBvdh2VoJbvQaN2oNKcRRhQxzRjCe7PqT3PYumbP7+ljsrob7pMk4Ebfatvu 9MR0eek8KrVnlZ19YLdGH0FZ+ng3Apv/HjxXGcVi9XKazXgogeTfS9i5SscGDaMx1PKV 3w/XqEffVts5sCb33wGMNYCPz9r9g3DxOWDPOVupRi4V/OiAxdJaChKZ+bfRJmEmqTxe HCNUXE7mGwUHNXYSYuIc061GAhQ6xD2FOfg/F2Vl3riG7lRChWwDIaJ9Ub6Os8/KZaAJ uiPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yBvT/RIL9LHH1Mgf37Nb2nJIQ03TuOvpTivVWxcN1v4=; b=Kq/w0Zap0tHmL81abFxVL6NS473lFnCGbswenlDXYWMV15ia2bOoh0Zn70FOc8Dw6I 82uW/UWY+M1E29Qhp79CcccfMxNG+zuQeY/NSeSftaDN9IcMuNZ0hFbN5GLro6rG9pcB MPUGant4Ic03wxnyFNUrLTPQDBhaGCAvSmH7JPvR8A6pKOF+8tl+NUirZgHXkHRTRxJs osShU+F+VVd5QgcxSf3lq1oQu9bCENuMj6ujtYU8+v1Ymm0v3wbhwfs1ariUecFlRbDj nYKh3Kjei0BsU0UPlRd9E2+uHVDb4uqwpr9pEIGfHWd/ZLFMEdmY1V9y4dih3QxzK7Kv BppA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Pv0XV1dH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e12-20020a63db0c000000b00382295afcf7si11930276pgg.634.2022.04.04.18.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:45:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Pv0XV1dH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 54EBE2B41B3; Mon, 4 Apr 2022 17:45:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349083AbiDASEl (ORCPT + 99 others); Fri, 1 Apr 2022 14:04:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237019AbiDASEj (ORCPT ); Fri, 1 Apr 2022 14:04:39 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5063B297 for ; Fri, 1 Apr 2022 11:02:48 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id s11so3274346pfu.13 for ; Fri, 01 Apr 2022 11:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=yBvT/RIL9LHH1Mgf37Nb2nJIQ03TuOvpTivVWxcN1v4=; b=Pv0XV1dHALOkjDJBg1gjNFFCD/fH4tBOKz+NF45/Hf8dNQb6h6XdKcZeXejGysCikr qH14VdW8YXObf+z6ElnoYM3OKnW8HYxQqU8K0Gld7765PiNynn2A7ihxsVW/WvxkXD2Y GTJGLhgFFovSvgvNYtbxttRScVZWG3PK8TPcmUgOUBlY3lq7tkSOzTZG5e2ROsAKsqGi xCB2FiKIeuLlY3FJ8p1G7pxclXEtYTX0bvaTDit8zgLGaBrEaDKxg2Bld52srP0tXr5D P8EXZpUCJtumcZP8CEHVL5rnYLTekmmboBgdhxs5tONCnPYBeamCUsqlji3x/77bFwth 8ZXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=yBvT/RIL9LHH1Mgf37Nb2nJIQ03TuOvpTivVWxcN1v4=; b=pB8HxMUzKqF/DBBI1xhyaZVWjLFoh4drN0SJ6XLxChpHIGxEIXfDuMYfJ25cGndGLF c/kGcr9PcJ7QDNFi49csoqTQMzdURs14h/kXlVTePq7D8+oX/Z/6pWUhPR0vrpx6WTb7 LLuxRNQkdhBDJFWUfCWv5JqFX+4wyWu3chSW75M+EMd52pZwxve/kCLJDAlWtHJSZtjt /oQd+tBpPG8biQFC0266tslgbbzAsXZHLUXKIq5mO4xxDl5byukL8hbGVKuM/nTRBv8u InX6zb1yrIsWUfyCaMy83m0KKiVJ+g+dJrbYdLK4bc1eApj66lRAuGwYvGnag8QccL2a Pp3g== X-Gm-Message-State: AOAM532E5zaTRK0k8405uW4N7NSYjj/8KZ1eL57LYtovYOyhu1Z3J9OD DZxWKkYkMyBdoMnkivQcs4GcAg== X-Received: by 2002:a05:6a00:1510:b0:4fa:f5fe:ffd5 with SMTP id q16-20020a056a00151000b004faf5feffd5mr12176247pfu.2.1648836167854; Fri, 01 Apr 2022 11:02:47 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id w9-20020a056a0014c900b004fb2ca5f6d7sm3781681pfu.136.2022.04.01.11.02.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 11:02:47 -0700 (PDT) Date: Fri, 1 Apr 2022 18:02:41 +0000 From: Sean Christopherson To: Marc Orr Cc: Peter Gonda , "Nikunj A. Dadhania" , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Brijesh Singh , Tom Lendacky , Bharata B Rao , "Maciej S . Szmigiero" , Mingwei Zhang , David Hildenbrand , kvm list , LKML Subject: Re: [PATCH RFC v1 0/9] KVM: SVM: Defer page pinning for SEV guests Message-ID: References: <20220308043857.13652-1-nikunj@amd.com> <5567f4ec-bbcf-4caf-16c1-3621b77a1779@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 01, 2022, Marc Orr wrote: > On Thu, Mar 31, 2022 at 12:01 PM Sean Christopherson wrote: > > Yep, that's a big reason why I view purging the existing SEV memory management as > > a long term goal. The other being that userspace obviously needs to be updated to > > support UPM[*]. I suspect the only feasible way to enable this for SEV/SEV-ES > > would be to restrict it to new VM types that have a disclaimer regarding additional > > requirements. > > > > [*] I believe Peter coined the UPM acronym for "Unmapping guest Private Memory". We've > > been using it iternally for discussion and it rolls off the tongue a lot easier than > > the full phrase, and is much more precise/descriptive than just "private fd". > > Can we really "purge the existing SEV memory management"? This seems > like a non-starter because it violates userspace API (i.e., the > ability for the userspace VMM to run a guest without > KVM_FEATURE_HC_MAP_GPA_RANGE). Or maybe I'm not quite following what > you mean by purge. I really do mean purge, but I also really do mean "long term", as in 5+ years (probably 10+ if I'm being realistic). Removing support is completely ok, as is changing the uABI, the rule is that we can't break userspace. If all users are migrated to private-fd, e.g. by carrots and/or sticks such as putting the code into maintenance-only mode, then at some point in the future there will be no users left to break and we can drop the current code and make use of private-fd mandatory for SEV/SEV-ES guests. > Assuming that UPM-based lazy pinning comes together via a new VM type > that only supports new images based on a minimum kernel version with > KVM_FEATURE_HC_MAP_GPA_RANGE, then I think this would like as follows: > > 1. Userspace VMM: Check SEV VM type. If type is legacy SEV type then > do upfront pinning. Else, skip up front pinning. Yep, if by legacy "SEV type" you mean "SEV/SEV-ES guest that isn't required to use MAP_GPA_RANGE", which I'm pretty sure you do based on #3. > 2. KVM: I'm not sure anything special needs to happen here. For the > legacy VM types, it can be configured to use legacy memslots, > presumably the same as non-CVMs will be configured. For the new VM > type, it should be configured to use UPM. Correct, for now, KVM does nothing different for SEV/SEV-ES guests. > 3. Control plane (thing creating VMs): Responsible for not allowing > legacy SEV images (i.e., images without KVM_FEATURE_HC_MAP_GPA_RANGE) > with the new SEV VM types that use UPM and have support for demand > pinning. > > Sean: Did I get this right? Yep.