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 594D7C433F5 for ; Wed, 13 Apr 2022 00:16:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230405AbiDMATN (ORCPT ); Tue, 12 Apr 2022 20:19:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229925AbiDMATJ (ORCPT ); Tue, 12 Apr 2022 20:19:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 208D92CC80 for ; Tue, 12 Apr 2022 17:16:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BC0D8B82072 for ; Wed, 13 Apr 2022 00:16:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AD88C385A8; Wed, 13 Apr 2022 00:16:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649809007; bh=LsvXF38xQCO8La91LyrjAYgL05TyufkNgdo7W09hGzs=; h=In-Reply-To:References:Date:From:To:Cc:Subject:From; b=NdrpcPRgttmDEIiOULxAq9RkR1xc9VEIlHGlU+wlc7m2cIZWGpSsriaVGjiN/vrxA jxPFjXVwxfomL8ApsC9+QOioNWfqU4CpBDdNEy8kQALfrisKfaoOSWQVneXpPzkQU3 P4YnOJiio1ZoLzke47TtI1H9aiKeJ5DxhmaqLXkHdrCKYjKdES2dhPiWEsVYOEDKGa pi4rZFPKWZMlBi/bZ4RDIQ8oSGdDikHwhsddFsq7Lt9qLR6A77/q3MVwjjfftPvLeT TdPISKiITkbWEvDH1VXIkrXxb3Om0CO5AfHr9X26OOUAx0OdeYTuBDSKibxWBjcEW3 Fs0ApMD6P+k1Q== Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id E8E8F27C0054; Tue, 12 Apr 2022 20:16:44 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute2.internal (MEProxy); Tue, 12 Apr 2022 20:16:44 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudekledgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdetnhgu hicunfhuthhomhhirhhskhhifdcuoehluhhtoheskhgvrhhnvghlrdhorhhgqeenucggtf frrghtthgvrhhnpefhlefhudegtedvhfefueevvedtgeeukefhffehtefftdelvedthedt iedvueevudenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghnugihodhmvghsmhhtphgruhht hhhpvghrshhonhgrlhhithihqdduudeiudekheeifedvqddvieefudeiiedtkedqlhhuth hopeepkhgvrhhnvghlrdhorhhgsehlihhnuhigrdhluhhtohdruhhs X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 92CEB21E006E; Tue, 12 Apr 2022 20:16:43 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-386-g4174665229-fm-20220406.001-g41746652 Mime-Version: 1.0 Message-Id: In-Reply-To: <20220408210545.3915712-1-vannapurve@google.com> References: <20220408210545.3915712-1-vannapurve@google.com> Date: Tue, 12 Apr 2022 17:16:22 -0700 From: "Andy Lutomirski" To: "Vishal Annapurve" , "the arch/x86 maintainers" , "kvm list" , "Linux Kernel Mailing List" , linux-kselftest@vger.kernel.org Cc: "Paolo Bonzini" , "Vitaly Kuznetsov" , "Wanpeng Li" , "Jim Mattson" , "Joerg Roedel" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , "H. Peter Anvin" , shauh@kernel.org, yang.zhong@intel.com, drjones@redhat.com, ricarkol@google.com, aaronlewis@google.com, wei.w.wang@intel.com, "Kirill A. Shutemov" , "Jonathan Corbet" , "Hugh Dickins" , "Jeff Layton" , "J . Bruce Fields" , "Andrew Morton" , "Chao Peng" , "Yu Zhang" , "Nakajima, Jun" , "Dave Hansen" , "Michael Roth" , "Quentin Perret" , "Steven Price" , "Andi Kleen" , "David Hildenbrand" , "Vlastimil Babka" , "Marc Orr" , "Erdem Aktas" , "Peter Gonda" , "Sean Christopherson" , diviness@google.com, "Quentin Perret" Subject: Re: [RFC V1 PATCH 0/5] selftests: KVM: selftests for fd-based approach of supporting private memory Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 8, 2022, at 2:05 PM, Vishal Annapurve wrote: > This series implements selftests targeting the feature floated by Chao > via: > https://lore.kernel.org/linux-mm/20220310140911.50924-1-chao.p.peng@linux.intel.com/ > > Below changes aim to test the fd based approach for guest private memory > in context of normal (non-confidential) VMs executing on non-confidential > platforms. > > Confidential platforms along with the confidentiality aware software > stack support a notion of private/shared accesses from the confidential > VMs. > Generally, a bit in the GPA conveys the shared/private-ness of the > access. Non-confidential platforms don't have a notion of private or > shared accesses from the guest VMs. To support this notion, > KVM_HC_MAP_GPA_RANGE > is modified to allow marking an access from a VM within a GPA range as > always shared or private. Any suggestions regarding implementing this ioctl > alternatively/cleanly are appreciated. This is fantastic. I do think we need to decide how this should work in general. We have a few platforms with somewhat different properties: TDX: The guest decides, per memory access (using a GPA bit), whether an access is private or shared. In principle, the same address could be *both* and be distinguished by only that bit, and the two addresses would refer to different pages. SEV: The guest decides, per memory access (using a GPA bit), whether an access is private or shared. At any given time, a physical address (with that bit masked off) can be private, shared, or invalid, but it can't be valid as private and shared at the same time. pKVM (currently, as I understand it): the guest decides by hypercall, in advance of an access, which addresses are private and which are shared. This series, if I understood it correctly, is like TDX except with no hardware security. Sean or Chao, do you have a clear sense of whether the current fd-based private memory proposal can cleanly support SEV and pKVM? What, if anything, needs to be done on the API side to get that working well? I don't think we need to support SEV or pKVM right away to get this merged, but I do think we should understand how the API can map to them.