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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 404C3C433EF for ; Fri, 1 Apr 2022 18:02:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348625AbiDASEk (ORCPT ); Fri, 1 Apr 2022 14:04:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243382AbiDASEj (ORCPT ); Fri, 1 Apr 2022 14:04:39 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B52903BA6F for ; Fri, 1 Apr 2022 11:02:48 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id q142so1208841pgq.9 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=kSKVJ3xXmKVDaAu7qDYF617Nc8s2EeZnUMH/IY2xTlmJkIXhHCbDBcwVhPoM7tIOiY gObmdC4nf8C8t66PmHZP/ERpjXS6uV3sju5dd/nlL0cpPhbBka65cx6NIOT4xPJIKTjo e81P2iw+sCQFjewpjbX3ddI0szRX2zaaf5uWWZ3tN2fu3fg7f0vTE6gs0x+FqXx7v/Xb AqbCyIg04hmJ2FOtkzw8Yx1RRIl65XpJfJzvJETutvE9CKlJEz1fayhwljaB+ajkwL5d bofJ+Imq7ZjBISf4xhgJvsKlJx8ndPchx0bE0LLiZO60fwnlsAg41RmqQOZ1jiWt9zyo hR1Q== X-Gm-Message-State: AOAM530Ws8FN8eCDTmBSNq7hYOTyiDD4S3j9qAN2+I1TbEjZC7Qfwpmy xkocmCnyGLFoV+FQnSWPQQsOvQ== X-Google-Smtp-Source: ABdhPJwm3yL50kfR2zpLtlx5tRibJvFK2B4JSh+l1+8WCnDCvxbxlkwbsCvtZW3NlCs8tPNL/eCRew== 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: Precedence: bulk List-ID: X-Mailing-List: kvm@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.