Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp178924pxb; Tue, 12 Apr 2022 20:47:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2L1BFhoCcYwmowKIeSCf4CJjUDh42Y7mwPR0zCuHkhe4zclf3sFJqVat7ONhuJcMpM6+0 X-Received: by 2002:a05:6a00:1a10:b0:4fc:d6c5:f3ed with SMTP id g16-20020a056a001a1000b004fcd6c5f3edmr7688898pfv.85.1649821641144; Tue, 12 Apr 2022 20:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649821641; cv=none; d=google.com; s=arc-20160816; b=NMbrpJJ67QaOFt/AjTPEXbBPk5gtB0b3Uvd61CNSuZTqWsKwnV/jdteaRd2Wlsmy4c 3Jac+ibDKAAI68Jv8AGxGjl7SRvCLLfz6mwk2KfOnY5LprmlQ3lgWT89Qn7Ct8Kap0Lu KVNKYfuwjaDJQe8tvbT7BZHMHK3e9aMh+YwES+FS0Z+ZbrY0csPO3T7olbZvAlD4wy/B hdJnB+eT80b7et1QjEQZTQ+aWWb6sy2iHU9NkzbW8/jssXq60JH+KsWGuLRvQt8OxsPn wy1JRWACdqSbLVRcMxLXrLJjA2riUEZ3gldt1uobAQuBy2t8I9X6C52iHLj7/8mjrD4b GhRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature; bh=9Ts0BV7ZoFjdOoDGhjvboetejTWvJVFQAYICMotB9EU=; b=w6nrMb9D9PvdHwNFl2VAV9SrOsIliDQqQRaib9arw0JIx2KHyl7uXelFPV12wNgUot 0GV8N5DkCUt6Oidec1cYxEQDJGsuDtcrjgcmv5we0cGqHXw7gn/tAb8tw4Os5wdZ6CVH J/z2ltne/eB87LamNMmXIvCP1Pq9lqg4rGzTCwV70F/5O83Oiq3132JyiO30AxrHdaxo CT7gcM6kpilPDxp3FYmPHXyMYEGSoaXwXt/6YvHXnVtXiptzUfh7HWNeP3XQjMcPMN11 rsVKgzWF6RS2hER4axHs2cs+tfPRUxI9OH9s62TVjMBXr/vovpxx4iPkgVBC1LNQcIo/ Ud/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NdrpcPRg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p7-20020a1709026b8700b001589eb32cf3si1066167plk.150.2022.04.12.20.47.04; Tue, 12 Apr 2022 20:47:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NdrpcPRg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230292AbiDMATL (ORCPT + 99 others); Tue, 12 Apr 2022 20:19:11 -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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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.