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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91FC3C43334 for ; Thu, 21 Jul 2022 21:19:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BB708E0001; Thu, 21 Jul 2022 17:19:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 743196B0073; Thu, 21 Jul 2022 17:19:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 595A58E0001; Thu, 21 Jul 2022 17:19:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4487B6B0072 for ; Thu, 21 Jul 2022 17:19:12 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 08A631A0B19 for ; Thu, 21 Jul 2022 21:19:12 +0000 (UTC) X-FDA: 79712372544.17.165242A Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by imf15.hostedemail.com (Postfix) with ESMTP id 82B61A0086 for ; Thu, 21 Jul 2022 21:19:11 +0000 (UTC) Received: by mail-pf1-f179.google.com with SMTP id o12so2872092pfp.5 for ; Thu, 21 Jul 2022 14:19:11 -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=ScpzxJyKmeludExQxXIszukI2lfSKDVjTGaUtRwviD0=; b=fYYV0vbwKMgnf6isTcV+vMM02uE3HouFd898nbPDmChcgRckNqpK/32TxwPnHN227J ++L0os8W6x9ium+SRGtN1Ky0yP28Yuv/qHye6YY85twUgSpz5cL4iafN1yWBzT5mF5jT zfZ0audvBpI4c00xFJNjzqhLBl3DeJoNNfW967aC5PgjacYCopiCYm4yTM/A0/u+cirV MUabNXNe86MjLj4FukHS14w3Pyv+H9Fs6bPQsVG7BpQl5iGi6UTeRa3otGxN0BH1ah9v 19fMAXWCGwObG/1U0EneiYQ/0oaLDLnpN90yC2Rxw6G7kn46NiP6IFXR/iv11/pJMTkK uw5A== 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=ScpzxJyKmeludExQxXIszukI2lfSKDVjTGaUtRwviD0=; b=war9Pf4+VmAvyicAdkAkeotFHYHYVy149R+zBpxKo1jmOf2qOpaIBvMTeeESlTxlMO sDv13j79ioQYRil8vSbVI5AOnPsl/Ro8m17gA9l39H9zc0ehkMVHYS5sJfovWYl9yVRf //i+xPoXe2Kkcx7EQydDYCkaL8js0j+ccj0BCYJxgqNVNRAtxibIAJigN+ng9bPKvPyH 5Ad1ejmfuSgoQss02hLRsAAwAlFDE3pUuADqw8f3METPbgYLLUdiO+Kf99Koj3LHief0 u9vl8EwikF4jOdurfDpvhM7qSwegAuO+Wr11fKXuELZPGd76S0CWB8WIIIO7l5azkeeh isdA== X-Gm-Message-State: AJIora//Ee1/FRFpTlS+5vf3GZn/iIClkrtXtd9mi9PG0y/NIxCQcE8n bbwN/3/PevGNNbL1rCNL2WtpDQ== X-Google-Smtp-Source: AGRyM1tRhRp+6mg/TcG9DeP0WjeN5fNx2D34QSPiNsnaUnKIDpEjYXyyrYr8GL+NFtkg+bEZ2FCYeg== X-Received: by 2002:a65:6d19:0:b0:41a:625e:7d7a with SMTP id bf25-20020a656d19000000b0041a625e7d7amr275152pgb.506.1658438350139; Thu, 21 Jul 2022 14:19:10 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id i67-20020a62c146000000b005289fbef7c4sm2243655pfg.140.2022.07.21.14.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 14:19:09 -0700 (PDT) Date: Thu, 21 Jul 2022 21:19:06 +0000 From: Sean Christopherson To: "Gupta, Pankaj" Cc: Chao Peng , Quentin Perret , Michael Roth , Andy Lutomirski , Steven Price , kvm list , Linux Kernel Mailing List , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Linux API , qemu-devel@nongnu.org, Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , the arch/x86 maintainers , "H. Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Mike Rapoport , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , "Kirill A. Shutemov" , "Nakajima, Jun" , Dave Hansen , Andi Kleen , David Hildenbrand , Marc Zyngier , Will Deacon , nikunj@amd.com, ashish.kalra@amd.com Subject: Re: [PATCH v5 00/13] KVM: mm: fd-based approach for supporting KVM guest private memory Message-ID: References: <83fd55f8-cd42-4588-9bf6-199cbce70f33@www.fastmail.com> <20220422105612.GB61987@chaop.bj.intel.com> <20220509223056.pyazfxjwjvipmytb@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658438351; a=rsa-sha256; cv=none; b=gR8hO+oyXcvjKqWIhlqc1OTLwaI7oPfAHJkrv09EpbDNBTqL1pJ7kUOjrhetQExJsN0NZt /mqiTsj1lIE0XI9KT2EV/eySkhqmml4mORoQi6jTifiXRpv3cVqkOwkGVwcDodMItGLM8G pwQPcO0MvEcO3lZp0lNmnASEFVaXHLM= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=fYYV0vbw; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf15.hostedemail.com: domain of seanjc@google.com designates 209.85.210.179 as permitted sender) smtp.mailfrom=seanjc@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658438351; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ScpzxJyKmeludExQxXIszukI2lfSKDVjTGaUtRwviD0=; b=eMv7OuN6FjOMDVTo7j2WZp3WrWt7hbFOVYJaK+/sPEaP5BejxXFnHClbFe80ufOkctOxHt 05aNnwUEEoiOI47ZIMGiX2bcHz+4cAxcKqbIRWltHoW2UnHruuQShj0hsrIzz7h0gpbRKw s8gvXSddLyrzBltSXQjUpLCqxxtmh8k= X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 82B61A0086 X-Stat-Signature: awezhqa6sbrh8cg8pwpn9skhkp383757 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=fYYV0vbw; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf15.hostedemail.com: domain of seanjc@google.com designates 209.85.210.179 as permitted sender) smtp.mailfrom=seanjc@google.com X-HE-Tag: 1658438351-207875 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jul 21, 2022, Gupta, Pankaj wrote: > > Hi Sean, Chao, > > While attempting to solve the pre-boot guest payload/firmware population > into private memory for SEV SNP, retrieved this thread. Have question below: > > > > > Requirements & Gaps > > > > ------------------------------------- > > > > - Confidential computing(CC): TDX/SEV/CCA > > > > * Need support both explicit/implicit conversions. > > > > * Need support only destructive conversion at runtime. > > > > * The current patch should just work, but prefer to have pre-boot guest > > > > payload/firmware population into private memory for performance. > > > > > > Not just performance in the case of SEV, it's needed there because firmware > > > only supports in-place encryption of guest memory, there's no mechanism to > > > provide a separate buffer to load into guest memory at pre-boot time. I > > > think you're aware of this but wanted to point that out just in case. > > > > I view it as a performance problem because nothing stops KVM from copying from > > userspace into the private fd during the SEV ioctl(). What's missing is the > > ability for userspace to directly initialze the private fd, which may or may not > > avoid an extra memcpy() depending on how clever userspace is. > Can you please elaborate more what you see as a performance problem? And > possible ways to solve it? Oh, I'm not saying there actually _is_ a performance problem. What I'm saying is that in-place encryption is not a functional requirement, which means it's purely an optimization, and thus we should other bother supporting in-place encryption _if_ it would solve a performane bottleneck.